@pie-element/graphing-solution-set 6.1.2-next.1 → 6.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 +1 -0
- package/CHANGELOG.md +856 -0
- package/LICENSE.md +5 -0
- package/README.md +20 -0
- package/configure/CHANGELOG.json +1 -0
- package/configure/CHANGELOG.md +816 -0
- package/configure/lib/configure.js +312 -0
- package/configure/lib/configure.js.map +1 -0
- package/configure/lib/correct-response.js +435 -0
- package/configure/lib/correct-response.js.map +1 -0
- package/configure/lib/defaults.js +357 -0
- package/configure/lib/defaults.js.map +1 -0
- package/configure/lib/graphing-config.js +408 -0
- package/configure/lib/graphing-config.js.map +1 -0
- package/configure/lib/index.js +163 -0
- package/configure/lib/index.js.map +1 -0
- package/configure/lib/utils.js +630 -0
- package/configure/lib/utils.js.map +1 -0
- package/configure/package.json +29 -0
- package/controller/CHANGELOG.json +1 -0
- package/controller/CHANGELOG.md +675 -0
- package/controller/lib/defaults.js +69 -0
- package/controller/lib/defaults.js.map +1 -0
- package/controller/lib/index.js +351 -0
- package/controller/lib/index.js.map +1 -0
- package/controller/lib/utils.js +212 -0
- package/controller/lib/utils.js.map +1 -0
- package/controller/package.json +22 -0
- package/demo-gss.gif +0 -0
- package/docs/config-schema.json +1560 -0
- package/docs/config-schema.json.md +1114 -0
- package/docs/demo/config.js +8 -0
- package/docs/demo/generate.js +54 -0
- package/docs/demo/index.html +1 -0
- package/docs/demo/session.js +6 -0
- package/docs/pie-schema.json +1800 -0
- package/docs/pie-schema.json.md +952 -0
- package/lib/index.js +164 -0
- package/lib/index.js.map +1 -0
- package/lib/main.js +355 -0
- package/lib/main.js.map +1 -0
- package/lib/utils.js +515 -0
- package/lib/utils.js.map +1 -0
- package/package.json +23 -86
- package/configure.js +0 -2
- package/controller.js +0 -1
- package/dist/author/configure.d.ts +0 -26
- package/dist/author/configure.js +0 -190
- package/dist/author/correct-response.d.ts +0 -33
- package/dist/author/correct-response.js +0 -206
- package/dist/author/defaults.d.ts +0 -238
- package/dist/author/defaults.js +0 -339
- package/dist/author/graphing-config.d.ts +0 -33
- package/dist/author/graphing-config.js +0 -237
- package/dist/author/index.d.ts +0 -62
- package/dist/author/index.js +0 -87
- package/dist/author/utils.d.ts +0 -46
- package/dist/author/utils.js +0 -474
- package/dist/browser/author/index.js +0 -1942
- package/dist/browser/author/index.js.map +0 -1
- package/dist/browser/browser-pUycHh7Y.js +0 -348
- package/dist/browser/browser-pUycHh7Y.js.map +0 -1
- package/dist/browser/controller/index.js +0 -193
- package/dist/browser/controller/index.js.map +0 -1
- package/dist/browser/delivery/index.js +0 -782
- package/dist/browser/delivery/index.js.map +0 -1
- package/dist/browser/dist-BxTk7Laj.js +0 -57671
- package/dist/browser/dist-BxTk7Laj.js.map +0 -1
- package/dist/browser/graphing-solution-set.css +0 -2
- package/dist/controller/defaults.d.ts +0 -64
- package/dist/controller/defaults.js +0 -54
- package/dist/controller/index.d.ts +0 -24
- package/dist/controller/index.js +0 -110
- package/dist/controller/utils.d.ts +0 -20
- package/dist/controller/utils.js +0 -39
- package/dist/delivery/index.d.ts +0 -22
- package/dist/delivery/index.js +0 -62
- package/dist/delivery/main.d.ts +0 -31
- package/dist/delivery/main.js +0 -198
- package/dist/delivery/utils.d.ts +0 -12
- package/dist/delivery/utils.js +0 -220
- package/dist/graphing-solution-set.css +0 -2
- package/dist/index.d.ts +0 -1
- package/dist/index.iife.d.ts +0 -8
- package/dist/index.iife.js +0 -405
- package/dist/index.js +0 -2
- package/dist/runtime-support.d.ts +0 -12
- package/dist/runtime-support.js +0 -12
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/graphing-solution-set/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
|
-
answers: {
|
|
11
|
-
correctAnswer: {
|
|
12
|
-
name: string;
|
|
13
|
-
marks: never[];
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
arrows: {
|
|
17
|
-
left: boolean;
|
|
18
|
-
right: boolean;
|
|
19
|
-
up: boolean;
|
|
20
|
-
down: boolean;
|
|
21
|
-
};
|
|
22
|
-
marks: never[];
|
|
23
|
-
defaultGridConfiguration: number;
|
|
24
|
-
domain: {
|
|
25
|
-
min: number;
|
|
26
|
-
max: number;
|
|
27
|
-
step: number;
|
|
28
|
-
labelStep: number;
|
|
29
|
-
axisLabel: string;
|
|
30
|
-
};
|
|
31
|
-
graph: {
|
|
32
|
-
width: number;
|
|
33
|
-
height: number;
|
|
34
|
-
};
|
|
35
|
-
gssLineData: {
|
|
36
|
-
numberOfLines: number;
|
|
37
|
-
selectedTool: string;
|
|
38
|
-
sections: never[];
|
|
39
|
-
lineA: {
|
|
40
|
-
lineType: string;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
includeAxes: boolean;
|
|
44
|
-
labels: {};
|
|
45
|
-
labelsEnabled: boolean;
|
|
46
|
-
padding: boolean;
|
|
47
|
-
prompt: string;
|
|
48
|
-
range: {
|
|
49
|
-
min: number;
|
|
50
|
-
max: number;
|
|
51
|
-
step: number;
|
|
52
|
-
labelStep: number;
|
|
53
|
-
axisLabel: string;
|
|
54
|
-
};
|
|
55
|
-
rationale: string;
|
|
56
|
-
standardGrid: boolean;
|
|
57
|
-
title: string;
|
|
58
|
-
coordinatesOnHover: boolean;
|
|
59
|
-
promptEnabled: boolean;
|
|
60
|
-
rationaleEnabled: boolean;
|
|
61
|
-
teacherInstructionsEnabled: boolean;
|
|
62
|
-
studentInstructionsEnabled: boolean;
|
|
63
|
-
};
|
|
64
|
-
export default _default;
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
//#region src/controller/defaults.ts
|
|
2
|
-
var e = {
|
|
3
|
-
answers: { correctAnswer: {
|
|
4
|
-
name: "Correct Answer",
|
|
5
|
-
marks: []
|
|
6
|
-
} },
|
|
7
|
-
arrows: {
|
|
8
|
-
left: !0,
|
|
9
|
-
right: !0,
|
|
10
|
-
up: !0,
|
|
11
|
-
down: !0
|
|
12
|
-
},
|
|
13
|
-
marks: [],
|
|
14
|
-
defaultGridConfiguration: 0,
|
|
15
|
-
domain: {
|
|
16
|
-
min: -5,
|
|
17
|
-
max: 5,
|
|
18
|
-
step: 1,
|
|
19
|
-
labelStep: 1,
|
|
20
|
-
axisLabel: "x"
|
|
21
|
-
},
|
|
22
|
-
graph: {
|
|
23
|
-
width: 500,
|
|
24
|
-
height: 500
|
|
25
|
-
},
|
|
26
|
-
gssLineData: {
|
|
27
|
-
numberOfLines: 1,
|
|
28
|
-
selectedTool: "lineA",
|
|
29
|
-
sections: [],
|
|
30
|
-
lineA: { lineType: "Solid" }
|
|
31
|
-
},
|
|
32
|
-
includeAxes: !0,
|
|
33
|
-
labels: {},
|
|
34
|
-
labelsEnabled: !0,
|
|
35
|
-
padding: !0,
|
|
36
|
-
prompt: "",
|
|
37
|
-
range: {
|
|
38
|
-
min: -5,
|
|
39
|
-
max: 5,
|
|
40
|
-
step: 1,
|
|
41
|
-
labelStep: 1,
|
|
42
|
-
axisLabel: "y"
|
|
43
|
-
},
|
|
44
|
-
rationale: "",
|
|
45
|
-
standardGrid: !1,
|
|
46
|
-
title: "",
|
|
47
|
-
coordinatesOnHover: !1,
|
|
48
|
-
promptEnabled: !0,
|
|
49
|
-
rationaleEnabled: !0,
|
|
50
|
-
teacherInstructionsEnabled: !0,
|
|
51
|
-
studentInstructionsEnabled: !0
|
|
52
|
-
};
|
|
53
|
-
//#endregion
|
|
54
|
-
export { e as default };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/graphing-solution-set/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 compareMarks: (mark1: any, mark2: any) => boolean;
|
|
10
|
-
export declare const getAnswerCorrected: ({ sessionAnswers, marks: correctAnswers }: {
|
|
11
|
-
sessionAnswers: any;
|
|
12
|
-
marks: any;
|
|
13
|
-
}) => any[];
|
|
14
|
-
export declare const getBestAnswer: (question: any, session: any, env?: {}) => {
|
|
15
|
-
bestScore: number;
|
|
16
|
-
bestScoreAnswerKey: null;
|
|
17
|
-
answersCorrected: any[];
|
|
18
|
-
foundOneSolution: boolean;
|
|
19
|
-
};
|
|
20
|
-
export declare const normalize: (question: any) => any;
|
|
21
|
-
export declare function model(question: any, session: any, env: any): Promise<unknown>;
|
|
22
|
-
export declare function outcome(question: any, session: any, env?: {}): Promise<unknown>;
|
|
23
|
-
export declare const createCorrectResponseSession: (question: any, env: any) => Promise<unknown>;
|
|
24
|
-
export declare const validate: (model?: {}) => {};
|
package/dist/controller/index.js
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import e from "./defaults.js";
|
|
2
|
-
import { equalMarks as t, removeInvalidAnswers as n, sortedAnswers as r } from "./utils.js";
|
|
3
|
-
import i from "debug";
|
|
4
|
-
import { cloneDeep as a, isEmpty as o, uniqWith as s } from "@pie-element/shared-lodash";
|
|
5
|
-
//#region src/controller/index.ts
|
|
6
|
-
var c = i("@pie-element:graphing-solution-set:controller"), l = () => ({ line: [] }), u = (e, n) => !!(e && n && e.type === n.type && t[e.type] && t[e.type](e, n)), d = ({ sessionAnswers: e, marks: t }) => {
|
|
7
|
-
e ||= [], t ||= [];
|
|
8
|
-
let n = a(e).reduce((e, n) => (n.correctness = t.find((e) => u(n, e)) ? "correct" : "incorrect", [...e, n]), []), r = a(t).reduce((t, n) => e.find((e) => u(n, e)) ? t : [...t, {
|
|
9
|
-
...n,
|
|
10
|
-
correctness: "missing"
|
|
11
|
-
}], []);
|
|
12
|
-
return [...n, ...r];
|
|
13
|
-
}, f = (e, t, n = {}) => {
|
|
14
|
-
let { answers: i = {}, scoringType: c } = e || {}, { answer: f } = t || {};
|
|
15
|
-
Object.entries(i || {}).forEach(([e, t]) => i[e] = {
|
|
16
|
-
...t,
|
|
17
|
-
marks: t?.marks.filter((e) => !e.building)
|
|
18
|
-
}), f ||= [], i = o(i) ? { correctAnswer: l() } : {
|
|
19
|
-
correctAnswer: i.correctAnswer,
|
|
20
|
-
...r(i)
|
|
21
|
-
};
|
|
22
|
-
let p = s(f, u);
|
|
23
|
-
return Object.entries(i).reduce((e, t) => {
|
|
24
|
-
let n = t[0], { marks: r } = t[1] || {};
|
|
25
|
-
if (!r || !r.length) return e;
|
|
26
|
-
let i = d({
|
|
27
|
-
sessionAnswers: p,
|
|
28
|
-
marks: r
|
|
29
|
-
}), a = i.filter((e) => e.correctness === "correct"), o = i.filter((e) => e.correctness !== "missing"), s = r.length, c = a.length;
|
|
30
|
-
return o.length > s && (c -= o.length - s), c < 0 && (c = 0), (c / s > e.bestScore || !e.foundOneSolution) && (e.bestScore = Math.floor(c / s), e.bestScoreAnswerKey = n, e.answersCorrected = i, e.foundOneSolution = !0), e;
|
|
31
|
-
}, {
|
|
32
|
-
bestScore: 0,
|
|
33
|
-
bestScoreAnswerKey: null,
|
|
34
|
-
answersCorrected: a(p).map((e) => ({
|
|
35
|
-
...e,
|
|
36
|
-
correctness: "incorrect"
|
|
37
|
-
})),
|
|
38
|
-
foundOneSolution: !1
|
|
39
|
-
});
|
|
40
|
-
}, p = (t) => ({
|
|
41
|
-
...e,
|
|
42
|
-
...t
|
|
43
|
-
});
|
|
44
|
-
function m(e, t, r) {
|
|
45
|
-
return new Promise((i) => {
|
|
46
|
-
let a = p(e);
|
|
47
|
-
t.answer = n(t.answer);
|
|
48
|
-
let { defaultTool: s, extraCSSRules: l, prompt: u, promptEnabled: d, graph: m, answers: h, toolbarTools: g, ..._ } = a || {}, { arrows: v } = a, { mode: y, role: b } = r || {};
|
|
49
|
-
typeof v == "boolean" && (v = v ? {
|
|
50
|
-
left: !0,
|
|
51
|
-
right: !0,
|
|
52
|
-
up: !0,
|
|
53
|
-
down: !0
|
|
54
|
-
} : {
|
|
55
|
-
left: !1,
|
|
56
|
-
right: !1,
|
|
57
|
-
up: !1,
|
|
58
|
-
down: !1
|
|
59
|
-
});
|
|
60
|
-
let x = {
|
|
61
|
-
..._,
|
|
62
|
-
answers: h,
|
|
63
|
-
arrows: v,
|
|
64
|
-
defaultTool: "line",
|
|
65
|
-
disabled: r.mode !== "gather",
|
|
66
|
-
prompt: d ? u : null,
|
|
67
|
-
rationale: null,
|
|
68
|
-
size: m,
|
|
69
|
-
showToggle: r.mode === "evaluate" && !o(h) && h.correctAnswer && h.correctAnswer.marks && !o(h.correctAnswer.marks),
|
|
70
|
-
teacherInstructions: null,
|
|
71
|
-
toolbarTools: g,
|
|
72
|
-
extraCSSRules: l
|
|
73
|
-
};
|
|
74
|
-
if (b === "instructor" && (y === "view" || y === "evaluate")) {
|
|
75
|
-
let { rationale: e, rationaleEnabled: t, teacherInstructions: n, teacherInstructionsEnabled: r } = a || {};
|
|
76
|
-
x.rationale = t ? e : null, x.teacherInstructions = r ? n : null;
|
|
77
|
-
}
|
|
78
|
-
if (y === "evaluate") if (!o(h) && h.correctAnswer && h.correctAnswer.marks && !o(h.correctAnswer.marks)) {
|
|
79
|
-
let { answersCorrected: e, bestScoreAnswerKey: n, bestScore: i } = f(a, t, r);
|
|
80
|
-
x.answersCorrected = e, x.correctResponse = n ? (h[n] || {}).marks : [], x.showToggle = x.showToggle && i !== 1;
|
|
81
|
-
} else x.answersCorrected = t && t.answer || [], x.correctResponse = [];
|
|
82
|
-
c("base: ", x), i(x);
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function h(e, t, n = {}) {
|
|
86
|
-
return new Promise((r) => {
|
|
87
|
-
(!t || o(t)) && r({
|
|
88
|
-
score: 0,
|
|
89
|
-
empty: !0
|
|
90
|
-
}), (n.mode !== "evaluate" || o(e.answers) || e.answers && e.answers.correctAnswer && o(e.answers.correctAnswer.marks)) && r({ score: 0 });
|
|
91
|
-
let { bestScore: i } = f(e, t, n);
|
|
92
|
-
r({ score: i });
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
var g = (e, t) => new Promise((n) => {
|
|
96
|
-
if (t.mode !== "evaluate" && t.role === "instructor") {
|
|
97
|
-
let { answers: t } = e || {}, r = [];
|
|
98
|
-
t && Object.values(t) && (r = (t.correctAnswer || Object.values(t)[0] || {}).marks || []), n({
|
|
99
|
-
answer: r,
|
|
100
|
-
id: "1"
|
|
101
|
-
});
|
|
102
|
-
} else n(null);
|
|
103
|
-
}), _ = (e = {}) => {
|
|
104
|
-
let { answers: t, gssLineData: n } = e, r = {}, i = {}, a = !1;
|
|
105
|
-
n.numberOfLines === 1 ? t.correctAnswer.marks.length < 1 ? (a = !0, i.correctAnswer = "At least 1 line object should be defined.") : t.correctAnswer.marks.length === 1 && t.correctAnswer.marks[0].building && (a = !0, i.correctAnswer = "1 or more graph object should be correctly defined.") : t.correctAnswer.marks.length < 2 ? (a = !0, i.correctAnswer = "At least 2 line object should be defined.") : t.correctAnswer.marks.length === 2 && (t.correctAnswer.marks[0].building || t.correctAnswer.marks[1].building) && (a = !0, i.correctAnswer = "1 or more graph object should be correctly defined.");
|
|
106
|
-
let s = t.correctAnswer.marks.find((e) => e.type === "polygon");
|
|
107
|
-
return !a && (!n.selectedTool === "solutionSet" || !s) && (i.correctAnswer = "Please select a solution set for the graphing solution set item."), o(i) || (r.correctAnswerErrors = i), r;
|
|
108
|
-
};
|
|
109
|
-
//#endregion
|
|
110
|
-
export { u as compareMarks, g as createCorrectResponseSession, d as getAnswerCorrected, f as getBestAnswer, m as model, p as normalize, h as outcome, _ as validate };
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/graphing-solution-set/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 equalSegment: (segment1: any, segment2: any) => boolean;
|
|
10
|
-
export declare const sortedAnswers: (answers: any) => {};
|
|
11
|
-
export declare const equalLine: (line1: any, line2: any) => boolean;
|
|
12
|
-
export declare const constructSegmentsFromPoints: (points: any) => any;
|
|
13
|
-
export declare const removeDuplicateSegments: (segments: any) => unknown[];
|
|
14
|
-
export declare const removeInvalidSegments: (segments: any) => any;
|
|
15
|
-
export declare const equalPolygon: (poly1: any, poly2: any) => boolean;
|
|
16
|
-
export declare const equalMarks: {
|
|
17
|
-
line: (sessAnswer: any, mark: any) => boolean;
|
|
18
|
-
polygon: (sessAnswer: any, poly: any) => boolean;
|
|
19
|
-
};
|
|
20
|
-
export declare const removeInvalidAnswers: (answers: any) => any;
|
package/dist/controller/utils.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { differenceWith as e, isEqual as t, uniq as n, uniqWith as r } from "@pie-element/shared-lodash";
|
|
2
|
-
//#region src/controller/utils.ts
|
|
3
|
-
var i = (e, n) => t(e.from, n.from) && t(e.to, n.to) || t(e.to, n.from) && t(e.from, n.to), a = (e) => Object.keys(e || {}).sort().reduce((t, n) => (n !== "correctAnswer" && (t[n] = e[n]), t), {}), o = (e) => {
|
|
4
|
-
e = {
|
|
5
|
-
...e,
|
|
6
|
-
to: { ...e.to },
|
|
7
|
-
from: { ...e.from }
|
|
8
|
-
};
|
|
9
|
-
let t = e.from.x, n = e.from.y, r = e.to.x, i = e.to.y;
|
|
10
|
-
return {
|
|
11
|
-
a: i - n,
|
|
12
|
-
b: t - r,
|
|
13
|
-
c: r * n - t * i
|
|
14
|
-
};
|
|
15
|
-
}, s = (e) => Math.round(e * 1e4) / 1e4, c = (e, t) => {
|
|
16
|
-
let { a: r, b: i, c: a } = o(e), { a: c, b: l, c: u } = o(t), d = [];
|
|
17
|
-
if (c !== 0) d.push(s(r / c));
|
|
18
|
-
else if (r !== c) return !1;
|
|
19
|
-
if (l !== 0) d.push(s(i / l));
|
|
20
|
-
else if (i !== l) return !1;
|
|
21
|
-
if (u !== 0) d.push(s(a / u));
|
|
22
|
-
else if (a !== u) return !1;
|
|
23
|
-
return n(d).length === 1 && e.fill === t.fill;
|
|
24
|
-
}, l = (e) => (e || []).map((t, n) => ({
|
|
25
|
-
from: t,
|
|
26
|
-
to: e[(n + 1) % e.length]
|
|
27
|
-
})), u = (e) => (e ||= [], r(e, (e, t) => i(e, t))), d = (e) => (e ||= [], e.filter((e) => !t(e.from, e.to))), f = (t, n) => {
|
|
28
|
-
let { points: r } = t, { points: a } = n, o = l(r), s = l(a), c = u(d(o)), f = u(d(s)), p = e(c, f, i), m = e(f, c, i);
|
|
29
|
-
return (!p || !p.length) && (!m || !m.length);
|
|
30
|
-
}, p = {
|
|
31
|
-
line: (e, t) => c(e, t),
|
|
32
|
-
polygon: (e, t) => f(e, t)
|
|
33
|
-
}, m = (e) => e && Number.isFinite(e.x) && Number.isFinite(e.y), h = {
|
|
34
|
-
point: m,
|
|
35
|
-
line: (e) => e && h.point(e.from) && h.point(e.to),
|
|
36
|
-
polygon: (e) => e && e.points && e.points.length && (e.points.filter((e) => m(e)) || []).length === e.points.length
|
|
37
|
-
}, g = (e) => e ? (e || []).filter(({ type: e, ...t }) => h[e] ? h[e](t) : !1) : [];
|
|
38
|
-
//#endregion
|
|
39
|
-
export { p as equalMarks, g as removeInvalidAnswers, a as sortedAnswers };
|
package/dist/delivery/index.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/graphing-solution-set/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
|
-
setGssData: any;
|
|
20
|
-
_render(): void;
|
|
21
|
-
disconnectedCallback(): void;
|
|
22
|
-
}
|
package/dist/delivery/index.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { findSectionsInSolutionSet as e, removeInvalidAnswers as t } from "./utils.js";
|
|
2
|
-
import n from "./main.js";
|
|
3
|
-
import r from "react";
|
|
4
|
-
import { createRoot as i } from "react-dom/client";
|
|
5
|
-
import { SessionChangedEvent as a } from "@pie-element/shared-player-events";
|
|
6
|
-
import { renderMath as o } from "@pie-element/shared-math-rendering-mathjax";
|
|
7
|
-
//#region src/delivery/index.ts
|
|
8
|
-
var s = class extends HTMLElement {
|
|
9
|
-
constructor() {
|
|
10
|
-
super(), this._root = null;
|
|
11
|
-
}
|
|
12
|
-
set model(e) {
|
|
13
|
-
this._model = e, this._render();
|
|
14
|
-
}
|
|
15
|
-
set session(t) {
|
|
16
|
-
this._session = t, this._session.answer || (this._session.answer = []);
|
|
17
|
-
let { answer: n } = this._session || {}, { gssLineData: r, domain: i, range: a } = this._model, o = n && n.filter((e) => e.type === "polygon").length > 0;
|
|
18
|
-
r.numberOfLines === 1 ? this._model.gssData = {
|
|
19
|
-
numberOfLines: 1,
|
|
20
|
-
selectedTool: o ? "solutionSet" : "lineA",
|
|
21
|
-
sections: [],
|
|
22
|
-
lineA: { lineType: n && n.length > 0 ? n[0].fill : "Solid" }
|
|
23
|
-
} : this._model.gssData = {
|
|
24
|
-
numberOfLines: 2,
|
|
25
|
-
selectedTool: o ? "solutionSet" : "lineA",
|
|
26
|
-
sections: [],
|
|
27
|
-
lineA: { lineType: n && n.length > 0 ? n[0].fill : "Solid" },
|
|
28
|
-
lineB: { lineType: n && n.length > 1 ? n[1].fill : "Solid" }
|
|
29
|
-
}, o && (this._model.gssData = e(this._model.gssData, n, i, a)), this._render();
|
|
30
|
-
}
|
|
31
|
-
get session() {
|
|
32
|
-
return this._session;
|
|
33
|
-
}
|
|
34
|
-
connectedCallback() {
|
|
35
|
-
this._render();
|
|
36
|
-
}
|
|
37
|
-
isComplete = (e) => Array.isArray(e) && e.length > 0;
|
|
38
|
-
changeAnswers = (e, n) => {
|
|
39
|
-
let { gssData: r } = this._model;
|
|
40
|
-
r.selectedTool === "lineA" && e.length > 0 && (e[0].fill = r.lineA.lineType), r.selectedTool === "lineB" && e.length > 1 && (e[1].fill = r.lineB.lineType), e.length === 0 && (r.selectedTool = "lineA", this._model.gssData = r), n ? this._session.answer = e : this._session.answer = t(e), this.dispatchEvent(new a(this.tagName.toLowerCase(), this.isComplete(this._session.answer))), this._render();
|
|
41
|
-
};
|
|
42
|
-
setGssData = (e, t) => {
|
|
43
|
-
this._model.gssData = e, this._session = t, this.dispatchEvent(new a(this.tagName.toLowerCase(), this.isComplete(this._session.answer))), this._render();
|
|
44
|
-
};
|
|
45
|
-
_render() {
|
|
46
|
-
if (!this._model || !this._session) return;
|
|
47
|
-
let e = r.createElement(n, {
|
|
48
|
-
model: this._model,
|
|
49
|
-
session: this._session,
|
|
50
|
-
onAnswersChange: this.changeAnswers,
|
|
51
|
-
setGssData: this.setGssData
|
|
52
|
-
});
|
|
53
|
-
this._root ||= i(this), this._root.render(e), queueMicrotask(() => {
|
|
54
|
-
o(this);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
disconnectedCallback() {
|
|
58
|
-
this._root && this._root.unmount();
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
//#endregion
|
|
62
|
-
export { n as Component, s as default };
|
package/dist/delivery/main.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/graphing-solution-set/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
|
-
session: PropTypes.Validator<object>;
|
|
15
|
-
onAnswersChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
16
|
-
};
|
|
17
|
-
state: {
|
|
18
|
-
showingCorrect: boolean;
|
|
19
|
-
dialog: {
|
|
20
|
-
open: boolean;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
handleAlertDialog: (open: any, callback: any) => void;
|
|
24
|
-
toggleCorrect: (showingCorrect: any) => void;
|
|
25
|
-
onResetClick: any;
|
|
26
|
-
onSolutionSetSelected: any;
|
|
27
|
-
onChangeGssLineData: any;
|
|
28
|
-
handleGssDataChange: any;
|
|
29
|
-
render(): React.JSX.Element;
|
|
30
|
-
}
|
|
31
|
-
export default Main;
|
package/dist/delivery/main.js
DELETED
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { checkIfLinesAreAdded as e, findSectionsInSolutionSet as t, pointInsidePolygon as n } from "./utils.js";
|
|
2
|
-
import r from "react";
|
|
3
|
-
import i from "prop-types";
|
|
4
|
-
import { styled as a } from "@mui/material/styles";
|
|
5
|
-
import { GraphContainer as o } from "@pie-lib/graphing-solution-set";
|
|
6
|
-
import * as s from "@pie-lib/render-ui";
|
|
7
|
-
import { Collapsible as c, PreviewPrompt as l, UiLayout as u, color as d, hasMedia as f, hasText as p } from "@pie-lib/render-ui";
|
|
8
|
-
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
9
|
-
import g from "@pie-lib/correct-answer-toggle";
|
|
10
|
-
import { AlertDialog as _ } from "@pie-lib/config-ui";
|
|
11
|
-
//#region src/delivery/main.tsx
|
|
12
|
-
function v(e) {
|
|
13
|
-
return typeof e == "function" || typeof e == "object" && !!e && typeof e.$$typeof == "symbol";
|
|
14
|
-
}
|
|
15
|
-
function y(e, t) {
|
|
16
|
-
return !e || v(e) ? e : v(e.default) ? e.default : t && v(e[t]) ? e[t] : t && v(e[t]?.default) ? e[t].default : e;
|
|
17
|
-
}
|
|
18
|
-
var b = y(u, "UiLayout") || y(T.UiLayout, "UiLayout"), x = y(l, "PreviewPrompt") || y(T.PreviewPrompt, "PreviewPrompt"), S = y(c, "Collapsible") || y(T.Collapsible, "Collapsible"), C = s, w = C.default, T = w && typeof w == "object" ? w : C, E = a(b)({
|
|
19
|
-
color: d.text(),
|
|
20
|
-
backgroundColor: d.background()
|
|
21
|
-
}), D = a(S)(({ theme: e }) => ({ marginBottom: e.spacing(2) })), O = a(o)(({ theme: e }) => ({
|
|
22
|
-
marginTop: e.spacing(2),
|
|
23
|
-
marginBottom: e.spacing(2)
|
|
24
|
-
})), k = class extends r.Component {
|
|
25
|
-
static propTypes = {
|
|
26
|
-
model: i.object.isRequired,
|
|
27
|
-
session: i.object.isRequired,
|
|
28
|
-
onAnswersChange: i.func
|
|
29
|
-
};
|
|
30
|
-
state = {
|
|
31
|
-
showingCorrect: !1,
|
|
32
|
-
dialog: { open: !1 }
|
|
33
|
-
};
|
|
34
|
-
handleAlertDialog = (e, t) => this.setState({ dialog: { open: e } }, t);
|
|
35
|
-
toggleCorrect = (e) => this.setState({ showingCorrect: e });
|
|
36
|
-
onResetClick = () => {
|
|
37
|
-
let { model: e, session: t, setGssData: n } = this.props, { gssData: r } = e;
|
|
38
|
-
this.setState({ dialog: {
|
|
39
|
-
open: !0,
|
|
40
|
-
title: "Warning",
|
|
41
|
-
text: "This will remove all the elements added on the graph and reset graph to original state. Are you sure you want to continue?",
|
|
42
|
-
onConfirm: () => {
|
|
43
|
-
t.answer = [], r.selectedTool = "lineA", r.lineA.lineType = "Solid", r.lineB && (r.lineB.lineType = "Solid"), n(r, t), this.handleAlertDialog(!1);
|
|
44
|
-
},
|
|
45
|
-
onClose: () => this.handleAlertDialog(!1)
|
|
46
|
-
} });
|
|
47
|
-
};
|
|
48
|
-
onSolutionSetSelected = (e) => {
|
|
49
|
-
let { model: t, session: r, setGssData: i } = this.props, { gssData: a, disabled: o } = t;
|
|
50
|
-
if (!o) {
|
|
51
|
-
for (let t of a.sections) if (n(e, t)) {
|
|
52
|
-
let e = {
|
|
53
|
-
points: t,
|
|
54
|
-
building: !1,
|
|
55
|
-
type: "polygon",
|
|
56
|
-
closed: !0,
|
|
57
|
-
isSolution: !0
|
|
58
|
-
};
|
|
59
|
-
r.answer = r.answer.filter((e) => e.type !== "polygon"), r.answer.push(e);
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
i(a, r);
|
|
63
|
-
}
|
|
64
|
-
};
|
|
65
|
-
onChangeGssLineData = (n, r) => {
|
|
66
|
-
let { model: i, session: a } = this.props, { domain: o, range: s, disabled: c } = i;
|
|
67
|
-
if (!c) if (n.selectedTool === "solutionSet") {
|
|
68
|
-
let i = a.answer.filter((e) => e.type !== "polygon");
|
|
69
|
-
if (!e(n, i)) n.selectedTool = r, this.setState({ dialog: {
|
|
70
|
-
open: !0,
|
|
71
|
-
title: "Warning",
|
|
72
|
-
text: "Please define the line(s) and then select a solution set for the item.",
|
|
73
|
-
onConfirm: () => this.handleAlertDialog(!1)
|
|
74
|
-
} });
|
|
75
|
-
else {
|
|
76
|
-
let e = a.answer.filter((e) => e.type !== "polygon");
|
|
77
|
-
n = t(n, e, o, s);
|
|
78
|
-
}
|
|
79
|
-
this.handleGssDataChange(n, a);
|
|
80
|
-
} else {
|
|
81
|
-
let e = a.answer.filter((e) => e.type === "polygon");
|
|
82
|
-
r === "solutionSet" && e.length > 0 ? this.setState({ dialog: {
|
|
83
|
-
open: !0,
|
|
84
|
-
title: "Warning",
|
|
85
|
-
text: "Changing a line after adding a solution set will clear your selected solution set. Click 'Clear Solution Set' to change the line. Otherwise, click 'Cancel'.",
|
|
86
|
-
onConfirm: () => {
|
|
87
|
-
a.answer = a.answer.filter((e) => e.type !== "polygon"), this.handleGssDataChange(n, a), this.handleAlertDialog(!1);
|
|
88
|
-
},
|
|
89
|
-
onConfirmText: "CLEAR SOLUTION SET",
|
|
90
|
-
onClose: () => {
|
|
91
|
-
n.selectedTool = r, this.handleGssDataChange(n, a), this.handleAlertDialog(!1);
|
|
92
|
-
}
|
|
93
|
-
} }) : this.handleGssDataChange(n, a);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
handleGssDataChange = (e, t) => {
|
|
97
|
-
let { setGssData: n } = this.props;
|
|
98
|
-
t.answer && t.answer.length > 0 && t.answer[0] && e.lineA && (t.answer[0].fill = e.lineA.lineType), t.answer && t.answer.length > 1 && t.answer[1] && e.lineB && (t.answer[1].fill = e.lineB.lineType), (e.selectedTool === "lineB" && t.answer.length === 0 || e.selectedTool === "lineB" && t.answer[0].building) && (this.setState({ dialog: {
|
|
99
|
-
open: !0,
|
|
100
|
-
title: "Warning",
|
|
101
|
-
text: "Please add Line A to the graph before adding Line B",
|
|
102
|
-
onConfirm: () => this.handleAlertDialog(!1)
|
|
103
|
-
} }), e.selectedTool = "lineA"), e.selectedTool === "lineA" && t.answer.length > 1 && t.answer[1].building && (this.setState({ dialog: {
|
|
104
|
-
open: !0,
|
|
105
|
-
title: "Warning",
|
|
106
|
-
text: "Please add Line B to the graph before switching to Line A",
|
|
107
|
-
onConfirm: () => this.handleAlertDialog(!1)
|
|
108
|
-
} }), e.selectedTool = "lineB"), n(e, t);
|
|
109
|
-
};
|
|
110
|
-
render() {
|
|
111
|
-
let { model: e, onAnswersChange: t, session: n } = this.props, { showingCorrect: r, dialog: i } = this.state, { answer: a } = n || {}, { answersCorrected: o, arrows: s, coordinatesOnHover: c, correctResponse: l, defaultTool: u, disabled: d, domain: v, extraCSSRules: y, labels: b, labelsEnabled: C, prompt: w, range: T, rationale: k, size: A, showToggle: j, title: M, titleEnabled: N, teacherInstructions: P, language: F, gssLineData: I, gssData: L } = e || {}, R = o || a || [], z = e.rationale && (p(e.rationale) || f(e.rationale));
|
|
112
|
-
return /* @__PURE__ */ h(E, {
|
|
113
|
-
extraCSSRules: y,
|
|
114
|
-
children: [
|
|
115
|
-
e.teacherInstructions && (p(e.teacherInstructions) || f(e.teacherInstructions)) && /* @__PURE__ */ m(D, {
|
|
116
|
-
labels: {
|
|
117
|
-
hidden: "Show Teacher Instructions",
|
|
118
|
-
visible: "Hide Teacher Instructions"
|
|
119
|
-
},
|
|
120
|
-
children: /* @__PURE__ */ m(x, { prompt: P })
|
|
121
|
-
}),
|
|
122
|
-
w && /* @__PURE__ */ m(x, {
|
|
123
|
-
className: "prompt",
|
|
124
|
-
prompt: w
|
|
125
|
-
}),
|
|
126
|
-
/* @__PURE__ */ m(g, {
|
|
127
|
-
show: j,
|
|
128
|
-
toggled: r,
|
|
129
|
-
onToggle: this.toggleCorrect,
|
|
130
|
-
language: F
|
|
131
|
-
}),
|
|
132
|
-
r && j ? /* @__PURE__ */ m(O, {
|
|
133
|
-
axesSettings: { includeArrows: s },
|
|
134
|
-
coordinatesOnHover: c,
|
|
135
|
-
disabled: !0,
|
|
136
|
-
disabledLabels: !0,
|
|
137
|
-
disabledTitle: !0,
|
|
138
|
-
domain: v,
|
|
139
|
-
labels: b,
|
|
140
|
-
marks: l.map((e) => ({
|
|
141
|
-
...e,
|
|
142
|
-
correctness: "correct"
|
|
143
|
-
})),
|
|
144
|
-
onChangeMarks: t,
|
|
145
|
-
range: T,
|
|
146
|
-
showLabels: C,
|
|
147
|
-
showTitle: N,
|
|
148
|
-
size: A,
|
|
149
|
-
title: M,
|
|
150
|
-
language: F,
|
|
151
|
-
gssLineData: I,
|
|
152
|
-
onChangeGssLineData: this.onChangeGssLineData,
|
|
153
|
-
onSolutionSetSelected: this.onSolutionSetSelected,
|
|
154
|
-
toolbarTools: ["line", "polygon"]
|
|
155
|
-
}) : /* @__PURE__ */ m(O, {
|
|
156
|
-
axesSettings: { includeArrows: s },
|
|
157
|
-
coordinatesOnHover: c,
|
|
158
|
-
defaultTool: u,
|
|
159
|
-
disabled: d,
|
|
160
|
-
disabledLabels: !0,
|
|
161
|
-
disabledTitle: !0,
|
|
162
|
-
domain: v,
|
|
163
|
-
labels: b,
|
|
164
|
-
marks: R,
|
|
165
|
-
onChangeMarks: t,
|
|
166
|
-
onCustomReset: this.onResetClick,
|
|
167
|
-
range: T,
|
|
168
|
-
showLabels: C,
|
|
169
|
-
showTitle: N,
|
|
170
|
-
size: A,
|
|
171
|
-
title: M,
|
|
172
|
-
language: F,
|
|
173
|
-
gssLineData: L,
|
|
174
|
-
onChangeGssLineData: this.onChangeGssLineData,
|
|
175
|
-
onSolutionSetSelected: this.onSolutionSetSelected,
|
|
176
|
-
toolbarTools: ["line", "polygon"]
|
|
177
|
-
}),
|
|
178
|
-
z && /* @__PURE__ */ m(S, {
|
|
179
|
-
labels: {
|
|
180
|
-
hidden: "Show Rationale",
|
|
181
|
-
visible: "Hide Rationale"
|
|
182
|
-
},
|
|
183
|
-
children: /* @__PURE__ */ m(x, { prompt: k })
|
|
184
|
-
}),
|
|
185
|
-
/* @__PURE__ */ m(_, {
|
|
186
|
-
open: i.open,
|
|
187
|
-
title: i.title,
|
|
188
|
-
text: i.text,
|
|
189
|
-
onClose: i.onClose,
|
|
190
|
-
onConfirm: i.onConfirm,
|
|
191
|
-
onConfirmText: i.onConfirmText ? i.onConfirmText : "OK"
|
|
192
|
-
})
|
|
193
|
-
]
|
|
194
|
-
});
|
|
195
|
-
}
|
|
196
|
-
};
|
|
197
|
-
//#endregion
|
|
198
|
-
export { k as default };
|
package/dist/delivery/utils.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @synced-from pie-elements/packages/graphing-solution-set/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 findSectionsInSolutionSet: (gssLineData: any, answers: any, domain: any, range: any) => any;
|
|
10
|
-
export declare const pointInsidePolygon: (point: any, polygon: any) => boolean;
|
|
11
|
-
export declare const checkIfLinesAreAdded: (gssLineData: any, answer: any) => boolean | undefined;
|
|
12
|
-
export declare const removeInvalidAnswers: (answers: any) => any;
|