@pie-element/ebsr 13.2.0-next.6 → 13.2.0-next.7

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.
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "@pie-element/ebsr",
3
+ "version": "13.2.0-next.6",
4
+ "modules": [
5
+ {
6
+ "name": "@pie-lib/shared-module",
7
+ "version": "^4.1.0"
8
+ },
9
+ {
10
+ "name": "@pie-lib/math-rendering-module",
11
+ "version": "^4.1.0"
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,115 @@
1
+ import PrintElement from './print.js';
2
+
3
+ var generate = {};
4
+
5
+ generate.model = (id, element) => ({
6
+ id,
7
+ element,
8
+ partA: {
9
+ choiceMode: 'checkbox',
10
+ choices: [
11
+ {
12
+ value: 'yellow',
13
+ label: 'Yellow',
14
+ },
15
+ {
16
+ value: 'green',
17
+ label: 'Green',
18
+ },
19
+ {
20
+ correct: true,
21
+ value: 'blue',
22
+ label: 'Blue',
23
+ },
24
+ ],
25
+ choicePrefix: 'numbers',
26
+ partialScoring: false,
27
+ prompt: 'What color is the sky?',
28
+ promptEnabled: true,
29
+ },
30
+ partB: {
31
+ choiceMode: 'checkbox',
32
+ choices: [
33
+ {
34
+ value: 'orange',
35
+ label: 'Orange',
36
+ },
37
+ {
38
+ correct: true,
39
+ value: 'purple',
40
+ label: 'Purple',
41
+ },
42
+ {
43
+ value: 'pink',
44
+ label: 'Pink',
45
+ },
46
+ {
47
+ value: 'green',
48
+ label: 'Green',
49
+ },
50
+ ],
51
+ choicePrefix: 'numbers',
52
+ partialScoring: false,
53
+ prompt: 'What color do you get when you mix Red with your answer in Part 1?',
54
+ promptEnabled: true,
55
+ },
56
+ });
57
+
58
+ const { model } = generate;
59
+
60
+ var config = {
61
+ elements: {
62
+ 'ebsr-element': '../..',
63
+ },
64
+ models: [model('1', 'ebsr-element') /*, model('2', 'ebsr-element')*/],
65
+ };
66
+
67
+ // new init - just shows off print!
68
+
69
+ const init = async () => {
70
+ console.log('define the element...');
71
+ await Promise.all(
72
+ config.models.map(async (m) => {
73
+ try {
74
+ const printTag = `${m.element}-print`;
75
+ if (customElements.get(printTag)) {
76
+ return true;
77
+ } else {
78
+ customElements.define(printTag, PrintElement);
79
+ await customElements.whenDefined(printTag);
80
+ return true;
81
+ }
82
+ } catch (e) {
83
+ return false;
84
+ }
85
+ })
86
+ );
87
+
88
+ console.log('now apply the model...');
89
+ config.models.forEach((m) => {
90
+ const printTag = `${m.element}-print`;
91
+ const h3s = document.createElement('h3');
92
+ h3s.textContent = 'student mode';
93
+ document.body.appendChild(h3s);
94
+ const de = document.createElement(printTag);
95
+ document.body.appendChild(de);
96
+ de.options = {};
97
+ de.model = m;
98
+
99
+ const h3 = document.createElement('h3');
100
+ h3.textContent = 'instructor mode';
101
+ document.body.appendChild(h3);
102
+ const instr = document.createElement(printTag);
103
+ document.body.appendChild(instr);
104
+ instr.options = { mode: 'instructor' };
105
+ instr.model = JSON.parse(JSON.stringify(m));
106
+ });
107
+ };
108
+
109
+ init()
110
+ .then(() => {
111
+ console.log('ready');
112
+ })
113
+ .catch((e) => {
114
+ console.error(e);
115
+ });
@@ -0,0 +1,18 @@
1
+
2
+ <!doctype html>
3
+ <html>
4
+ <head>
5
+ <title>@pie-element/ebsr@13.2.0-next.6</title>
6
+ <link
7
+ href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
8
+ rel="stylesheet"
9
+ />
10
+ <style>
11
+ html, body {
12
+ font-family: 'Roboto', sans-serif;
13
+ }
14
+ </style>
15
+ <script type="module" src="./print-demo.js"></script>
16
+ </head>
17
+ <body></body>
18
+ </html>