@pie-element/inline-dropdown 10.4.0-beta.7 → 11.0.0-next.20261002100925
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/author.js +2 -0
- package/configure.js +2 -0
- package/controller.js +1 -0
- package/dist/author/defaults.d.ts +194 -0
- package/dist/author/defaults.js +130 -0
- package/dist/author/index.d.ts +44 -0
- package/dist/author/index.js +86 -0
- package/dist/author/inline-dropdown-toolbar.d.ts +49 -0
- package/dist/author/inline-dropdown-toolbar.js +266 -0
- package/dist/author/main.d.ts +49 -0
- package/dist/author/main.js +379 -0
- package/dist/author/markupUtils.d.ts +12 -0
- package/dist/author/markupUtils.js +23 -0
- package/dist/author/response-area.d.ts +20 -0
- package/dist/author/response-area.js +32 -0
- package/dist/author/utils.d.ts +10 -0
- package/dist/author/utils.js +10 -0
- package/dist/browser/Close-BtVRakGm.js +9145 -0
- package/dist/browser/Close-BtVRakGm.js.map +1 -0
- package/dist/browser/assets/Symbola-4c507403.woff2 +0 -0
- package/dist/browser/author/index.js +35963 -0
- package/dist/browser/author/index.js.map +1 -0
- package/dist/browser/controller/index.js +196 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +2804 -0
- package/dist/browser/delivery/index.js.map +1 -0
- package/dist/browser/dist-BJd6t-uW.js +137 -0
- package/dist/browser/dist-BJd6t-uW.js.map +1 -0
- package/dist/browser/editor-runtime/Close-Z_UL2IH9.js +9145 -0
- package/dist/browser/editor-runtime/Close-Z_UL2IH9.js.map +1 -0
- package/dist/browser/editor-runtime/assets/Symbola-4c507403.woff2 +0 -0
- package/dist/browser/editor-runtime/author/index.js +19554 -0
- package/dist/browser/editor-runtime/author/index.js.map +1 -0
- package/dist/browser/editor-runtime/controller/index.js +196 -0
- package/dist/browser/editor-runtime/controller/index.js.map +1 -0
- package/dist/browser/editor-runtime/delivery/index.js +2804 -0
- package/dist/browser/editor-runtime/delivery/index.js.map +1 -0
- package/dist/browser/editor-runtime/dist-BJd6t-uW.js +137 -0
- package/dist/browser/editor-runtime/dist-BJd6t-uW.js.map +1 -0
- package/dist/browser/editor-runtime/rolldown-runtime-CHQKHQ89.js +32 -0
- package/dist/browser/rolldown-runtime-CWhphoD1.js +32 -0
- package/dist/controller/defaults.d.ts +27 -0
- package/dist/controller/defaults.js +21 -0
- package/dist/controller/index.d.ts +54 -0
- package/dist/controller/index.js +124 -0
- package/dist/controller/utils.d.ts +12 -0
- package/dist/controller/utils.js +13 -0
- package/dist/delivery/index.d.ts +20 -0
- package/dist/delivery/index.js +60 -0
- package/dist/delivery/inline-dropdown.d.ts +38 -0
- package/dist/delivery/inline-dropdown.js +109 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +148 -0
- package/dist/index.js +2 -0
- package/dist/runtime-support.d.ts +12 -0
- package/dist/runtime-support.js +12 -0
- package/package.json +94 -21
- package/CHANGELOG.json +0 -1082
- package/CHANGELOG.md +0 -2237
- package/LICENSE.md +0 -5
- package/README.md +0 -1
- package/configure/CHANGELOG.json +0 -647
- package/configure/CHANGELOG.md +0 -1994
- package/configure/lib/__tests__/inline-dropdown-toolbar.test.js +0 -1654
- package/configure/lib/__tests__/main.test.js +0 -598
- package/configure/lib/__tests__/markupUtils.test.js +0 -107
- package/configure/lib/defaults.js +0 -192
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/index.js +0 -139
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/inline-dropdown-toolbar.js +0 -462
- package/configure/lib/inline-dropdown-toolbar.js.map +0 -1
- package/configure/lib/main.js +0 -612
- package/configure/lib/main.js.map +0 -1
- package/configure/lib/markupUtils.js +0 -50
- package/configure/lib/markupUtils.js.map +0 -1
- package/configure/lib/response-area.js +0 -48
- package/configure/lib/response-area.js.map +0 -1
- package/configure/lib/utils.js +0 -22
- package/configure/lib/utils.js.map +0 -1
- package/configure/package.json +0 -24
- package/controller/CHANGELOG.json +0 -467
- package/controller/CHANGELOG.md +0 -1325
- package/controller/lib/__tests__/index.test.js +0 -705
- package/controller/lib/defaults.js +0 -25
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -295
- package/controller/lib/index.js.map +0 -1
- package/controller/lib/utils.js +0 -32
- package/controller/lib/utils.js.map +0 -1
- package/controller/package.json +0 -16
- package/docs/config-schema.json +0 -2854
- package/docs/config-schema.json.md +0 -2106
- package/docs/demo/config.js +0 -8
- package/docs/demo/generate.js +0 -76
- package/docs/demo/index.html +0 -1
- package/docs/demo/pie.manifest.json +0 -11
- package/docs/demo/session.js +0 -11
- package/docs/pie-schema.json +0 -1152
- package/docs/pie-schema.json.md +0 -814
- package/lib/index.js +0 -86
- package/lib/index.js.map +0 -1
- package/lib/inline-dropdown.js +0 -176
- package/lib/inline-dropdown.js.map +0 -1
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
//#region ../../shared/lodash/dist/index.js
|
|
2
|
+
var e = Object.prototype;
|
|
3
|
+
function t(e) {
|
|
4
|
+
return typeof e == "object" && !!e;
|
|
5
|
+
}
|
|
6
|
+
function n(e) {
|
|
7
|
+
return Array.isArray(e) ? e : typeof e == "number" ? [e] : e.replace(/\[(\d+)\]/g, ".$1").split(".").filter(Boolean);
|
|
8
|
+
}
|
|
9
|
+
function r(e) {
|
|
10
|
+
return (t) => p(t, e);
|
|
11
|
+
}
|
|
12
|
+
function i(e) {
|
|
13
|
+
return (n) => t(n) ? Object.entries(e).every(([e, t]) => g(n[e], t)) : !1;
|
|
14
|
+
}
|
|
15
|
+
function a(e) {
|
|
16
|
+
return typeof e == "function" ? e : typeof e == "string" ? r(e) : t(e) ? i(e) : ((e) => e);
|
|
17
|
+
}
|
|
18
|
+
function o(e) {
|
|
19
|
+
if (!t(e)) return e;
|
|
20
|
+
if (e instanceof Date) return new Date(e.getTime());
|
|
21
|
+
if (Array.isArray(e)) return e.map((e) => o(e));
|
|
22
|
+
let n = {};
|
|
23
|
+
for (let [t, r] of Object.entries(e)) n[t] = o(r);
|
|
24
|
+
return n;
|
|
25
|
+
}
|
|
26
|
+
function s(e) {
|
|
27
|
+
return (e ?? []).filter(Boolean);
|
|
28
|
+
}
|
|
29
|
+
function c(e, t = 0, n = {}) {
|
|
30
|
+
let r, i, a, o, s, c = n.leading === !0, l = n.trailing !== !1, u = () => {
|
|
31
|
+
if (!a) return s;
|
|
32
|
+
let t = a, n = o;
|
|
33
|
+
return a = void 0, o = void 0, s = e.apply(n, t), s;
|
|
34
|
+
}, d = () => {
|
|
35
|
+
r && clearTimeout(r), i && clearTimeout(i), r = void 0, i = void 0, a = void 0, o = void 0;
|
|
36
|
+
}, f = function(...e) {
|
|
37
|
+
let d = c && !r;
|
|
38
|
+
return a = e, o = this, d && u(), r && clearTimeout(r), r = setTimeout(() => {
|
|
39
|
+
r = void 0, i &&= (clearTimeout(i), void 0), l ? u() : (a = void 0, o = void 0);
|
|
40
|
+
}, t), n.maxWait !== void 0 && !i && (i = setTimeout(() => {
|
|
41
|
+
r && clearTimeout(r), r = void 0, i = void 0, l || !c ? u() : (a = void 0, o = void 0);
|
|
42
|
+
}, n.maxWait)), s;
|
|
43
|
+
};
|
|
44
|
+
return f.cancel = d, f.flush = () => (r &&= (clearTimeout(r), void 0), i &&= (clearTimeout(i), void 0), u()), f;
|
|
45
|
+
}
|
|
46
|
+
function l(e, ...t) {
|
|
47
|
+
for (let n of t) if (n) for (let [t, r] of Object.entries(n)) e[t] === void 0 && (e[t] = r);
|
|
48
|
+
return e;
|
|
49
|
+
}
|
|
50
|
+
function u(e) {
|
|
51
|
+
return String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
52
|
+
}
|
|
53
|
+
function d(e) {
|
|
54
|
+
let t = [];
|
|
55
|
+
for (let n of e ?? []) Array.isArray(n) ? t.push(...n) : t.push(n);
|
|
56
|
+
return t;
|
|
57
|
+
}
|
|
58
|
+
function f(e, t) {
|
|
59
|
+
let n = Array.isArray(e) ? e.entries() : Object.entries(e ?? {});
|
|
60
|
+
for (let [r, i] of n) t(i, r, e);
|
|
61
|
+
return e;
|
|
62
|
+
}
|
|
63
|
+
function p(e, t, r) {
|
|
64
|
+
if (!Array.isArray(t) && e != null && Object.prototype.hasOwnProperty.call(Object(e), t)) {
|
|
65
|
+
let n = e[t];
|
|
66
|
+
return n === void 0 ? r : n;
|
|
67
|
+
}
|
|
68
|
+
let i = e;
|
|
69
|
+
for (let e of n(t)) {
|
|
70
|
+
if (i == null) return r;
|
|
71
|
+
i = i[e];
|
|
72
|
+
}
|
|
73
|
+
return i === void 0 ? r : i;
|
|
74
|
+
}
|
|
75
|
+
function m(e) {
|
|
76
|
+
return e == null ? !0 : typeof e == "string" || Array.isArray(e) ? e.length === 0 : e instanceof Map || e instanceof Set ? e.size === 0 : !t(e) || Object.keys(e).length === 0;
|
|
77
|
+
}
|
|
78
|
+
function h(n, r, i) {
|
|
79
|
+
let a = i?.(n, r);
|
|
80
|
+
if (a !== void 0) return !!a;
|
|
81
|
+
if (Object.is(n, r)) return !0;
|
|
82
|
+
if (!t(n) || !t(r)) return !1;
|
|
83
|
+
if (n instanceof Date || r instanceof Date) return n instanceof Date && r instanceof Date && n.getTime() === r.getTime();
|
|
84
|
+
if (Array.isArray(n) || Array.isArray(r)) return Array.isArray(n) && Array.isArray(r) && n.length === r.length && n.every((e, t) => h(e, r[t], i));
|
|
85
|
+
let o = Object.keys(n), s = Object.keys(r);
|
|
86
|
+
return o.length === s.length && o.every((t) => e.hasOwnProperty.call(r, t) && h(n[t], r[t], i));
|
|
87
|
+
}
|
|
88
|
+
function g(e, t) {
|
|
89
|
+
return h(e, t);
|
|
90
|
+
}
|
|
91
|
+
function _(e) {
|
|
92
|
+
return Number.isFinite(e);
|
|
93
|
+
}
|
|
94
|
+
function v(e) {
|
|
95
|
+
return e === void 0;
|
|
96
|
+
}
|
|
97
|
+
function y(e, t) {
|
|
98
|
+
let n = a(t), r = Array.isArray(e) ? e.entries() : Object.entries(e ?? {}), i = [];
|
|
99
|
+
for (let [t, a] of r) i.push(n(a, t, e));
|
|
100
|
+
return i;
|
|
101
|
+
}
|
|
102
|
+
function b(e) {
|
|
103
|
+
return e?.length ? Math.max(...e) : void 0;
|
|
104
|
+
}
|
|
105
|
+
function x(e, t) {
|
|
106
|
+
let n = { ...e ?? {} };
|
|
107
|
+
for (let e of Array.isArray(t) ? t : [t]) delete n[e];
|
|
108
|
+
return n;
|
|
109
|
+
}
|
|
110
|
+
function S(e, t, n) {
|
|
111
|
+
let r = n, i = Array.isArray(e) ? e.entries() : Object.entries(e ?? {});
|
|
112
|
+
for (let [n, a] of i) r = t(r, a, n, e);
|
|
113
|
+
return r;
|
|
114
|
+
}
|
|
115
|
+
function C(e, t, r) {
|
|
116
|
+
let i = n(t), a = e;
|
|
117
|
+
return i.forEach((e, t) => {
|
|
118
|
+
if (t === i.length - 1) {
|
|
119
|
+
a[e] = r;
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
let n = i[t + 1];
|
|
123
|
+
a[e] ??= typeof n == "number" || /^\d+$/.test(String(n)) ? [] : {}, a = a[e];
|
|
124
|
+
}), e;
|
|
125
|
+
}
|
|
126
|
+
function w(e, t) {
|
|
127
|
+
let n = t ?? ((e) => e);
|
|
128
|
+
return Array.from({ length: Math.max(0, e) }, (e, t) => n(t));
|
|
129
|
+
}
|
|
130
|
+
function T(...e) {
|
|
131
|
+
let t = Math.max(0, ...e.map((e) => e.length));
|
|
132
|
+
return Array.from({ length: t }, (t, n) => e.map((e) => e[n]));
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
135
|
+
export { p as _, _ as a, x as c, c as d, o as f, s as g, l as h, v as i, f as l, T as m, C as n, m as o, w as p, S as r, y as s, g as t, u, d as v, b as y };
|
|
136
|
+
|
|
137
|
+
//# sourceMappingURL=dist-BJd6t-uW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dist-BJd6t-uW.js","names":[],"sources":["../../../../../shared/lodash/dist/index.js"],"sourcesContent":["//#region src/index.ts\nvar e = Object.prototype;\nfunction t(e) {\n\treturn typeof e == \"object\" && !!e;\n}\nfunction n(e) {\n\treturn Array.isArray(e) ? e : typeof e == \"number\" ? [e] : e.replace(/\\[(\\d+)\\]/g, \".$1\").split(\".\").filter(Boolean);\n}\nfunction r(e) {\n\treturn (t) => x(t, e);\n}\nfunction i(e) {\n\treturn (n) => t(n) ? Object.entries(e).every(([e, t]) => A(n[e], t)) : !1;\n}\nfunction a(e) {\n\treturn typeof e == \"function\" ? e : typeof e == \"string\" ? r(e) : t(e) ? i(e) : ((e) => e);\n}\nfunction o(e, ...t) {\n\treturn Object.assign(e, ...t.filter(Boolean));\n}\nfunction s(e, t = 1) {\n\tif (!e?.length || t < 1) return [];\n\tlet n = [];\n\tfor (let r = 0; r < e.length; r += t) n.push(e.slice(r, r + t));\n\treturn n;\n}\nfunction c(e) {\n\treturn Array.isArray(e) ? e.slice() : t(e) ? { ...e } : e;\n}\nfunction l(e) {\n\tif (!t(e)) return e;\n\tif (e instanceof Date) return new Date(e.getTime());\n\tif (Array.isArray(e)) return e.map((e) => l(e));\n\tlet n = {};\n\tfor (let [t, r] of Object.entries(e)) n[t] = l(r);\n\treturn n;\n}\nfunction u(e) {\n\treturn (e ?? []).filter(Boolean);\n}\nfunction d(e, ...t) {\n\tlet n = [...e ?? []];\n\tfor (let e of t) Array.isArray(e) ? n.push(...e) : n.push(e);\n\treturn n;\n}\nfunction f(e, t = 0, n = {}) {\n\tlet r, i, a, o, s, c = n.leading === !0, l = n.trailing !== !1, u = () => {\n\t\tif (!a) return s;\n\t\tlet t = a, n = o;\n\t\treturn a = void 0, o = void 0, s = e.apply(n, t), s;\n\t}, d = () => {\n\t\tr && clearTimeout(r), i && clearTimeout(i), r = void 0, i = void 0, a = void 0, o = void 0;\n\t}, f = function(...e) {\n\t\tlet d = c && !r;\n\t\treturn a = e, o = this, d && u(), r && clearTimeout(r), r = setTimeout(() => {\n\t\t\tr = void 0, i &&= (clearTimeout(i), void 0), l ? u() : (a = void 0, o = void 0);\n\t\t}, t), n.maxWait !== void 0 && !i && (i = setTimeout(() => {\n\t\t\tr && clearTimeout(r), r = void 0, i = void 0, l || !c ? u() : (a = void 0, o = void 0);\n\t\t}, n.maxWait)), s;\n\t};\n\treturn f.cancel = d, f.flush = () => (r &&= (clearTimeout(r), void 0), i &&= (clearTimeout(i), void 0), u()), f;\n}\nfunction p(e, ...t) {\n\tfor (let n of t) if (n) for (let [t, r] of Object.entries(n)) e[t] === void 0 && (e[t] = r);\n\treturn e;\n}\nfunction m(e, ...t) {\n\tlet n = new Set(t.flat());\n\treturn (e ?? []).filter((e) => !n.has(e));\n}\nfunction h(e, t, n) {\n\treturn (e ?? []).filter((e) => !(t ?? []).some((t) => n(e, t)));\n}\nfunction g(e, t) {\n\tlet n = a(t), r = Array.isArray(e) ? e.entries() : Object.entries(e ?? {});\n\tfor (let [t, i] of r) if (!n(i, t, e)) return !1;\n\treturn !0;\n}\nfunction ee(e) {\n\treturn String(e).replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\").replace(/\"/g, \""\").replace(/'/g, \"'\");\n}\nfunction _(e, t) {\n\tlet n = a(t), r = Array.isArray(e) ? e.entries() : Object.entries(e ?? {});\n\tfor (let [t, i] of r) if (n(i, t, e)) return i;\n}\nfunction v(e, t) {\n\tlet n = a(t);\n\tfor (let [t, r] of Object.entries(e ?? {})) if (n(r, t, e)) return t;\n}\nfunction y(e) {\n\tlet t = [];\n\tfor (let n of e ?? []) Array.isArray(n) ? t.push(...n) : t.push(n);\n\treturn t;\n}\nfunction te(e, t) {\n\treturn R(e, t).flat();\n}\nfunction b(e, t) {\n\tlet n = Array.isArray(e) ? e.entries() : Object.entries(e ?? {});\n\tfor (let [r, i] of n) t(i, r, e);\n\treturn e;\n}\nfunction x(e, t, r) {\n\tif (!Array.isArray(t) && e != null && Object.prototype.hasOwnProperty.call(Object(e), t)) {\n\t\tlet n = e[t];\n\t\treturn n === void 0 ? r : n;\n\t}\n\tlet i = e;\n\tfor (let e of n(t)) {\n\t\tif (i == null) return r;\n\t\ti = i[e];\n\t}\n\treturn i === void 0 ? r : i;\n}\nfunction S(e, t) {\n\tlet n = a(t);\n\treturn K(e, (t, r, i) => {\n\t\tlet a = String(n(r, i, e));\n\t\treturn (t[a] ??= []).push(r), t;\n\t}, {});\n}\nfunction C(e) {\n\treturn e?.[0];\n}\nfunction w(e) {\n\treturn (e ?? []).slice(0, -1);\n}\nfunction T(e, t) {\n\treturn typeof e == \"string\" ? e.includes(String(t)) : Array.isArray(e) ? e.includes(t) : Object.values(e ?? {}).includes(t);\n}\nfunction E(...e) {\n\tlet [t, ...n] = e;\n\treturn $((t ?? []).filter((e) => n.every((t) => (t ?? []).includes(e))));\n}\nfunction D(e) {\n\treturn Array.isArray(e);\n}\nfunction O(e) {\n\treturn e == null ? !0 : typeof e == \"string\" || Array.isArray(e) ? e.length === 0 : e instanceof Map || e instanceof Set ? e.size === 0 : !t(e) || Object.keys(e).length === 0;\n}\nfunction k(n, r, i) {\n\tlet a = i?.(n, r);\n\tif (a !== void 0) return !!a;\n\tif (Object.is(n, r)) return !0;\n\tif (!t(n) || !t(r)) return !1;\n\tif (n instanceof Date || r instanceof Date) return n instanceof Date && r instanceof Date && n.getTime() === r.getTime();\n\tif (Array.isArray(n) || Array.isArray(r)) return Array.isArray(n) && Array.isArray(r) && n.length === r.length && n.every((e, t) => k(e, r[t], i));\n\tlet o = Object.keys(n), s = Object.keys(r);\n\treturn o.length === s.length && o.every((t) => e.hasOwnProperty.call(r, t) && k(n[t], r[t], i));\n}\nfunction A(e, t) {\n\treturn k(e, t);\n}\nfunction j(e, t, n) {\n\treturn k(e, t, n);\n}\nfunction M(e) {\n\treturn Number.isFinite(e);\n}\nfunction N(e) {\n\treturn typeof e == \"function\";\n}\nfunction P(e) {\n\treturn typeof e == \"number\" || e instanceof Number;\n}\nfunction F(e) {\n\treturn typeof e == \"object\" && !!e || typeof e == \"function\";\n}\nfunction I(e) {\n\treturn typeof e == \"string\" || e instanceof String;\n}\nfunction L(e) {\n\treturn e === void 0;\n}\nfunction R(e, t) {\n\tlet n = a(t), r = Array.isArray(e) ? e.entries() : Object.entries(e ?? {}), i = [];\n\tfor (let [t, a] of r) i.push(n(a, t, e));\n\treturn i;\n}\nfunction z(e) {\n\treturn e?.length ? Math.max(...e) : void 0;\n}\nfunction B(e, ...n) {\n\tfor (let r of n) if (r) for (let [n, i] of Object.entries(r)) t(i) && !Array.isArray(i) && t(e[n]) ? B(e[n], i) : e[n] = l(i);\n\treturn e;\n}\nfunction V(e, t) {\n\tlet n = { ...e ?? {} };\n\tfor (let e of Array.isArray(t) ? t : [t]) delete n[e];\n\treturn n;\n}\nfunction H(e, t) {\n\tlet n = a(t), r = {};\n\tfor (let [t, i] of Object.entries(e ?? {})) n(i, t, e) || (r[t] = i);\n\treturn r;\n}\nfunction U(e, ...t) {\n\tlet n = {};\n\tfor (let r of t.flat()) e && r in e && (n[r] = e[r]);\n\treturn n;\n}\nfunction W(e, t, n = 1) {\n\tlet r = t ?? e, i = t === void 0 ? 0 : e;\n\tif (n === 0) return [];\n\tlet a = [], o = n > 0;\n\tfor (let e = i; o ? e < r : e > r; e += n) a.push(e);\n\treturn a;\n}\nfunction G(e, t, n = 1) {\n\treturn W(e, t, n).reverse();\n}\nfunction K(e, t, n) {\n\tlet r = n, i = Array.isArray(e) ? e.entries() : Object.entries(e ?? {});\n\tfor (let [n, a] of i) r = t(r, a, n, e);\n\treturn r;\n}\nfunction q(e, t) {\n\tlet n = a(t), r = [];\n\tfor (let t = e.length - 1; t >= 0; t--) n(e[t], t, e) && r.unshift(...e.splice(t, 1));\n\treturn r;\n}\nfunction J(e, t, r) {\n\tlet i = n(t), a = e;\n\treturn i.forEach((e, t) => {\n\t\tif (t === i.length - 1) {\n\t\t\ta[e] = r;\n\t\t\treturn;\n\t\t}\n\t\tlet n = i[t + 1];\n\t\ta[e] ??= typeof n == \"number\" || /^\\d+$/.test(String(n)) ? [] : {}, a = a[e];\n\t}), e;\n}\nfunction Y(e) {\n\tlet t = [...e ?? []];\n\tfor (let e = t.length - 1; e > 0; e--) {\n\t\tlet n = Math.floor(Math.random() * (e + 1));\n\t\t[t[e], t[n]] = [t[n], t[e]];\n\t}\n\treturn t;\n}\nfunction X(e) {\n\treturn (e ?? []).slice(1);\n}\nfunction Z(e, t = 1) {\n\treturn t <= 0 ? [] : (e ?? []).slice(-t);\n}\nfunction Q(e, t = 0, n = {}) {\n\treturn f(e, t, {\n\t\tleading: n.leading !== !1,\n\t\ttrailing: n.trailing !== !1,\n\t\tmaxWait: t\n\t});\n}\nfunction ne(e, t) {\n\tlet n = t ?? ((e) => e);\n\treturn Array.from({ length: Math.max(0, e) }, (e, t) => n(t));\n}\nvar re = 0;\nfunction ie(e = \"\") {\n\treturn re += 1, `${e}${re}`;\n}\nfunction $(e) {\n\treturn e != null && e.length ? Array.from(new Set(Array.from(e))) : [];\n}\nfunction ae(e, t) {\n\tlet n = [];\n\tfor (let r of e ?? []) n.some((e) => t(r, e)) || n.push(r);\n\treturn n;\n}\nfunction oe(...e) {\n\tlet t = Math.max(0, ...e.map((e) => e.length));\n\treturn Array.from({ length: t }, (t, n) => e.map((e) => e[n]));\n}\nvar se = {\n\tassign: o,\n\tchunk: s,\n\tclone: c,\n\tcloneDeep: l,\n\tcompact: u,\n\tconcat: d,\n\tdebounce: f,\n\tdefaults: p,\n\tdifference: m,\n\tdifferenceWith: h,\n\tevery: g,\n\tescape: ee,\n\tfind: _,\n\tfindKey: v,\n\tflatten: y,\n\tflatMap: te,\n\tforEach: b,\n\tget: x,\n\tgroupBy: S,\n\thead: C,\n\tincludes: T,\n\tinitial: w,\n\tintersection: E,\n\tisArray: D,\n\tisEmpty: O,\n\tisEqual: A,\n\tisEqualWith: j,\n\tisFinite: M,\n\tisFunction: N,\n\tisNumber: P,\n\tisObject: F,\n\tisString: I,\n\tisUndefined: L,\n\tmap: R,\n\tmax: z,\n\tmerge: B,\n\tomit: V,\n\tomitBy: H,\n\tpick: U,\n\trange: W,\n\trangeRight: G,\n\treduce: K,\n\tremove: q,\n\tset: J,\n\tshuffle: Y,\n\ttail: X,\n\ttakeRight: Z,\n\tthrottle: Q,\n\ttimes: ne,\n\tuniqueId: ie,\n\tuniq: $,\n\tuniqWith: ae,\n\tzip: oe\n};\n//#endregion\nexport { o as assign, s as chunk, c as clone, l as cloneDeep, u as compact, d as concat, f as debounce, se as default, p as defaults, m as difference, h as differenceWith, ee as escape, g as every, _ as find, v as findKey, te as flatMap, y as flatten, b as forEach, x as get, S as groupBy, C as head, T as includes, w as initial, E as intersection, D as isArray, O as isEmpty, A as isEqual, j as isEqualWith, M as isFinite, N as isFunction, P as isNumber, F as isObject, I as isString, L as isUndefined, R as map, z as max, B as merge, V as omit, H as omitBy, U as pick, W as range, G as rangeRight, K as reduce, q as remove, J as set, Y as shuffle, X as tail, Z as takeRight, Q as throttle, ne as times, $ as uniq, ae as uniqWith, ie as uniqueId, oe as zip };\n"],"mappings":";AACA,IAAI,IAAI,OAAO;AACf,SAAS,EAAE,GAAG;CACb,OAAO,OAAO,KAAK,YAAY,CAAC,CAAC;AAClC;AACA,SAAS,EAAE,GAAG;CACb,OAAO,MAAM,QAAQ,CAAC,IAAI,IAAI,OAAO,KAAK,WAAW,CAAC,CAAC,IAAI,EAAE,QAAQ,cAAc,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,OAAO,OAAO;AACpH;AACA,SAAS,EAAE,GAAG;CACb,QAAQ,MAAM,EAAE,GAAG,CAAC;AACrB;AACA,SAAS,EAAE,GAAG;CACb,QAAQ,MAAM,EAAE,CAAC,IAAI,OAAO,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,OAAO,EAAE,EAAE,IAAI,CAAC,CAAC,IAAI,CAAC;AACzE;AACA,SAAS,EAAE,GAAG;CACb,OAAO,OAAO,KAAK,aAAa,IAAI,OAAO,KAAK,WAAW,EA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AC,IAAI,CAAC,GAAG,IAAI,EAAE;CAC3E,CAAC,GAAG;AACL;AAsBA,SAAS,EAAG,GAAG,GAAG;CACjB,IAAI,IAAI,OAAO,MAAM;CACrB,OAAO,MAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,CAAC,CAAC;AAC7D;AAaA,SAAS,EAAG,GAAG,GAAG;CACjB,IAAI,IAAI,KAAK,IAAI,GAAG,GAAG,EAAE,KAAK,MAAM,EAAE,MAAM,CAAC;CAC7C,OAAO,MAAM,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM,EAAE,KAAK,MAAM,EAAE,EAAE,CAAC;AAC9D"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as __pieBrowserCjsReactRequire from "react";
|
|
2
|
+
const __pieBrowserCjsRequire = (specifier) => {
|
|
3
|
+
switch (specifier) {
|
|
4
|
+
case "react": return __pieBrowserCjsReactRequire;
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
default:
|
|
10
|
+
throw new Error(`Unsupported browser CJS require: ${specifier}`);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
//#region \0rolldown/runtime.js
|
|
14
|
+
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
|
|
15
|
+
let r = {};
|
|
16
|
+
for (var i in e) t(r, i, {
|
|
17
|
+
get: e[i],
|
|
18
|
+
enumerable: !0
|
|
19
|
+
});
|
|
20
|
+
return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
21
|
+
}, c = (e, i, o, s) => {
|
|
22
|
+
if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
|
|
23
|
+
get: ((e) => i[e]).bind(null, d),
|
|
24
|
+
enumerable: !(s = n(i, d)) || s.enumerable
|
|
25
|
+
});
|
|
26
|
+
return e;
|
|
27
|
+
}, l = (e, t, n) => (c(e, t, "default"), n && c(n, t, "default")), u = (n, r, a) => (a = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule ? t(a, "default", {
|
|
28
|
+
value: n,
|
|
29
|
+
enumerable: !0
|
|
30
|
+
}) : a, n)), d = __pieBrowserCjsRequire;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { u as a, d as i, s as n, l as r, o as t };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as __pieBrowserCjsReactRequire from "react";
|
|
2
|
+
const __pieBrowserCjsRequire = (specifier) => {
|
|
3
|
+
switch (specifier) {
|
|
4
|
+
case "react": return __pieBrowserCjsReactRequire;
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
default:
|
|
10
|
+
throw new Error(`Unsupported browser CJS require: ${specifier}`);
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
//#region \0rolldown/runtime.js
|
|
14
|
+
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, n) => {
|
|
15
|
+
let r = {};
|
|
16
|
+
for (var i in e) t(r, i, {
|
|
17
|
+
get: e[i],
|
|
18
|
+
enumerable: !0
|
|
19
|
+
});
|
|
20
|
+
return n || t(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
21
|
+
}, c = (e, i, o, s) => {
|
|
22
|
+
if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
|
|
23
|
+
get: ((e) => i[e]).bind(null, d),
|
|
24
|
+
enumerable: !(s = n(i, d)) || s.enumerable
|
|
25
|
+
});
|
|
26
|
+
return e;
|
|
27
|
+
}, l = (n, r, a) => (a = n == null ? {} : e(i(n)), c(r || !n || !n.__esModule ? t(a, "default", {
|
|
28
|
+
value: n,
|
|
29
|
+
enumerable: !0
|
|
30
|
+
}) : a, n)), u = __pieBrowserCjsRequire;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { l as i, s as n, u as r, o as t };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/inline-dropdown/controller/src/defaults.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: {
|
|
10
|
+
alternateResponse: {};
|
|
11
|
+
choiceRationaleEnabled: boolean;
|
|
12
|
+
choices: {};
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
displayType: string;
|
|
15
|
+
markup: string;
|
|
16
|
+
mode: string;
|
|
17
|
+
prompt: string;
|
|
18
|
+
promptEnabled: boolean;
|
|
19
|
+
rationale: string;
|
|
20
|
+
rationaleEnabled: boolean;
|
|
21
|
+
shuffle: boolean;
|
|
22
|
+
studentInstructionsEnabled: boolean;
|
|
23
|
+
teacherInstructions: string;
|
|
24
|
+
teacherInstructionsEnabled: boolean;
|
|
25
|
+
toolbarEditorPosition: string;
|
|
26
|
+
};
|
|
27
|
+
export default _default;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//#region src/controller/defaults.ts
|
|
2
|
+
var e = {
|
|
3
|
+
alternateResponse: {},
|
|
4
|
+
choiceRationaleEnabled: !0,
|
|
5
|
+
choices: {},
|
|
6
|
+
disabled: !1,
|
|
7
|
+
displayType: "block",
|
|
8
|
+
markup: "",
|
|
9
|
+
mode: "gather",
|
|
10
|
+
prompt: "",
|
|
11
|
+
promptEnabled: !0,
|
|
12
|
+
rationale: "",
|
|
13
|
+
rationaleEnabled: !0,
|
|
14
|
+
shuffle: !0,
|
|
15
|
+
studentInstructionsEnabled: !0,
|
|
16
|
+
teacherInstructions: "",
|
|
17
|
+
teacherInstructionsEnabled: !0,
|
|
18
|
+
toolbarEditorPosition: "bottom"
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { e as default };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/inline-dropdown/controller/src/index.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
export declare const normalize: (question: any) => any;
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {*} question
|
|
13
|
+
* @param {*} session
|
|
14
|
+
* @param {*} env
|
|
15
|
+
* @param {*} updateSession - optional - a function that will set the properties passed into it on the session.
|
|
16
|
+
*/
|
|
17
|
+
export declare function model(question: any, session: any, env: any, updateSession: any): Promise<{
|
|
18
|
+
disabled: boolean;
|
|
19
|
+
mode: any;
|
|
20
|
+
prompt: any;
|
|
21
|
+
displayType: any;
|
|
22
|
+
markup: any;
|
|
23
|
+
choices: {};
|
|
24
|
+
feedback: {};
|
|
25
|
+
responseCorrect: boolean | undefined;
|
|
26
|
+
rationale: any;
|
|
27
|
+
teacherInstructions: any;
|
|
28
|
+
language: any;
|
|
29
|
+
extraCSSRules: any;
|
|
30
|
+
}>;
|
|
31
|
+
export declare const getScore: (config: any, session: any) => number;
|
|
32
|
+
/**
|
|
33
|
+
* Generates detailed trace log for scoring evaluation
|
|
34
|
+
* @param {Object} model - the question model
|
|
35
|
+
* @param {Object} session - the student session
|
|
36
|
+
* @param {Object} env - the environment
|
|
37
|
+
* @returns {Array} traceLog - array of trace messages
|
|
38
|
+
*/
|
|
39
|
+
export declare const getLogTrace: (model: any, session: any, env: any) => string[];
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* The score is partial by default for checkbox mode, allOrNothing for radio mode.
|
|
43
|
+
* To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring =
|
|
44
|
+
* false. the value in `env` will override the value in `model`.
|
|
45
|
+
* @param {Object} model - the main model
|
|
46
|
+
* @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)
|
|
47
|
+
* @param {*} session
|
|
48
|
+
* @param {Object} env
|
|
49
|
+
* @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides
|
|
50
|
+
* `model.partialScoring`.
|
|
51
|
+
*/
|
|
52
|
+
export declare function outcome(model: any, session: any, env?: {}): Promise<unknown>;
|
|
53
|
+
export declare const createCorrectResponseSession: (question: any, env: any) => Promise<unknown>;
|
|
54
|
+
export declare const validate: (model?: {}, config?: {}) => {};
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import e from "./defaults.js";
|
|
2
|
+
import { getAllCorrectResponses as t } from "./utils.js";
|
|
3
|
+
import { isEmpty as n, map as r, reduce as i } from "@pie-element/shared-lodash";
|
|
4
|
+
import { getShuffledChoices as a, lockChoices as o, partialScoring as s } from "@pie-element/shared-controller-utils";
|
|
5
|
+
//#region src/controller/index.ts
|
|
6
|
+
var c = (e) => e ? "correct" : "incorrect", l = (t) => ({
|
|
7
|
+
...e,
|
|
8
|
+
...t
|
|
9
|
+
});
|
|
10
|
+
async function u(e, s, u, f) {
|
|
11
|
+
let p = l(e), { value: m = {} } = s || {}, h = i(p.choices, (e, t, n) => (e[n] = r(t, (e) => e), e), {}), g = {};
|
|
12
|
+
if (u.mode === "evaluate") {
|
|
13
|
+
let e = t(p), n = Object.keys(e).length, r = 0;
|
|
14
|
+
for (let t = 0; t < n; t++) {
|
|
15
|
+
let a = i(e, (e, n, r) => {
|
|
16
|
+
let i = m && m[r] || "", a = n[t] || "", o = i && a && a === i;
|
|
17
|
+
return e.feedback[r] = c(o), o && (e.correctResponses += 1), e;
|
|
18
|
+
}, {
|
|
19
|
+
correctResponses: 0,
|
|
20
|
+
feedback: {}
|
|
21
|
+
});
|
|
22
|
+
if (a.correctResponses >= r && (r = a.correctResponses, g = a.feedback), a.correctResponses === n) break;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (!o(p, s, u)) {
|
|
26
|
+
let e = {}, t = Object.keys(h), r = (t) => (n, r, i) => new Promise((n) => {
|
|
27
|
+
e[t] = i.shuffledValues, n();
|
|
28
|
+
}), i;
|
|
29
|
+
for (i = 0; i < t.length; i++) {
|
|
30
|
+
let e = t[i], n = s?.shuffledValues?.[e];
|
|
31
|
+
h[e] = await a(h[e], { shuffledValues: Array.isArray(n) ? n : [] }, r(e), "value");
|
|
32
|
+
}
|
|
33
|
+
n(e) || s && f && typeof f == "function" && f(s.id, s.element, { shuffledValues: e }).catch((e) => {
|
|
34
|
+
console.error("update session failed", e);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
let _ = null, v = null, y = (Object.keys(h) || []).reduce((e, t) => (e[t] = (h[t] || []).map((e) => ({
|
|
38
|
+
...e,
|
|
39
|
+
rationale: null
|
|
40
|
+
})), e), {});
|
|
41
|
+
return u.role === "instructor" && (u.mode === "view" || u.mode === "evaluate") ? (v = p.rationaleEnabled ? p.rationale : null, _ = p.teacherInstructionsEnabled ? p.teacherInstructions : null, h = p.choiceRationaleEnabled ? p.choices : y) : (v = null, _ = null, h = y), {
|
|
42
|
+
disabled: u.mode !== "gather",
|
|
43
|
+
mode: u.mode,
|
|
44
|
+
prompt: p.promptEnabled ? p.prompt : null,
|
|
45
|
+
displayType: p.displayType,
|
|
46
|
+
markup: p.markup,
|
|
47
|
+
choices: h,
|
|
48
|
+
feedback: g,
|
|
49
|
+
responseCorrect: u.mode === "evaluate" ? d(p, s) === 1 : void 0,
|
|
50
|
+
rationale: v,
|
|
51
|
+
teacherInstructions: _,
|
|
52
|
+
language: p.language,
|
|
53
|
+
extraCSSRules: p.extraCSSRules
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
var d = (e, n) => {
|
|
57
|
+
let { value: r = {} } = n || {}, a = e && e.choices ? Object.keys(e.choices).length : 0, o = t(e), s = 0;
|
|
58
|
+
for (let e = 0; e < a; e++) {
|
|
59
|
+
let t = i(o, (t, n, i) => {
|
|
60
|
+
let a = r && r[i] || "", o = n[e] || "";
|
|
61
|
+
return o && a && o === a ? t : t - 1;
|
|
62
|
+
}, a);
|
|
63
|
+
if (t > s && (s = t), t === a) break;
|
|
64
|
+
}
|
|
65
|
+
let c = (s / a).toFixed(2);
|
|
66
|
+
return parseFloat(c);
|
|
67
|
+
}, f = (e, n, r) => {
|
|
68
|
+
let i = [], { value: a = {} } = n || {}, o = t(e), c = Object.keys(o), l = c.length;
|
|
69
|
+
if (i.push(`${l} dropdown response area(s) defined in this question.`), a && Object.keys(a).length > 0) {
|
|
70
|
+
let e = Object.entries(a).filter(([e, t]) => t && t.trim()).length;
|
|
71
|
+
i.push(`Student selected options in ${e} out of ${l} dropdown(s).`), c.forEach((e) => {
|
|
72
|
+
let t = a && a[e] || "", n = o[e] || [];
|
|
73
|
+
t.trim() ? i.push(`Dropdown ${parseInt(e) + 1}: student selected '${t}' (correct options: [${n.map((e) => `'${e}'`).join(", ")}]).`) : i.push(`Dropdown ${parseInt(e) + 1}: no selection made (correct options: [${n.map((e) => `'${e}'`).join(", ")}]).`);
|
|
74
|
+
});
|
|
75
|
+
} else i.push("Student did not make any selections in the dropdowns.");
|
|
76
|
+
let u = s.enabled(e, r);
|
|
77
|
+
i.push(`Scoring method: ${u ? "partial scoring" : "all-or-nothing scoring"}.`);
|
|
78
|
+
let f = d(e, n);
|
|
79
|
+
return i.push(`Final score: ${f}.`), i;
|
|
80
|
+
};
|
|
81
|
+
function p(e, t, r = {}) {
|
|
82
|
+
return new Promise((i) => {
|
|
83
|
+
if (!t || n(t)) i({
|
|
84
|
+
score: 0,
|
|
85
|
+
empty: !0,
|
|
86
|
+
traceLog: ["Student did not make any selections in the dropdowns. Score is 0."]
|
|
87
|
+
});
|
|
88
|
+
else {
|
|
89
|
+
let n = f(e, t, r), a = d(e, t);
|
|
90
|
+
i({
|
|
91
|
+
score: s.enabled(e, r) ? a : Math.floor(a),
|
|
92
|
+
empty: !1,
|
|
93
|
+
traceLog: n
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
var m = (e, t) => new Promise((n) => {
|
|
99
|
+
if (t.mode !== "evaluate" && t.role === "instructor") {
|
|
100
|
+
let { choices: t } = e, r = {};
|
|
101
|
+
t && Object.keys(t).forEach((e, n) => {
|
|
102
|
+
let i = t[e] && t[e].filter((e) => e.correct);
|
|
103
|
+
r[n] = i && i[0].value;
|
|
104
|
+
}), n({
|
|
105
|
+
id: "1",
|
|
106
|
+
value: r
|
|
107
|
+
});
|
|
108
|
+
} else n(null);
|
|
109
|
+
}), h = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), g = (e = {}, t = {}) => {
|
|
110
|
+
let { markup: n, choices: r } = e, { maxResponseAreas: i, maxResponseAreaChoices: a } = t, o = {};
|
|
111
|
+
[
|
|
112
|
+
"teacherInstructions",
|
|
113
|
+
"prompt",
|
|
114
|
+
"rationale"
|
|
115
|
+
].forEach((n) => {
|
|
116
|
+
t[n]?.required && !h(e[n]) && (o[n] = "This field is required.");
|
|
117
|
+
});
|
|
118
|
+
let s = ((n || "").match(/\{\{(\d+)\}\}/g) || []).length;
|
|
119
|
+
return s > i ? o.responseAreasError = `No more than ${i} response areas should be defined.` : s < 1 && (o.responseAreasError = "There should be defined at least 1 response area."), (Object.keys(r) || []).forEach((e) => {
|
|
120
|
+
r[e] && r[e].length > a && (o.responseAreaChoicesError = `No more than ${a} choices per response area should be defined.`);
|
|
121
|
+
}), o;
|
|
122
|
+
};
|
|
123
|
+
//#endregion
|
|
124
|
+
export { m as createCorrectResponseSession, f as getLogTrace, d as getScore, u as model, l as normalize, p as outcome, g as validate };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/inline-dropdown/controller/src/utils.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
export declare const getAllCorrectResponses: ({ choices, alternateResponse }: {
|
|
10
|
+
choices: any;
|
|
11
|
+
alternateResponse: any;
|
|
12
|
+
}) => {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { forEach as e } from "@pie-element/shared-lodash";
|
|
2
|
+
//#region src/controller/utils.ts
|
|
3
|
+
var t = ({ choices: t, alternateResponse: n }) => {
|
|
4
|
+
n ||= {};
|
|
5
|
+
let r = {};
|
|
6
|
+
return e(t, (e, t) => {
|
|
7
|
+
r[t] || (r[t] = []), e && e.forEach((e) => {
|
|
8
|
+
e.correct && (r[t].push(e.value), n[t] && (r[t] = [...r[t], ...n[t]]));
|
|
9
|
+
});
|
|
10
|
+
}), r;
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { t as getAllCorrectResponses };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/inline-dropdown/src/index.js
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
export default class RootInlineDropdown extends HTMLElement {
|
|
10
|
+
constructor();
|
|
11
|
+
set model(m: any);
|
|
12
|
+
set session(s: any);
|
|
13
|
+
get session(): any;
|
|
14
|
+
setLangAttribute(): void;
|
|
15
|
+
_render: any;
|
|
16
|
+
dispatchChangedEvent: any;
|
|
17
|
+
changeSession: any;
|
|
18
|
+
connectedCallback(): void;
|
|
19
|
+
disconnectedCallback(): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { InlineDropdown as e } from "./inline-dropdown.js";
|
|
2
|
+
import t from "react";
|
|
3
|
+
import { createRoot as n } from "react-dom/client";
|
|
4
|
+
import { ModelSetEvent as r, SessionChangedEvent as i } from "@pie-element/shared-player-events";
|
|
5
|
+
import { renderMath as a } from "@pie-element/shared-math-rendering-mathjax";
|
|
6
|
+
//#region src/delivery/index.ts
|
|
7
|
+
var o = class extends HTMLElement {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(), this._model = null, this._session = null, this._root = null;
|
|
10
|
+
}
|
|
11
|
+
set model(e) {
|
|
12
|
+
this._model = e, this.dispatchEvent(new r(this.tagName.toLowerCase(), this.session && !!this.session.value, !!this._model)), this._render();
|
|
13
|
+
}
|
|
14
|
+
set session(e) {
|
|
15
|
+
this._session = e, this._render();
|
|
16
|
+
}
|
|
17
|
+
get session() {
|
|
18
|
+
return this._session;
|
|
19
|
+
}
|
|
20
|
+
setLangAttribute() {
|
|
21
|
+
let e = this._model && typeof this._model.language ? this._model.language : "", t = e ? e.slice(0, 2) : "en";
|
|
22
|
+
this.setAttribute("lang", t);
|
|
23
|
+
}
|
|
24
|
+
_render = () => {
|
|
25
|
+
if (this._model && this._session) {
|
|
26
|
+
let r = t.createElement(e, {
|
|
27
|
+
model: this._model,
|
|
28
|
+
prompt: this._model.prompt,
|
|
29
|
+
rationale: this._model.rationale,
|
|
30
|
+
teacherInstructions: this._model.teacherInstructions,
|
|
31
|
+
disabled: this._model.disabled,
|
|
32
|
+
displayType: this._model.displayType,
|
|
33
|
+
markup: this._model.markup,
|
|
34
|
+
mode: this._model.mode,
|
|
35
|
+
choices: this._model.choices,
|
|
36
|
+
value: this._session.value,
|
|
37
|
+
feedback: this._model.feedback,
|
|
38
|
+
language: this._model.language,
|
|
39
|
+
onChange: this.changeSession
|
|
40
|
+
});
|
|
41
|
+
this.setLangAttribute(), this._root ||= n(this), this._root.render(r), queueMicrotask(() => {
|
|
42
|
+
a(this);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
dispatchChangedEvent = () => {
|
|
47
|
+
this.dispatchEvent(new i(this.tagName.toLowerCase(), this.session && !!this.session.value));
|
|
48
|
+
};
|
|
49
|
+
changeSession = (e) => {
|
|
50
|
+
this.session.value = e, this.dispatchChangedEvent(), this._render();
|
|
51
|
+
};
|
|
52
|
+
connectedCallback() {
|
|
53
|
+
this.setAttribute("aria-label", "Inline Dropdown Question"), this.setAttribute("role", "region"), this._render();
|
|
54
|
+
}
|
|
55
|
+
disconnectedCallback() {
|
|
56
|
+
this._root &&= (this._root.unmount(), null);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
//#endregion
|
|
60
|
+
export { o as default };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/inline-dropdown/src/inline-dropdown.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*
|
|
5
|
+
* This file is automatically synced from pie-elements and converted to TypeScript.
|
|
6
|
+
* Manual edits will be overwritten on next sync.
|
|
7
|
+
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
|
+
*/
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
export declare class InlineDropdown extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
prompt: PropTypes.Requireable<string>;
|
|
14
|
+
disabled: PropTypes.Requireable<boolean>;
|
|
15
|
+
markup: PropTypes.Requireable<string>;
|
|
16
|
+
mode: PropTypes.Requireable<string>;
|
|
17
|
+
displayType: PropTypes.Requireable<string>;
|
|
18
|
+
rationale: PropTypes.Requireable<string>;
|
|
19
|
+
teacherInstructions: PropTypes.Requireable<string>;
|
|
20
|
+
model: PropTypes.Validator<object>;
|
|
21
|
+
choices: PropTypes.Requireable<object>;
|
|
22
|
+
value: PropTypes.Requireable<object>;
|
|
23
|
+
feedback: PropTypes.Requireable<object>;
|
|
24
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
25
|
+
language: PropTypes.Requireable<string>;
|
|
26
|
+
};
|
|
27
|
+
static defaultProps: {
|
|
28
|
+
value: {};
|
|
29
|
+
};
|
|
30
|
+
state: {
|
|
31
|
+
showCorrectAnswer: boolean;
|
|
32
|
+
};
|
|
33
|
+
UNSAFE_componentWillReceiveProps(nextProps: any): void;
|
|
34
|
+
componentDidUpdate(): void;
|
|
35
|
+
toggleShowCorrect: any;
|
|
36
|
+
render(): React.JSX.Element;
|
|
37
|
+
}
|
|
38
|
+
export default InlineDropdown;
|