@pie-element/fraction-model 6.4.0-beta.7 → 7.0.0-next.20261002094057
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/card-bar.d.ts +20 -0
- package/dist/author/card-bar.js +40 -0
- package/dist/author/defaults.d.ts +113 -0
- package/dist/author/defaults.js +84 -0
- package/dist/author/index.d.ts +44 -0
- package/dist/author/index.js +88 -0
- package/dist/author/main.d.ts +25 -0
- package/dist/author/main.js +156 -0
- package/dist/author/model-options.d.ts +32 -0
- package/dist/author/model-options.js +85 -0
- package/dist/author/number-text-field.d.ts +15 -0
- package/dist/author/number-text-field.js +24 -0
- package/dist/browser/assets/Symbola-4c507403.woff2 +0 -0
- package/dist/browser/author/index.js +32067 -0
- package/dist/browser/author/index.js.map +1 -0
- package/dist/browser/controller/index.js +78 -0
- package/dist/browser/controller/index.js.map +1 -0
- package/dist/browser/delivery/index.js +2 -0
- package/dist/browser/delivery-YkUEYrjh.js +28389 -0
- package/dist/browser/delivery-YkUEYrjh.js.map +1 -0
- package/dist/browser/dist-ClmZaEGT.js +89 -0
- package/dist/browser/dist-ClmZaEGT.js.map +1 -0
- package/dist/browser/editor-runtime/assets/Symbola-4c507403.woff2 +0 -0
- package/dist/browser/editor-runtime/author/index.js +15658 -0
- package/dist/browser/editor-runtime/author/index.js.map +1 -0
- package/dist/browser/editor-runtime/controller/index.js +78 -0
- package/dist/browser/editor-runtime/controller/index.js.map +1 -0
- package/dist/browser/editor-runtime/delivery/index.js +2 -0
- package/dist/browser/editor-runtime/delivery-TTEE8mhy.js +28389 -0
- package/dist/browser/editor-runtime/delivery-TTEE8mhy.js.map +1 -0
- package/dist/browser/editor-runtime/dist-ClmZaEGT.js +89 -0
- package/dist/browser/editor-runtime/dist-ClmZaEGT.js.map +1 -0
- package/dist/controller/defaults.d.ts +21 -0
- package/dist/controller/defaults.js +13 -0
- package/dist/controller/index.d.ts +23 -0
- package/dist/controller/index.js +68 -0
- package/dist/delivery/answer-fraction.d.ts +27 -0
- package/dist/delivery/answer-fraction.js +69 -0
- package/dist/delivery/fraction-model-chart.d.ts +11 -0
- package/dist/delivery/fraction-model-chart.js +154 -0
- package/dist/delivery/index.d.ts +22 -0
- package/dist/delivery/index.js +54 -0
- package/dist/delivery/main.d.ts +38 -0
- package/dist/delivery/main.js +136 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.iife.d.ts +8 -0
- package/dist/index.iife.js +196 -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 +92 -21
- package/CHANGELOG.json +0 -1
- package/CHANGELOG.md +0 -637
- package/LICENSE.md +0 -5
- package/README.md +0 -18
- package/configure/CHANGELOG.json +0 -1
- package/configure/CHANGELOG.md +0 -602
- package/configure/lib/card-bar.js +0 -57
- package/configure/lib/card-bar.js.map +0 -1
- package/configure/lib/defaults.js +0 -114
- package/configure/lib/defaults.js.map +0 -1
- package/configure/lib/index.js +0 -164
- package/configure/lib/index.js.map +0 -1
- package/configure/lib/main.js +0 -253
- package/configure/lib/main.js.map +0 -1
- package/configure/lib/model-options.js +0 -144
- package/configure/lib/model-options.js.map +0 -1
- package/configure/lib/number-text-field.js +0 -47
- package/configure/lib/number-text-field.js.map +0 -1
- package/configure/package.json +0 -24
- package/controller/CHANGELOG.json +0 -1
- package/controller/CHANGELOG.md +0 -523
- package/controller/lib/defaults.js +0 -20
- package/controller/lib/defaults.js.map +0 -1
- package/controller/lib/index.js +0 -215
- package/controller/lib/index.js.map +0 -1
- package/controller/package.json +0 -15
- package/docs/config-schema.json +0 -1796
- package/docs/config-schema.json.md +0 -1318
- package/docs/demo/config.js +0 -8
- package/docs/demo/generate.js +0 -6
- package/docs/demo/index.html +0 -1
- package/docs/demo/session.js +0 -6
- package/docs/pie-schema.json +0 -873
- package/docs/pie-schema.json.md +0 -639
- package/lib/answer-fraction.js +0 -109
- package/lib/answer-fraction.js.map +0 -1
- package/lib/fraction-model-chart.js +0 -279
- package/lib/fraction-model-chart.js.map +0 -1
- package/lib/index.js +0 -92
- package/lib/index.js.map +0 -1
- package/lib/main.js +0 -203
- package/lib/main.js.map +0 -1
|
@@ -0,0 +1,89 @@
|
|
|
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
|
+
if (!t(e)) return e;
|
|
11
|
+
if (e instanceof Date) return new Date(e.getTime());
|
|
12
|
+
if (Array.isArray(e)) return e.map((e) => r(e));
|
|
13
|
+
let n = {};
|
|
14
|
+
for (let [t, i] of Object.entries(e)) n[t] = r(i);
|
|
15
|
+
return n;
|
|
16
|
+
}
|
|
17
|
+
function i(e) {
|
|
18
|
+
return (e ?? []).filter(Boolean);
|
|
19
|
+
}
|
|
20
|
+
function a(e, t = 0, n = {}) {
|
|
21
|
+
let r, i, a, o, s, c = n.leading === !0, l = n.trailing !== !1, u = () => {
|
|
22
|
+
if (!a) return s;
|
|
23
|
+
let t = a, n = o;
|
|
24
|
+
return a = void 0, o = void 0, s = e.apply(n, t), s;
|
|
25
|
+
}, d = () => {
|
|
26
|
+
r && clearTimeout(r), i && clearTimeout(i), r = void 0, i = void 0, a = void 0, o = void 0;
|
|
27
|
+
}, f = function(...e) {
|
|
28
|
+
let d = c && !r;
|
|
29
|
+
return a = e, o = this, d && u(), r && clearTimeout(r), r = setTimeout(() => {
|
|
30
|
+
r = void 0, i &&= (clearTimeout(i), void 0), l ? u() : (a = void 0, o = void 0);
|
|
31
|
+
}, t), n.maxWait !== void 0 && !i && (i = setTimeout(() => {
|
|
32
|
+
r && clearTimeout(r), r = void 0, i = void 0, l || !c ? u() : (a = void 0, o = void 0);
|
|
33
|
+
}, n.maxWait)), s;
|
|
34
|
+
};
|
|
35
|
+
return f.cancel = d, f.flush = () => (r &&= (clearTimeout(r), void 0), i &&= (clearTimeout(i), void 0), u()), f;
|
|
36
|
+
}
|
|
37
|
+
function o(e) {
|
|
38
|
+
let t = [];
|
|
39
|
+
for (let n of e ?? []) Array.isArray(n) ? t.push(...n) : t.push(n);
|
|
40
|
+
return t;
|
|
41
|
+
}
|
|
42
|
+
function s(e, t, r) {
|
|
43
|
+
if (!Array.isArray(t) && e != null && Object.prototype.hasOwnProperty.call(Object(e), t)) {
|
|
44
|
+
let n = e[t];
|
|
45
|
+
return n === void 0 ? r : n;
|
|
46
|
+
}
|
|
47
|
+
let i = e;
|
|
48
|
+
for (let e of n(t)) {
|
|
49
|
+
if (i == null) return r;
|
|
50
|
+
i = i[e];
|
|
51
|
+
}
|
|
52
|
+
return i === void 0 ? r : i;
|
|
53
|
+
}
|
|
54
|
+
function c(e) {
|
|
55
|
+
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;
|
|
56
|
+
}
|
|
57
|
+
function l(n, r, i) {
|
|
58
|
+
let a = i?.(n, r);
|
|
59
|
+
if (a !== void 0) return !!a;
|
|
60
|
+
if (Object.is(n, r)) return !0;
|
|
61
|
+
if (!t(n) || !t(r)) return !1;
|
|
62
|
+
if (n instanceof Date || r instanceof Date) return n instanceof Date && r instanceof Date && n.getTime() === r.getTime();
|
|
63
|
+
if (Array.isArray(n) || Array.isArray(r)) return Array.isArray(n) && Array.isArray(r) && n.length === r.length && n.every((e, t) => l(e, r[t], i));
|
|
64
|
+
let o = Object.keys(n), s = Object.keys(r);
|
|
65
|
+
return o.length === s.length && o.every((t) => e.hasOwnProperty.call(r, t) && l(n[t], r[t], i));
|
|
66
|
+
}
|
|
67
|
+
function u(e, t) {
|
|
68
|
+
return l(e, t);
|
|
69
|
+
}
|
|
70
|
+
function d(e) {
|
|
71
|
+
return Number.isFinite(e);
|
|
72
|
+
}
|
|
73
|
+
function f(e, t) {
|
|
74
|
+
let n = { ...e ?? {} };
|
|
75
|
+
for (let e of Array.isArray(t) ? t : [t]) delete n[e];
|
|
76
|
+
return n;
|
|
77
|
+
}
|
|
78
|
+
function p(e, t) {
|
|
79
|
+
let n = t ?? ((e) => e);
|
|
80
|
+
return Array.from({ length: Math.max(0, e) }, (e, t) => n(t));
|
|
81
|
+
}
|
|
82
|
+
function m(...e) {
|
|
83
|
+
let t = Math.max(0, ...e.map((e) => e.length));
|
|
84
|
+
return Array.from({ length: t }, (t, n) => e.map((e) => e[n]));
|
|
85
|
+
}
|
|
86
|
+
//#endregion
|
|
87
|
+
export { a, m as c, o as d, f as i, i as l, d as n, r as o, c as r, p as s, u as t, s as u };
|
|
88
|
+
|
|
89
|
+
//# sourceMappingURL=dist-ClmZaEGT.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dist-ClmZaEGT.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;AAsBA,SAAS,EAAE,GAAG;CACb,IAAI,CAAC,EAAE,CAAC,GAAG,OAAO;CAClB,IAAI,aAAa,MAAM,OAAO,IAAI,KAAK,EAAE,QAAQ,CAAC;CAClD,IAAI,MAAM,QAAQ,CAAC,GAAG,OAAO,EAAE,KAAK,MAAM,EAAE,CAAC,CAAC;CAC9C,IAAI,IAAI,CAAC;CACT,KAAK,IAAI,CAAC,GAAG,MAAM,OAAO,QAAQ,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC;CAChD,OAAO;AACR;AACA,SAAS,EAAE,GAAG;CACb,QAAQ,KAAK,CAAC,EAAA,CAAG,OAAO,OAAO;AAChC;AAMA,SAAS,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG;CAC5B,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,IAAI,EAAE,YAAY,CAAC,GAAG,IAAI,EAAE,aAAa,CAAC,GAAG,UAAU;EACzE,IAAI,CAAC,GAAG,OAAO;EACf,IAAI,IAAI,GAAG,IAAI;EACf,OAAO,IAAI,KAAK,GAAG,IAAI,KAAK,GAAG,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG;CACnD,GAAG,UAAU;EACZ,KAAK,aAAa,CAAC,GAAG,KAAK,aAAa,CAAC,GAAG,IAAI,KAAK,GAAG,IAAI,KAAK,GAAG,IAAI,KAAK,GAAG,IAAI,KAAK;CAC1F,GAAG,IAAI,SAAS,GAAG,GAAG;EACrB,IAAI,IAAI,KAAK,CAAC;EACd,OAAO,IAAI,GAAG,IAAI,MAAM,KAAK,EAAE,GAAG,KAAK,aAAa,CAAC,GAAG,IAAI,iBAAiB;GAC5E,IAAI,KAAK,GAAG,OAAO,aAAa,CAAC,GAAG,KAAK,IAAI,IAAI,EAAE,KAAK,IAAI,KAAK,GAAG,IAAI,KAAK;EAC9E,GAAG,CAAC,GAAG,EAAE,YAAY,KAAK,KAAK,CAAC,MAAM,IAAI,iBAAiB;GAC1D,KAAK,aAAa,CAAC,GAAG,IAAI,KAAK,GAAG,IAAI,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,KAAK,IAAI,KAAK,GAAG,IAAI,KAAK;EACrF,GAAG,EAAE,OAAO,IAAI;CACjB;CACA,OAAO,EAAE,SAAS,GAAG,EAAE,eAAe,OAAO,aAAa,CAAC,GAAG,KAAK,IAAI,OAAO,aAAa,CAAC,GAAG,KAAK,IAAI,EAAE,IAAI;AAC/G;AA4BA,SAAS,EAAE,GAAG;CACb,IAAI,IAAI,CAAC;CACT,KAAK,IAAI,KAAK,KAAK,CAAC,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC;CACjE,OAAO;AACR;AASA,SAAS,EAAE,GAAG,GAAG,GAAG;CACnB,IAAI,CAAC,MAAM,QAAQ,CAAC,KAAK,KAAK,QAAQ,OAAO,UAAU,eAAe,KAAK,OAAO,CAAC,GAAG,CAAC,GAAG;EACzF,IAAI,IAAI,EAAE;EACV,OAAO,MAAM,KAAK,IAAI,IAAI;CAC3B;CACA,IAAI,IAAI;CACR,KAAK,IAAI,KAAK,EAAE,CAAC,GAAG;EACnB,IAAI,KAAK,MAAM,OAAO;EACtB,IAAI,EAAE;CACP;CACA,OAAO,MAAM,KAAK,IAAI,IAAI;AAC3B;AAwBA,SAAS,EAAE,GAAG;CACb,OAAO,KAAK,OAAO,CAAC,IAAI,OAAO,KAAK,YAAY,MAAM,QAAQ,CAAC,IAAI,EAAE,WAAW,IAAI,aAAa,OAAO,aAAa,MAAM,EAAE,SAAS,IAAI,CAAC,EAAE,CAAC,KAAK,OAAO,KAAK,CAAC,CAAC,CAAC,WAAW;AAC9K;AACA,SAAS,EAAE,GAAG,GAAG,GAAG;CACnB,IAAI,IAAI,IAAI,GAAG,CAAC;CAChB,IAAI,MAAM,KAAK,GAAG,OAAO,CAAC,CAAC;CAC3B,IAAI,OAAO,GAAG,GAAG,CAAC,GAAG,OAAO,CAAC;CAC7B,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC;CAC5B,IAAI,aAAa,QAAQ,aAAa,MAAM,OAAO,aAAa,QAAQ,aAAa,QAAQ,EAAE,QAAQ,MAAM,EAAE,QAAQ;CACvH,IAAI,MAAM,QAAQ,CAAC,KAAK,MAAM,QAAQ,CAAC,GAAG,OAAO,MAAM,QAAQ,CAAC,KAAK,MAAM,QAAQ,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;CACjJ,IAAI,IAAI,OAAO,KAAK,CAAC,GAAG,IAAI,OAAO,KAAK,CAAC;CACzC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,MAAM,EAAE,eAAe,KAAK,GAAG,CAAC,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC/F;AACA,SAAS,EAAE,GAAG,GAAG;CAChB,OAAO,EAAE,GAAG,CAAC;AACd;AAIA,SAAS,EAAE,GAAG;CACb,OAAO,OAAO,SAAS,CAAC;AACzB;AA4BA,SAAS,EAAE,GAAG,GAAG;CAChB,IAAI,IAAI,EAAE,GAAG,KAAK,CAAC,EAAE;CACrB,KAAK,IAAI,KAAK,MAAM,QAAQ,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE;CACnD,OAAO;AACR;AA+DA,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,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/fraction-model/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
|
+
model: {
|
|
11
|
+
correctResponse: never[];
|
|
12
|
+
title: string;
|
|
13
|
+
prompt: string;
|
|
14
|
+
modelTypeSelected: string;
|
|
15
|
+
maxModelSelected: number;
|
|
16
|
+
partsPerModel: number;
|
|
17
|
+
allowedStudentConfig: boolean;
|
|
18
|
+
showGraphLabels: boolean;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export default _default;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/controller/defaults.ts
|
|
2
|
+
var e = { model: {
|
|
3
|
+
correctResponse: [],
|
|
4
|
+
title: "",
|
|
5
|
+
prompt: "",
|
|
6
|
+
modelTypeSelected: "bar",
|
|
7
|
+
maxModelSelected: 1,
|
|
8
|
+
partsPerModel: 5,
|
|
9
|
+
allowedStudentConfig: !1,
|
|
10
|
+
showGraphLabels: !1
|
|
11
|
+
} };
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as default };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/fraction-model/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 getResponseCorrectness: (model: any, answers: any, env?: {}) => "correct" | "incorrect";
|
|
10
|
+
export declare const outcome: (model: any, session: any, env: any) => Promise<unknown>;
|
|
11
|
+
export declare const createDefaultModel: (model?: {}) => {
|
|
12
|
+
correctResponse: never[];
|
|
13
|
+
title: string;
|
|
14
|
+
prompt: string;
|
|
15
|
+
modelTypeSelected: string;
|
|
16
|
+
maxModelSelected: number;
|
|
17
|
+
partsPerModel: number;
|
|
18
|
+
allowedStudentConfig: boolean;
|
|
19
|
+
showGraphLabels: boolean;
|
|
20
|
+
};
|
|
21
|
+
export declare const model: (question: any, session: any, env: any) => Promise<unknown>;
|
|
22
|
+
export declare const createCorrectResponseSession: (model: any, env: any) => Promise<unknown>;
|
|
23
|
+
export declare const validate: (model?: {}, config?: {}) => {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import e from "./defaults.js";
|
|
2
|
+
import { isEmpty as t } from "@pie-element/shared-lodash";
|
|
3
|
+
//#region src/controller/index.ts
|
|
4
|
+
var n = (e, t, n = {}) => {
|
|
5
|
+
let r;
|
|
6
|
+
return r = e.allowedStudentConfig ? !!(t.partsPerModel === e.partsPerModel && c(t.response, e.partsPerModel) && s(e.correctResponse, t.response)) : !!(c(t.response, e.partsPerModel) && s(e.correctResponse, t.response)), r ? "correct" : "incorrect";
|
|
7
|
+
}, r = (e, t, r = {}) => {
|
|
8
|
+
if (t.mode === "evaluate") return n(e, r, t);
|
|
9
|
+
}, i = (e, t, n = {}) => +(r(e, t, n) === "correct"), a = (e) => !e || t(e) || !e.answers, o = (e, t, n) => new Promise((r) => {
|
|
10
|
+
a(t) ? r({
|
|
11
|
+
score: 0,
|
|
12
|
+
empty: !0
|
|
13
|
+
}) : n.mode === "evaluate" ? r({ score: i(e, n, t.answers) }) : r({
|
|
14
|
+
score: void 0,
|
|
15
|
+
completed: void 0
|
|
16
|
+
});
|
|
17
|
+
}), s = (e, t) => {
|
|
18
|
+
let n = 0, r = 0;
|
|
19
|
+
for (let t = 0; t < e.length; t++) n += e[t].value;
|
|
20
|
+
for (let e = 0; e < t.length; e++) r += t[e].value;
|
|
21
|
+
return n === r;
|
|
22
|
+
}, c = (e, t) => {
|
|
23
|
+
if (e.length > 0) {
|
|
24
|
+
let n = 0;
|
|
25
|
+
return e.forEach((e) => {
|
|
26
|
+
e.value !== t && n++;
|
|
27
|
+
}), n <= 1;
|
|
28
|
+
} else return !1;
|
|
29
|
+
}, l = (t = {}) => ({
|
|
30
|
+
...e.model,
|
|
31
|
+
...t
|
|
32
|
+
}), u = (e, t, n) => new Promise((o) => {
|
|
33
|
+
t ||= {};
|
|
34
|
+
let s = l(e), c, u;
|
|
35
|
+
a(t) && n.mode === "evaluate" ? (c = "unanswered", u = "0%") : (c = r(s, n, t && t.answers), u = `${i(s, n, t && t.answers) * 100}%`);
|
|
36
|
+
let d = {
|
|
37
|
+
score: u,
|
|
38
|
+
correctness: c
|
|
39
|
+
}, f = {
|
|
40
|
+
env: n,
|
|
41
|
+
...s,
|
|
42
|
+
view: n.mode === "view" || n.mode === "evaluate"
|
|
43
|
+
};
|
|
44
|
+
n.mode === "evaluate" && Object.assign(f, { correctness: d }), o(f);
|
|
45
|
+
}), d = (e, t) => new Promise((n) => {
|
|
46
|
+
if (t.mode !== "evaluate" && t.role === "instructor") {
|
|
47
|
+
let { correctResponse: t, maxModelSelected: r, partsPerModel: i } = e;
|
|
48
|
+
n({
|
|
49
|
+
answers: {
|
|
50
|
+
response: t,
|
|
51
|
+
noOfModel: r,
|
|
52
|
+
partsPerModel: i
|
|
53
|
+
},
|
|
54
|
+
id: "1"
|
|
55
|
+
});
|
|
56
|
+
} else n(null);
|
|
57
|
+
}), f = (e = {}, t = {}) => {
|
|
58
|
+
let n = {};
|
|
59
|
+
if (e.correctResponse.length === 0 && (n.correctResponse = "To save the item, at least one section must be marked as correct."), e.correctResponse.length > 0) {
|
|
60
|
+
let t = 0;
|
|
61
|
+
e.correctResponse.forEach((n) => {
|
|
62
|
+
n.value !== e.partsPerModel && t++;
|
|
63
|
+
}), t > 1 && (n.correctResponse = "The correct answer should include no more than one partially-filled model");
|
|
64
|
+
}
|
|
65
|
+
return n;
|
|
66
|
+
};
|
|
67
|
+
//#endregion
|
|
68
|
+
export { d as createCorrectResponseSession, l as createDefaultModel, n as getResponseCorrectness, u as model, o as outcome, f as validate };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/fraction-model/src/answer-fraction.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 AnswerFraction extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
model: PropTypes.Validator<object>;
|
|
14
|
+
disabled: PropTypes.Validator<boolean>;
|
|
15
|
+
showCorrect: PropTypes.Validator<boolean>;
|
|
16
|
+
onAnswerChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
17
|
+
answers: PropTypes.Validator<object>;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Function to trigger when value change from number selection
|
|
21
|
+
* @param {string} key contains event change object
|
|
22
|
+
* @returns updated answer change object
|
|
23
|
+
*/
|
|
24
|
+
onValueChange: (key: any) => (event: any) => void;
|
|
25
|
+
render(): React.JSX.Element;
|
|
26
|
+
}
|
|
27
|
+
export default AnswerFraction;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import e from "react";
|
|
2
|
+
import t from "prop-types";
|
|
3
|
+
import { styled as n } from "@mui/material/styles";
|
|
4
|
+
import { TextField as r } from "@mui/material";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
//#region src/delivery/answer-fraction.tsx
|
|
7
|
+
var o = n("div")({
|
|
8
|
+
alignItems: "center",
|
|
9
|
+
display: "flex",
|
|
10
|
+
gap: "20px"
|
|
11
|
+
}), s = n("div")({ margin: "12px 0" }), c = n("label")({
|
|
12
|
+
display: "block",
|
|
13
|
+
marginBottom: "4px"
|
|
14
|
+
}), l = n(r)({
|
|
15
|
+
width: "120px",
|
|
16
|
+
maxHeight: "40px",
|
|
17
|
+
"& [class^=\"MuiInputBase-root\"]": {
|
|
18
|
+
height: 40,
|
|
19
|
+
fontSize: "14px"
|
|
20
|
+
}
|
|
21
|
+
}), u = class extends e.Component {
|
|
22
|
+
static propTypes = {
|
|
23
|
+
model: t.object.isRequired,
|
|
24
|
+
disabled: t.bool.isRequired,
|
|
25
|
+
showCorrect: t.bool.isRequired,
|
|
26
|
+
onAnswerChange: t.func.isRequired,
|
|
27
|
+
answers: t.object.isRequired
|
|
28
|
+
};
|
|
29
|
+
onValueChange = (e) => (t) => {
|
|
30
|
+
let n = parseInt(t?.target?.value), { model: r, onAnswerChange: i, answers: a } = this.props, o = { ...a }, s = e === "noOfModel" ? r.maxModelSelected : 9;
|
|
31
|
+
n > s ? n = s : n < 1 && (n = 1), o[e] = n, i(o);
|
|
32
|
+
};
|
|
33
|
+
render() {
|
|
34
|
+
let { model: e, showCorrect: t, answers: n, disabled: r } = this.props;
|
|
35
|
+
return /* @__PURE__ */ i("div", { children: e.allowedStudentConfig && /* @__PURE__ */ a(o, { children: [/* @__PURE__ */ a(s, { children: [/* @__PURE__ */ i(c, {
|
|
36
|
+
htmlFor: "preview_number-of-models",
|
|
37
|
+
children: "Number of Models"
|
|
38
|
+
}), /* @__PURE__ */ i(l, {
|
|
39
|
+
id: "preview_number-of-models",
|
|
40
|
+
inputProps: {
|
|
41
|
+
min: 1,
|
|
42
|
+
max: e.maxModelSelected
|
|
43
|
+
},
|
|
44
|
+
name: "preview_number-of-models",
|
|
45
|
+
onChange: this.onValueChange("noOfModel"),
|
|
46
|
+
type: "number",
|
|
47
|
+
variant: "outlined",
|
|
48
|
+
disabled: r,
|
|
49
|
+
value: t ? e.maxModelSelected : n.noOfModel
|
|
50
|
+
})] }), /* @__PURE__ */ a(s, { children: [/* @__PURE__ */ i(c, {
|
|
51
|
+
htmlFor: "preview_parts-per-model",
|
|
52
|
+
children: "Parts per Model"
|
|
53
|
+
}), /* @__PURE__ */ i(l, {
|
|
54
|
+
id: "preview_parts-per-model",
|
|
55
|
+
inputProps: {
|
|
56
|
+
min: 1,
|
|
57
|
+
max: 9
|
|
58
|
+
},
|
|
59
|
+
name: "preview_parts-per-model",
|
|
60
|
+
onChange: this.onValueChange("partsPerModel"),
|
|
61
|
+
type: "number",
|
|
62
|
+
variant: "outlined",
|
|
63
|
+
disabled: r,
|
|
64
|
+
value: t ? e.partsPerModel : n.partsPerModel
|
|
65
|
+
})] })] }) });
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { u as AnswerFraction, u as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/fraction-model/src/fraction-model-chart.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
|
+
declare const FractionModelChart: (props: any) => React.JSX.Element | undefined;
|
|
11
|
+
export default FractionModelChart;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { useEffect as e, useRef as t, useState as n } from "react";
|
|
2
|
+
import { styled as r } from "@mui/material/styles";
|
|
3
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
4
|
+
import { Bar as o, BarChart as s, Cell as c, LabelList as l, Pie as u, PieChart as d, YAxis as f } from "recharts";
|
|
5
|
+
//#region src/delivery/fraction-model-chart.tsx
|
|
6
|
+
var p = r("div")({
|
|
7
|
+
display: "grid",
|
|
8
|
+
gridTemplateColumns: "200px 200px 200px",
|
|
9
|
+
gap: "10px",
|
|
10
|
+
padding: "5px 0"
|
|
11
|
+
}), m = r("div")({
|
|
12
|
+
display: "grid",
|
|
13
|
+
gridTemplateColumns: "200px 200px 200px",
|
|
14
|
+
gap: "20px",
|
|
15
|
+
padding: "10px 0"
|
|
16
|
+
}), h = r(d)({ "& .recharts-pie-sector": {
|
|
17
|
+
outline: "none !important",
|
|
18
|
+
"&:focus": { outline: "none !important" }
|
|
19
|
+
} }), g = (r) => {
|
|
20
|
+
let d = (e, t) => {
|
|
21
|
+
typeof t == "string" && (t = parseInt(t));
|
|
22
|
+
let n = A.findIndex((t) => t.id === e), r;
|
|
23
|
+
r = n >= 0 ? A[n].value === t ? A.filter((e, t) => t !== n) : [
|
|
24
|
+
...A.slice(0, n),
|
|
25
|
+
{
|
|
26
|
+
id: e,
|
|
27
|
+
value: t
|
|
28
|
+
},
|
|
29
|
+
...A.slice(n + 1)
|
|
30
|
+
] : [...A, {
|
|
31
|
+
id: e,
|
|
32
|
+
value: t
|
|
33
|
+
}], D(r), j(r);
|
|
34
|
+
}, g = (e, t) => {
|
|
35
|
+
k(e + "-" + t);
|
|
36
|
+
}, _ = () => {
|
|
37
|
+
k(null);
|
|
38
|
+
}, v = (e, t) => {
|
|
39
|
+
let [n, r] = t.split("-").map(Number), i = A.find((e) => e.id === n);
|
|
40
|
+
if (i && r <= i.value) return "rgb(60, 73, 150, 0.6)";
|
|
41
|
+
if (e) {
|
|
42
|
+
let [t, i] = e.split("-").map(Number);
|
|
43
|
+
if (t === n && i >= r) return "rgb(0, 0, 0, 0.25)";
|
|
44
|
+
}
|
|
45
|
+
return "#FFFFFF";
|
|
46
|
+
}, y = (e) => {
|
|
47
|
+
let { cx: t, cy: n, midAngle: r, outerRadius: a, index: o } = e, s = Math.PI / 180, c = a * 1.13, l = t + c * Math.cos(-r * s);
|
|
48
|
+
return /* @__PURE__ */ i("text", {
|
|
49
|
+
x: l,
|
|
50
|
+
y: n + c * Math.sin(-r * s),
|
|
51
|
+
fill: "#000000",
|
|
52
|
+
textAnchor: l > t ? "start" : "end",
|
|
53
|
+
dominantBaseline: "central",
|
|
54
|
+
children: `${(o + 1).toFixed(0)}`
|
|
55
|
+
});
|
|
56
|
+
}, b = () => (e) => {
|
|
57
|
+
let { fill: t, x: n, y: r, width: a, height: o } = e;
|
|
58
|
+
return /* @__PURE__ */ i("g", { children: /* @__PURE__ */ i("rect", {
|
|
59
|
+
x: n,
|
|
60
|
+
y: r,
|
|
61
|
+
width: a,
|
|
62
|
+
height: o,
|
|
63
|
+
stroke: "#000000",
|
|
64
|
+
fill: t
|
|
65
|
+
}) });
|
|
66
|
+
}, { value: x = [], modelType: S = "bar", noOfModels: C = 0, partsPerModel: w = 0, showLabel: T = !1, disabled: E = !1, onChange: D } = r, [O, k] = n(null), [A, j] = n(x), M = () => {
|
|
67
|
+
let e = [];
|
|
68
|
+
for (let t = 1; t < C + 1; t++) {
|
|
69
|
+
let n = [{ name: t }];
|
|
70
|
+
for (let e = 1; e < w + 1; e++) n[0][`${e}`] = 1;
|
|
71
|
+
e.push(n);
|
|
72
|
+
}
|
|
73
|
+
let t = [];
|
|
74
|
+
return e.forEach((e, n) => {
|
|
75
|
+
t.push(/* @__PURE__ */ a(s, {
|
|
76
|
+
width: 200,
|
|
77
|
+
height: 30 * w,
|
|
78
|
+
data: e,
|
|
79
|
+
children: [/* @__PURE__ */ i(f, {
|
|
80
|
+
hide: !0,
|
|
81
|
+
type: "number",
|
|
82
|
+
domain: [0, w]
|
|
83
|
+
}), Object.keys(e[0]).map((e, t) => {
|
|
84
|
+
if (e !== "name") return /* @__PURE__ */ i(o, {
|
|
85
|
+
dataKey: e,
|
|
86
|
+
stackId: "a",
|
|
87
|
+
onClick: E ? null : () => d(n + 1, e),
|
|
88
|
+
onMouseEnter: E ? null : () => g(n + 1, e),
|
|
89
|
+
onMouseLeave: E ? null : () => _(n + 1, e),
|
|
90
|
+
shape: b(),
|
|
91
|
+
isAnimationActive: !1,
|
|
92
|
+
fill: v(O, `${n + 1}-${e}`),
|
|
93
|
+
children: T && /* @__PURE__ */ i(l, {
|
|
94
|
+
position: "left",
|
|
95
|
+
fill: "#000000"
|
|
96
|
+
})
|
|
97
|
+
}, `bar-${n + 1}-${t + 1}`);
|
|
98
|
+
})]
|
|
99
|
+
}, `bar-chart-${n + 1}`));
|
|
100
|
+
}), /* @__PURE__ */ i(m, { children: t });
|
|
101
|
+
}, N = t(null), P = () => {
|
|
102
|
+
let e = [];
|
|
103
|
+
for (let t = 1; t < C + 1; t++) {
|
|
104
|
+
let t = Array.from({ length: w }, (e, t) => ({
|
|
105
|
+
name: `${t + 1}`,
|
|
106
|
+
value: 1
|
|
107
|
+
}));
|
|
108
|
+
e.push(t);
|
|
109
|
+
}
|
|
110
|
+
let t = [];
|
|
111
|
+
return e.forEach((e, n) => {
|
|
112
|
+
t.push(/* @__PURE__ */ i(h, {
|
|
113
|
+
width: 200,
|
|
114
|
+
height: 200,
|
|
115
|
+
children: /* @__PURE__ */ i(u, {
|
|
116
|
+
data: e,
|
|
117
|
+
fill: "#FFFFFF",
|
|
118
|
+
stroke: "#000000",
|
|
119
|
+
dataKey: "value",
|
|
120
|
+
startAngle: 90,
|
|
121
|
+
endAngle: -270,
|
|
122
|
+
isAnimationActive: !1,
|
|
123
|
+
labelLine: !1,
|
|
124
|
+
label: T && y,
|
|
125
|
+
children: e.map((e, t) => /* @__PURE__ */ i(c, {
|
|
126
|
+
onClick: E ? null : () => d(n + 1, t + 1),
|
|
127
|
+
onMouseEnter: E ? null : () => g(n + 1, t + 1),
|
|
128
|
+
onMouseLeave: E ? null : () => _(n + 1, t + 1),
|
|
129
|
+
fill: v(O, `${n + 1}-${t + 1}`),
|
|
130
|
+
style: {
|
|
131
|
+
outline: "none",
|
|
132
|
+
cursor: E ? "default" : "pointer"
|
|
133
|
+
}
|
|
134
|
+
}, `${n + 1}-${t + 1}`))
|
|
135
|
+
}, `pie-${n + 1}`)
|
|
136
|
+
}, `pie-chart-${n}`));
|
|
137
|
+
}), /* @__PURE__ */ i(p, {
|
|
138
|
+
ref: N,
|
|
139
|
+
children: t
|
|
140
|
+
});
|
|
141
|
+
};
|
|
142
|
+
if (S === "bar") return M();
|
|
143
|
+
if (S === "pie") return e(() => {
|
|
144
|
+
if (N?.current && w === 1) {
|
|
145
|
+
let e = N.current.querySelectorAll("path");
|
|
146
|
+
e.length > 0 && e.forEach((e) => {
|
|
147
|
+
let t = e.getAttribute("d");
|
|
148
|
+
e.setAttribute("d", t.replaceAll("L 100,100", ""));
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}, []), P();
|
|
152
|
+
};
|
|
153
|
+
//#endregion
|
|
154
|
+
export { g as default };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/fraction-model/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
|
+
import FractionModelChart from './fraction-model-chart.js';
|
|
10
|
+
export { FractionModelChart };
|
|
11
|
+
export default class FractionModel extends HTMLElement {
|
|
12
|
+
constructor();
|
|
13
|
+
set model(m: any);
|
|
14
|
+
get model(): any;
|
|
15
|
+
set session(s: any);
|
|
16
|
+
get session(): any;
|
|
17
|
+
isSessionComplete(session: any, model: any): boolean;
|
|
18
|
+
onSessionChange(session: any): void;
|
|
19
|
+
connectedCallback(): void;
|
|
20
|
+
_render(): void;
|
|
21
|
+
disconnectedCallback(): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import e from "./fraction-model-chart.js";
|
|
2
|
+
import { Main as t } from "./main.js";
|
|
3
|
+
import n from "react";
|
|
4
|
+
import { createRoot as r } from "react-dom/client";
|
|
5
|
+
import { SessionChangedEvent as i } from "@pie-element/shared-player-events";
|
|
6
|
+
import { cloneDeep as a } from "@pie-element/shared-lodash";
|
|
7
|
+
import { renderMath as o } from "@pie-element/shared-math-rendering-mathjax";
|
|
8
|
+
//#region src/delivery/index.ts
|
|
9
|
+
var s = class extends HTMLElement {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(), this._root = null;
|
|
12
|
+
}
|
|
13
|
+
set model(e) {
|
|
14
|
+
this._model = e, this._render();
|
|
15
|
+
}
|
|
16
|
+
get model() {
|
|
17
|
+
return this._model;
|
|
18
|
+
}
|
|
19
|
+
set session(e) {
|
|
20
|
+
this._session = e, this._render();
|
|
21
|
+
}
|
|
22
|
+
get session() {
|
|
23
|
+
return this._session;
|
|
24
|
+
}
|
|
25
|
+
isSessionComplete(e, t) {
|
|
26
|
+
let n = e && e.answers, r = !t.allowedStudentConfig || n.noOfModel > 0 && n.partsPerModel > 0, i = Array.isArray(n.response) && n.response.length > 0;
|
|
27
|
+
return r && i;
|
|
28
|
+
}
|
|
29
|
+
onSessionChange(e) {
|
|
30
|
+
this._session.answers = e && e.answers;
|
|
31
|
+
let t = this.isSessionComplete(this._session, this._model);
|
|
32
|
+
this.dispatchEvent(new i(this.tagName.toLowerCase(), t));
|
|
33
|
+
}
|
|
34
|
+
connectedCallback() {
|
|
35
|
+
this._render();
|
|
36
|
+
}
|
|
37
|
+
_render() {
|
|
38
|
+
if (this._model && this._session) {
|
|
39
|
+
let e = a(this._model), i = n.createElement(t, {
|
|
40
|
+
model: e,
|
|
41
|
+
session: this._session,
|
|
42
|
+
onSessionChange: this.onSessionChange.bind(this)
|
|
43
|
+
});
|
|
44
|
+
this._root ||= r(this), this._root.render(i), queueMicrotask(() => {
|
|
45
|
+
o(this);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
disconnectedCallback() {
|
|
50
|
+
this._root &&= (this._root.unmount(), null);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
//#endregion
|
|
54
|
+
export { e as FractionModelChart, s as default };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-elements/packages/fraction-model/src/main.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 Main extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
model: PropTypes.Requireable<object>;
|
|
14
|
+
session: PropTypes.Requireable<object>;
|
|
15
|
+
onSessionChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
16
|
+
};
|
|
17
|
+
constructor(props: any);
|
|
18
|
+
/**
|
|
19
|
+
* Function to trigger when session value change for fraction model
|
|
20
|
+
*/
|
|
21
|
+
callOnSessionChange: any;
|
|
22
|
+
/**
|
|
23
|
+
* Function to generate answers for preview selection
|
|
24
|
+
* @param {object} model contains model object for fraction model
|
|
25
|
+
* @returns answer model
|
|
26
|
+
*/
|
|
27
|
+
generateAnswers: any;
|
|
28
|
+
/**
|
|
29
|
+
* Function to trigger when answer change from preview
|
|
30
|
+
* @param {object} newAnswers contains updated answer model
|
|
31
|
+
*/
|
|
32
|
+
onAnswerChange: any;
|
|
33
|
+
toggleShowCorrect: any;
|
|
34
|
+
onResponseChange: any;
|
|
35
|
+
generateRandomKey: any;
|
|
36
|
+
render(): React.JSX.Element;
|
|
37
|
+
}
|
|
38
|
+
export default Main;
|