@pie-element/charting 12.1.2-next.1 → 12.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +487 -0
- package/CHANGELOG.md +2001 -0
- package/LICENSE.md +5 -0
- package/README.md +1 -0
- package/configure/CHANGELOG.json +292 -0
- package/configure/CHANGELOG.md +1768 -0
- package/configure/lib/charting-config.js +192 -0
- package/configure/lib/charting-config.js.map +1 -0
- package/configure/lib/configure.js +312 -0
- package/configure/lib/configure.js.map +1 -0
- package/configure/lib/correct-response.js +244 -0
- package/configure/lib/correct-response.js.map +1 -0
- package/configure/lib/defaults.js +233 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/index.js +120 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/utils.js +80 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +29 -0
- package/controller/CHANGELOG.json +262 -0
- package/controller/CHANGELOG.md +1212 -0
- package/controller/lib/defaults.js +42 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +434 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/package.json +24 -0
- package/docs/config-schema.json +2440 -0
- package/docs/config-schema.json.md +1802 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +63 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +26 -0
- package/docs/pie-schema.json +1731 -0
- package/docs/pie-schema.json.md +945 -0
- package/lib/index.js +78 -0
- package/lib/index.js.map +1 -0
- package/lib/main.js +167 -0
- package/lib/main.js.map +1 -0
- package/package.json +21 -86
- package/configure.js +0 -2
- package/controller.js +0 -1
- package/dist/author/charting-config.d.ts +0 -30
- package/dist/author/charting-config.js +0 -126
- package/dist/author/configure.d.ts +0 -29
- package/dist/author/configure.js +0 -205
- package/dist/author/correct-response.d.ts +0 -27
- package/dist/author/correct-response.js +0 -115
- package/dist/author/defaults.d.ts +0 -229
- package/dist/author/defaults.js +0 -186
- package/dist/author/index.d.ts +0 -51
- package/dist/author/index.js +0 -74
- package/dist/author/utils.d.ts +0 -42
- package/dist/author/utils.js +0 -244
- package/dist/browser/author/index.js +0 -1242
- package/dist/browser/author/index.js.map +0 -1
- package/dist/browser/chart-AvFvbpGV.js +0 -58913
- package/dist/browser/chart-AvFvbpGV.js.map +0 -1
- package/dist/browser/charting.css +0 -2
- package/dist/browser/controller/index.js +0 -194
- package/dist/browser/controller/index.js.map +0 -1
- package/dist/browser/delivery/index.js +0 -517
- package/dist/browser/delivery/index.js.map +0 -1
- package/dist/browser/dist-CA-Ok7CW.js +0 -330
- package/dist/browser/dist-CA-Ok7CW.js.map +0 -1
- package/dist/charting.css +0 -2
- package/dist/controller/defaults.d.ts +0 -44
- package/dist/controller/defaults.js +0 -33
- package/dist/controller/index.d.ts +0 -28
- package/dist/controller/index.js +0 -153
- package/dist/delivery/index.d.ts +0 -21
- package/dist/delivery/index.js +0 -46
- package/dist/delivery/main.d.ts +0 -23
- package/dist/delivery/main.js +0 -128
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -395
- package/dist/index.js +0 -2
- package/dist/runtime-support.d.ts +0 -12
- package/dist/runtime-support.js +0 -12
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/charting/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
|
-
/**
|
|
10
|
-
* NOTE: There's no functionality described for graphTitle,
|
|
11
|
-
* rationale, scoringType, studentInstructions, teacherInstructions
|
|
12
|
-
* so there's no implementation (they are only added in model)
|
|
13
|
-
*/
|
|
14
|
-
declare const _default: {
|
|
15
|
-
addCategoryEnabled: boolean;
|
|
16
|
-
changeAddCategoryEnabled: boolean;
|
|
17
|
-
changeEditableEnabled: boolean;
|
|
18
|
-
changeInteractiveEnabled: boolean;
|
|
19
|
-
chartType: string;
|
|
20
|
-
correctAnswer: {};
|
|
21
|
-
data: never[];
|
|
22
|
-
domain: {};
|
|
23
|
-
graph: {
|
|
24
|
-
width: number;
|
|
25
|
-
height: number;
|
|
26
|
-
};
|
|
27
|
-
prompt: string;
|
|
28
|
-
promptEnabled: boolean;
|
|
29
|
-
range: {
|
|
30
|
-
label: string;
|
|
31
|
-
max: number;
|
|
32
|
-
min: number;
|
|
33
|
-
labelStep: number;
|
|
34
|
-
};
|
|
35
|
-
rationale: string;
|
|
36
|
-
rationaleEnabled: boolean;
|
|
37
|
-
scoringType: string;
|
|
38
|
-
studentInstructionsEnabled: boolean;
|
|
39
|
-
studentNewCategoryDefaultLabel: string;
|
|
40
|
-
teacherInstructions: string;
|
|
41
|
-
teacherInstructionsEnabled: boolean;
|
|
42
|
-
title: string;
|
|
43
|
-
};
|
|
44
|
-
export default _default;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
//#region src/controller/defaults.ts
|
|
2
|
-
var e = {
|
|
3
|
-
addCategoryEnabled: !0,
|
|
4
|
-
changeAddCategoryEnabled: !1,
|
|
5
|
-
changeEditableEnabled: !1,
|
|
6
|
-
changeInteractiveEnabled: !1,
|
|
7
|
-
chartType: "lineCross",
|
|
8
|
-
correctAnswer: {},
|
|
9
|
-
data: [],
|
|
10
|
-
domain: {},
|
|
11
|
-
graph: {
|
|
12
|
-
width: 480,
|
|
13
|
-
height: 480
|
|
14
|
-
},
|
|
15
|
-
prompt: "",
|
|
16
|
-
promptEnabled: !0,
|
|
17
|
-
range: {
|
|
18
|
-
label: "",
|
|
19
|
-
max: 1,
|
|
20
|
-
min: 0,
|
|
21
|
-
labelStep: 1
|
|
22
|
-
},
|
|
23
|
-
rationale: "",
|
|
24
|
-
rationaleEnabled: !0,
|
|
25
|
-
scoringType: "all or nothing",
|
|
26
|
-
studentInstructionsEnabled: !0,
|
|
27
|
-
studentNewCategoryDefaultLabel: "New Category",
|
|
28
|
-
teacherInstructions: "",
|
|
29
|
-
teacherInstructionsEnabled: !0,
|
|
30
|
-
title: ""
|
|
31
|
-
};
|
|
32
|
-
//#endregion
|
|
33
|
-
export { e as default };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/charting/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 checkLabelsEquality: (givenAnswerLabel: any, correctAnswerLabel: any) => boolean;
|
|
10
|
-
export declare const setCorrectness: (answers: any, partialScoring: any) => any;
|
|
11
|
-
export declare const normalize: (question: any) => any;
|
|
12
|
-
export declare const getScore: (question: any, session: any, env?: {}) => {
|
|
13
|
-
score: number;
|
|
14
|
-
answers: any;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Generates detailed trace log for scoring evaluation
|
|
18
|
-
* @param {Object} model - the question model
|
|
19
|
-
* @param {Object} session - the student session
|
|
20
|
-
* @param {Object} env - the environment
|
|
21
|
-
* @returns {Array} traceLog - array of trace messages
|
|
22
|
-
*/
|
|
23
|
-
export declare const getLogTrace: (model: any, session: any, env: any) => string[];
|
|
24
|
-
export declare const filterCategories: (categories: any) => any;
|
|
25
|
-
export declare function model(question: any, session: any, env: any): Promise<unknown>;
|
|
26
|
-
export declare function outcome(model: any, session: any, env: any): Promise<unknown>;
|
|
27
|
-
export declare const createCorrectResponseSession: (question: any, env: any) => Promise<unknown>;
|
|
28
|
-
export declare const validate: (model?: {}, config?: {}) => {};
|
package/dist/controller/index.js
DELETED
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import e from "./defaults.js";
|
|
2
|
-
import { isEmpty as t, isEqual as n, pick as r } from "@pie-element/shared-lodash";
|
|
3
|
-
import i from "debug";
|
|
4
|
-
import { partialScoring as a } from "@pie-element/shared-controller-utils";
|
|
5
|
-
//#region src/controller/index.ts
|
|
6
|
-
var o = i("@pie-element:graphing:controller"), s = (e) => (e || "").toLowerCase(), c = (e, t) => s(e) === s(t), l = (e, t) => e ? e.map((e) => ({
|
|
7
|
-
...e,
|
|
8
|
-
correctness: {
|
|
9
|
-
value: t ? "incorrect" : "correct",
|
|
10
|
-
label: t ? "incorrect" : "correct"
|
|
11
|
-
}
|
|
12
|
-
})) : [], u = (t) => ({
|
|
13
|
-
...e,
|
|
14
|
-
...t
|
|
15
|
-
}), d = (e, t, n = {}) => {
|
|
16
|
-
let { correctAnswer: r, data: i = [], scoringType: o } = e, u = [], d = a.enabled({ partialScoring: o === void 0 ? o : o === "partial scoring" }, n), { data: f = [] } = r || {}, m = p(i), h = l(t && t.answer || m, d), g = 0;
|
|
17
|
-
if (d) {
|
|
18
|
-
let e = 0, t = 0, n = (n, r) => {
|
|
19
|
-
let { value: i, label: a, index: o } = n, s = i === r.value, l = c(a, r.label);
|
|
20
|
-
e += 2, s && (t += 1, n.correctness.value = "correct"), l && (t += 1, n.correctness.label = "correct"), s && l && u.push({
|
|
21
|
-
label: a,
|
|
22
|
-
index: o
|
|
23
|
-
});
|
|
24
|
-
};
|
|
25
|
-
f.forEach((r, i) => {
|
|
26
|
-
let a = m[i], o = h[i];
|
|
27
|
-
o ? a ? !a.editable && o.interactive ? (e += 1, o.value === r.value && (t += 1, o.correctness.value = "correct", u.push({
|
|
28
|
-
label: o.label,
|
|
29
|
-
index: i
|
|
30
|
-
})), o.correctness.label = "correct") : a.editable && o.interactive ? n(o, r) : o.interactive || (o.correctness.value = "correct", o.correctness.label = "correct", u.push({
|
|
31
|
-
label: o.label,
|
|
32
|
-
index: i
|
|
33
|
-
})) : n(o, r) : e += 2;
|
|
34
|
-
}), g = e ? t / e : 0;
|
|
35
|
-
} else g = +(f.length === h.length), h = h.map((e, t) => {
|
|
36
|
-
let n = f[t], r = n ? e.value === n.value : !1, i = n ? s(e.label) === s(n.label) : !1;
|
|
37
|
-
return (!r || !i) && (g = 0), r && i && u.push({
|
|
38
|
-
label: e.label,
|
|
39
|
-
index: t
|
|
40
|
-
}), {
|
|
41
|
-
...e,
|
|
42
|
-
correctness: {
|
|
43
|
-
value: r ? "correct" : "incorrect",
|
|
44
|
-
label: i ? "correct" : "incorrect"
|
|
45
|
-
}
|
|
46
|
-
};
|
|
47
|
-
});
|
|
48
|
-
let _ = {
|
|
49
|
-
score: parseFloat(g.toFixed(2)),
|
|
50
|
-
answers: h
|
|
51
|
-
};
|
|
52
|
-
return n.extraProps && n.extraProps.correctResponseEnabled && (_.correctResponses = u), _;
|
|
53
|
-
}, f = (e, t, n) => {
|
|
54
|
-
let r = [], { correctAnswer: i, data: o = [], scoringType: s } = e || {}, { data: l = [] } = i || {}, u = t && t.answer || [], f = a.enabled({ partialScoring: s === void 0 ? s : s === "partial scoring" }, n), m = p(o), h = u.length > 0 ? p(u) : m;
|
|
55
|
-
if (u.length || r.push("Student did not modify the chart. Initial chart is scored."), l.forEach((e, t) => {
|
|
56
|
-
let n = m[t], i = h[t];
|
|
57
|
-
if (!i) {
|
|
58
|
-
r.push(`Category ${t + 1}: missing (expected value '${e.value}', label '${e.label}').`);
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
let a = i.value === e.value, o = c(i.label, e.label);
|
|
62
|
-
if (!i.interactive) {
|
|
63
|
-
r.push(`Category ${t + 1}: non-interactive category treated as correct.`);
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
if (u.length > 0) {
|
|
67
|
-
let e = n ? i.value !== n.value : !0, s = n ? !c(i.label, n.label) : !0;
|
|
68
|
-
if (!e && !s) {
|
|
69
|
-
a && o ? r.push(`Category ${t + 1}: unchanged from initial value and correct.`) : r.push(`Category ${t + 1}: unchanged from initial value but incorrect.`);
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
let l = [];
|
|
73
|
-
e && l.push(`value ${a ? "correct" : "incorrect"}`), s && l.push(`label ${o ? "correct" : "incorrect"}`), r.push(`Category ${t + 1}: modified - ${l.join(", ")}.`);
|
|
74
|
-
} else a && o ? r.push(`Category ${t + 1}: initial values are correct.`) : a ? r.push(`Category ${t + 1}: initial value correct, label incorrect.`) : o ? r.push(`Category ${t + 1}: initial value incorrect, label correct.`) : r.push(`Category ${t + 1}: initial value and label incorrect.`);
|
|
75
|
-
}), h.length > l.length) {
|
|
76
|
-
let e = h.length - l.length;
|
|
77
|
-
r.push(`${e} extra category(ies) provided beyond expected number.`);
|
|
78
|
-
}
|
|
79
|
-
f ? (r.push("Score calculated using partial scoring."), r.push("Student receives credit for each correct value and label independently.")) : (r.push("Score calculated using all-or-nothing scoring."), r.push("Student must match all category values and labels exactly for full credit."));
|
|
80
|
-
let g = d(e, t, n);
|
|
81
|
-
return r.push(`Score: ${g.score}.`), r;
|
|
82
|
-
}, p = (e) => e ? e.map(({ deletable: e, ...t }) => t) : [];
|
|
83
|
-
function m(e, t, n) {
|
|
84
|
-
return new Promise((r) => {
|
|
85
|
-
let i = u(e), { addCategoryEnabled: a, chartType: s, data: c, domain: l, graph: f, prompt: m, promptEnabled: h, range: g, rationale: _, title: v, rationaleEnabled: y, teacherInstructions: b, teacherInstructionsEnabled: x, correctAnswer: S, scoringType: C, studentNewCategoryDefaultLabel: w, language: T, extraCSSRules: E } = i, D = {
|
|
86
|
-
addCategoryEnabled: a,
|
|
87
|
-
chartType: s,
|
|
88
|
-
data: p(c),
|
|
89
|
-
domain: l,
|
|
90
|
-
graph: f,
|
|
91
|
-
prompt: h ? m : null,
|
|
92
|
-
range: g,
|
|
93
|
-
rationale: _,
|
|
94
|
-
title: v,
|
|
95
|
-
size: f,
|
|
96
|
-
showToggle: !1,
|
|
97
|
-
correctness: {
|
|
98
|
-
correctness: "incorrect",
|
|
99
|
-
score: "0%"
|
|
100
|
-
},
|
|
101
|
-
disabled: n.mode !== "gather",
|
|
102
|
-
scoringType: C,
|
|
103
|
-
studentNewCategoryDefaultLabel: w,
|
|
104
|
-
language: T,
|
|
105
|
-
env: n,
|
|
106
|
-
extraCSSRules: E
|
|
107
|
-
}, O = d(i, t, n), k = p(O.answers);
|
|
108
|
-
n.mode === "view" && (D.correctedAnswer = k.map(({ correctness: e, ...t }) => ({
|
|
109
|
-
...t,
|
|
110
|
-
interactive: !1
|
|
111
|
-
})), D.addCategoryEnabled = !1), n.mode === "evaluate" && (D.correctedAnswer = k, D.correctAnswer = S, D.showToggle = !!S?.data?.length && O.score !== 1, D.addCategoryEnabled = !1, D.showKeyLegend = !0), n.role === "instructor" && (n.mode === "view" || n.mode === "evaluate") ? (D.rationale = y ? _ : null, D.teacherInstructions = x ? b : null) : (D.rationale = null, D.teacherInstructions = null), o("base: ", D), r(D);
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
function h(e, n, r) {
|
|
115
|
-
return new Promise((i) => {
|
|
116
|
-
let a = f(e, n, r), o = d(e, n, r), s = {
|
|
117
|
-
score: o.score,
|
|
118
|
-
empty: !n || t(n),
|
|
119
|
-
traceLog: a
|
|
120
|
-
};
|
|
121
|
-
r.extraProps && r.extraProps.correctResponseEnabled && (s.extraProps = { correctResponse: o.correctResponses }), i(s);
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
var g = (e, t) => new Promise((n) => {
|
|
125
|
-
if (t.mode !== "evaluate" && t.role === "instructor") {
|
|
126
|
-
let { correctAnswer: r } = e, i = r && r.data;
|
|
127
|
-
if (t.mode === "gather") {
|
|
128
|
-
let { data: t } = e;
|
|
129
|
-
i = (r && r.data || []).map((e, n) => ({
|
|
130
|
-
...t[n],
|
|
131
|
-
...e
|
|
132
|
-
}));
|
|
133
|
-
}
|
|
134
|
-
n({
|
|
135
|
-
answer: i,
|
|
136
|
-
id: "1"
|
|
137
|
-
});
|
|
138
|
-
} else return n(null);
|
|
139
|
-
}), _ = (e) => (e || "").replaceAll(/<[^>]*>/g, ""), v = (e) => (e || "").replace(/(<(?!img|iframe|source)([^>]+)>)/gi, ""), y = (e = {}, i = {}) => {
|
|
140
|
-
let { correctAnswer: a, data: o } = e || {}, { data: s } = a || {}, c = s || [], l = {}, u = {}, d = {};
|
|
141
|
-
return [
|
|
142
|
-
"teacherInstructions",
|
|
143
|
-
"prompt",
|
|
144
|
-
"rationale"
|
|
145
|
-
].forEach((t) => {
|
|
146
|
-
i[t]?.required && !v(e[t]) && (l[t] = "This field is required.");
|
|
147
|
-
}), c.forEach((e, t) => {
|
|
148
|
-
let { label: n } = e;
|
|
149
|
-
_(n) ? c.some((e, r) => e.label === n && t !== r) && (d[t] = "Category names should be unique. ") : d[t] = "Content should not be empty. ";
|
|
150
|
-
}), c.length < 1 || c.length > 20 ? u.categoriesError = "The correct answer should include between 1 and 20 categories." : n(o.map((e) => r(e, "value", "label")), s.map((e) => r(e, "value", "label"))) && (u.identicalError = "Correct answer should not be identical to the chart’s initial state"), t(d) || (l.categoryErrors = d), t(u) || (l.correctAnswerErrors = u), l;
|
|
151
|
-
};
|
|
152
|
-
//#endregion
|
|
153
|
-
export { c as checkLabelsEquality, g as createCorrectResponseSession, p as filterCategories, f as getLogTrace, d as getScore, m as model, u as normalize, h as outcome, l as setCorrectness, y as validate };
|
package/dist/delivery/index.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/charting/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 Main from './main.js';
|
|
10
|
-
export { Main as Component };
|
|
11
|
-
export default class Graphing extends HTMLElement {
|
|
12
|
-
constructor();
|
|
13
|
-
set model(m: any);
|
|
14
|
-
set session(s: any);
|
|
15
|
-
get session(): any;
|
|
16
|
-
connectedCallback(): void;
|
|
17
|
-
isComplete: (answer: any) => boolean;
|
|
18
|
-
changeAnswers: any;
|
|
19
|
-
_render(): void;
|
|
20
|
-
disconnectedCallback(): void;
|
|
21
|
-
}
|
package/dist/delivery/index.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import e from "./main.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._root = null;
|
|
10
|
-
}
|
|
11
|
-
set model(e) {
|
|
12
|
-
this._model = e, this._session && this.isComplete(this._session.answer) ? this.dispatchEvent(new r(this.tagName.toLowerCase(), !0, !!this._model)) : this.dispatchEvent(new r(this.tagName.toLowerCase(), !1, !!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
|
-
connectedCallback() {
|
|
21
|
-
this._render();
|
|
22
|
-
}
|
|
23
|
-
isComplete = (e) => Array.isArray(e) && e.length > 0;
|
|
24
|
-
changeAnswers = (e) => {
|
|
25
|
-
this._session.answer = e, this.dispatchEvent(new i(this.tagName.toLowerCase(), this.isComplete(this._session.answer))), this._render();
|
|
26
|
-
};
|
|
27
|
-
_render() {
|
|
28
|
-
if (!this._model || !this._session) return;
|
|
29
|
-
let r = {
|
|
30
|
-
...this._model,
|
|
31
|
-
data: this._model.data ? [...this._model.data] : this._model.data
|
|
32
|
-
}, i = t.createElement(e, {
|
|
33
|
-
model: r,
|
|
34
|
-
categories: this._session.answer,
|
|
35
|
-
onAnswersChange: this.changeAnswers
|
|
36
|
-
});
|
|
37
|
-
this._root ||= n(this), this._root.render(i), queueMicrotask(() => {
|
|
38
|
-
a(this);
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
disconnectedCallback() {
|
|
42
|
-
this._root && this._root.unmount();
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
//#endregion
|
|
46
|
-
export { e as Component, o as default };
|
package/dist/delivery/main.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/charting/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.Validator<object>;
|
|
14
|
-
onAnswersChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
|
-
categories: PropTypes.Requireable<any[]>;
|
|
16
|
-
};
|
|
17
|
-
constructor(props: any);
|
|
18
|
-
componentDidUpdate(prevProps: any): void;
|
|
19
|
-
changeData: (data: any) => void;
|
|
20
|
-
toggleCorrect: (showingCorrect: any) => void;
|
|
21
|
-
render(): React.JSX.Element;
|
|
22
|
-
}
|
|
23
|
-
export default Main;
|
package/dist/delivery/main.js
DELETED
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import e from "react";
|
|
2
|
-
import t from "prop-types";
|
|
3
|
-
import { styled as n } from "@mui/material/styles";
|
|
4
|
-
import * as r from "@pie-lib/render-ui";
|
|
5
|
-
import { Collapsible as i, PreviewPrompt as a, UiLayout as o, color as s, hasMedia as c, hasText as l } from "@pie-lib/render-ui";
|
|
6
|
-
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
7
|
-
import { Chart as f, KeyLegend as p, chartTypes as m } from "@pie-lib/charting";
|
|
8
|
-
import { isEqual as h } from "@pie-element/shared-lodash";
|
|
9
|
-
import g from "@pie-lib/correct-answer-toggle";
|
|
10
|
-
//#region src/delivery/main.tsx
|
|
11
|
-
function _(e) {
|
|
12
|
-
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
13
|
-
}
|
|
14
|
-
function v(e, t) {
|
|
15
|
-
return !e || _(e) ? e : _(e.default) ? e.default : t && _(e[t]) ? e[t] : t && _(e[t]?.default) ? e[t].default : e;
|
|
16
|
-
}
|
|
17
|
-
var y = v(o, "UiLayout") || v(w.UiLayout, "UiLayout"), b = v(a, "PreviewPrompt") || v(w.PreviewPrompt, "PreviewPrompt"), x = v(i, "Collapsible") || v(w.Collapsible, "Collapsible"), S = r, C = S.default, w = C && typeof C == "object" ? C : S, T = n(y)({
|
|
18
|
-
color: s.text(),
|
|
19
|
-
backgroundColor: s.background(),
|
|
20
|
-
overflowX: "scroll",
|
|
21
|
-
overflowY: "hidden"
|
|
22
|
-
}), E = n(f)(({ theme: e }) => ({
|
|
23
|
-
marginTop: e.spacing(2),
|
|
24
|
-
marginBottom: e.spacing(2)
|
|
25
|
-
})), D = n(x)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), O = class extends e.Component {
|
|
26
|
-
static propTypes = {
|
|
27
|
-
model: t.object.isRequired,
|
|
28
|
-
onAnswersChange: t.func,
|
|
29
|
-
categories: t.array
|
|
30
|
-
};
|
|
31
|
-
constructor(e) {
|
|
32
|
-
super(e), this.state = {
|
|
33
|
-
categories: e.categories || e.model.data,
|
|
34
|
-
showingCorrect: !1
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
componentDidUpdate(e) {
|
|
38
|
-
h(e.categories, this.props.categories) ? h(e.model.data, this.props.model.data) || this.setState({ categories: this.props.model.data }) : this.setState({ categories: this.props.categories });
|
|
39
|
-
}
|
|
40
|
-
changeData = (e) => this.setState({ categories: e }, () => this.props.onAnswersChange(e));
|
|
41
|
-
toggleCorrect = (e) => this.setState({ showingCorrect: e });
|
|
42
|
-
render() {
|
|
43
|
-
let { categories: e, showingCorrect: t } = this.state, { model: n } = this.props, { teacherInstructions: r, prompt: i, chartType: a, size: o, domain: s, range: f, title: h, addCategoryEnabled: _, studentNewCategoryDefaultLabel: v, showToggle: y, rationale: S, correctAnswer: C, language: w, env: O, showKeyLegend: k } = n, { correctedAnswer: A, extraCSSRules: j } = n, M = (C?.data || []).map((e) => ({
|
|
44
|
-
...e,
|
|
45
|
-
interactive: !1,
|
|
46
|
-
editable: !1
|
|
47
|
-
})), { mode: N } = O || {};
|
|
48
|
-
N === "view" && (A = (A || []).map((e) => ({
|
|
49
|
-
...e,
|
|
50
|
-
editable: !1
|
|
51
|
-
})));
|
|
52
|
-
let P = n.rationale && (l(n.rationale) || c(n.rationale));
|
|
53
|
-
return /* @__PURE__ */ d(T, {
|
|
54
|
-
extraCSSRules: j,
|
|
55
|
-
children: [
|
|
56
|
-
n.teacherInstructions && (l(n.teacherInstructions) || c(n.teacherInstructions)) && /* @__PURE__ */ u(D, {
|
|
57
|
-
labels: {
|
|
58
|
-
hidden: "Show Teacher Instructions",
|
|
59
|
-
visible: "Hide Teacher Instructions"
|
|
60
|
-
},
|
|
61
|
-
children: /* @__PURE__ */ u(b, { prompt: r })
|
|
62
|
-
}),
|
|
63
|
-
i && /* @__PURE__ */ u(b, {
|
|
64
|
-
className: "prompt",
|
|
65
|
-
prompt: i
|
|
66
|
-
}),
|
|
67
|
-
/* @__PURE__ */ u(g, {
|
|
68
|
-
show: y,
|
|
69
|
-
toggled: t,
|
|
70
|
-
onToggle: this.toggleCorrect,
|
|
71
|
-
language: w
|
|
72
|
-
}),
|
|
73
|
-
t && y ? /* @__PURE__ */ u(E, {
|
|
74
|
-
chartType: a,
|
|
75
|
-
size: o,
|
|
76
|
-
domain: s,
|
|
77
|
-
range: f,
|
|
78
|
-
charts: [
|
|
79
|
-
m.Bar(),
|
|
80
|
-
m.Histogram(),
|
|
81
|
-
m.LineDot(),
|
|
82
|
-
m.LineCross(),
|
|
83
|
-
m.DotPlot(),
|
|
84
|
-
m.LinePlot()
|
|
85
|
-
],
|
|
86
|
-
data: M || e,
|
|
87
|
-
title: h,
|
|
88
|
-
onDataChange: this.changeData,
|
|
89
|
-
addCategoryEnabled: !1,
|
|
90
|
-
categoryDefaultLabel: v,
|
|
91
|
-
language: w,
|
|
92
|
-
labelsPlaceholders: {}
|
|
93
|
-
}) : /* @__PURE__ */ u(E, {
|
|
94
|
-
chartType: a,
|
|
95
|
-
size: o,
|
|
96
|
-
domain: s,
|
|
97
|
-
range: f,
|
|
98
|
-
charts: [
|
|
99
|
-
m.Bar(),
|
|
100
|
-
m.Histogram(),
|
|
101
|
-
m.LineDot(),
|
|
102
|
-
m.LineCross(),
|
|
103
|
-
m.DotPlot(),
|
|
104
|
-
m.LinePlot()
|
|
105
|
-
],
|
|
106
|
-
data: A || e,
|
|
107
|
-
title: h,
|
|
108
|
-
onDataChange: this.changeData,
|
|
109
|
-
addCategoryEnabled: _,
|
|
110
|
-
categoryDefaultLabel: v,
|
|
111
|
-
language: w,
|
|
112
|
-
labelsPlaceholders: {},
|
|
113
|
-
correctData: y ? M : void 0
|
|
114
|
-
}),
|
|
115
|
-
!t && k && /* @__PURE__ */ u(p, { language: w }),
|
|
116
|
-
P && /* @__PURE__ */ u(x, {
|
|
117
|
-
labels: {
|
|
118
|
-
hidden: "Show Rationale",
|
|
119
|
-
visible: "Hide Rationale"
|
|
120
|
-
},
|
|
121
|
-
children: /* @__PURE__ */ u(b, { prompt: S })
|
|
122
|
-
})
|
|
123
|
-
]
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
|
-
//#endregion
|
|
128
|
-
export { O as default };
|
package/dist/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { default } from './delivery/index.js';
|
package/dist/index.iife.d.ts
DELETED