@pie-element/math-templated 5.1.0 → 5.2.0

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/module/demo.js ADDED
@@ -0,0 +1,67 @@
1
+ import Configure from './configure.js';
2
+ import Element from './element.js';
3
+ import * as controller from './controller.js';
4
+
5
+ var generate = {};
6
+
7
+ generate.model = (id, element) => ({
8
+ id,
9
+ element,
10
+ rationale: 'Rationale',
11
+ partialScoring: true,
12
+ prompt: 'There are 24 students in the class. They had the choice to buy supplies from two different stores, Store A and B. Each of them bought 2 binders and 5 notebooks. The students have a total of $420 to spend.',
13
+ scoringType: 'auto',
14
+ feedbackEnabled: false,
15
+ promptEnabled: true,
16
+ rationaleEnabled: true,
17
+ teacherInstructionsEnabled: true,
18
+ studentInstructionsEnabled: true,
19
+ toolbarEditorPosition: 'bottom',
20
+ validationDefault: 'literal',
21
+ ignoreOrderDefault: false,
22
+ allowTrailingZerosDefault: false,
23
+ teacherInstructions: 'These are teacher instructions',
24
+ customKeys: [], // these have effect on player only?
25
+ equationEditor: 'geometry',
26
+ markup: `
27
+ <p>If the unit price of a notebook in Store A is $1.50, what is the unit price of a binder? \${{0}}</p>
28
+ <p>If the unit price of a binder in Store B is $2.80, what is the unit price of a notebook? \${{1}}</p>
29
+ `,
30
+ responses: {
31
+ 0: {
32
+ allowTrailingZeros: false,
33
+ answer: '5',
34
+ id: '1',
35
+ validation: 'symbolic',
36
+ ignoreOrder: false,
37
+ alternates: {}
38
+ },
39
+ 1: {
40
+ allowTrailingZeros: false,
41
+ answer: '2.38',
42
+ id: '1',
43
+ validation: 'literal',
44
+ ignoreOrder: false,
45
+ alternates: {}
46
+ }
47
+ }
48
+ });
49
+
50
+ const { model } = generate;
51
+
52
+ var config = {
53
+ elements: {
54
+ 'math-templated': '../..',
55
+ },
56
+ models: [model('1', 'math-templated')],
57
+ };
58
+
59
+ //Note: demo-el is a custom element loaded in the markup.
60
+ customElements.whenDefined("demo-el").then(() => {
61
+ config.models.forEach((m) => {
62
+ const de = document.createElement("demo-el");
63
+ document.body.appendChild(de);
64
+ de.def = { tagName: m.element, Element, Configure, controller };
65
+ de.model = m;
66
+ });
67
+ });