@pie-element/explicit-constructed-response 3.11.3 → 3.11.5

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,21 @@
1
+
2
+ <!doctype html>
3
+ <html>
4
+ <head>
5
+ <title>@pie-element/explicit-constructed-response@3.11.3</title>
6
+ <script
7
+ type="module"
8
+ src="https://cdn.jsdelivr.net/npm/@pslb/demo-el@^1.0.0/dist/demo-el/demo-el.esm.js"></script>
9
+
10
+ <link
11
+ href="https://fonts.googleapis.com/css?family=Roboto&display=swap"
12
+ rel="stylesheet"
13
+ />
14
+ <style>
15
+ html, body {
16
+ font-family: 'Roboto', sans-serif;
17
+ }
18
+ </style>
19
+ <script type="module" src="./demo.js"></script>
20
+ </head>
21
+ </html>
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "@pie-element/explicit-constructed-response",
3
+ "version": "3.11.3",
4
+ "modules": [
5
+ {
6
+ "name": "@pie-lib/shared-module",
7
+ "version": "^1.2.13"
8
+ },
9
+ {
10
+ "name": "@pie-lib/drag-module",
11
+ "version": "^1.0.14"
12
+ }
13
+ ]
14
+ }
@@ -0,0 +1,83 @@
1
+ import PrintElement from './print.js';
2
+
3
+ var generate = {};
4
+
5
+ const choice = (l, v) => ({ label: l, value: v });
6
+
7
+ const markup = '<p>The {{0}} <br> jumped {{1}} <br> the {{2}}</p>';
8
+
9
+ generate.model = (id, element) => ({
10
+ id,
11
+ element,
12
+ markup,
13
+ disabled: false,
14
+ choices: {
15
+ 0: [choice('cow', '0'), choice('cattle', '1'), choice('calf', '2')],
16
+ 1: [choice('over', '0'), choice('past', '1'), choice('beyond', '2')],
17
+ 2: [choice('moon', '0')]
18
+ },
19
+ maxLengthPerChoice: [10, 11, 7],
20
+ prompt: 'Complete the sentence',
21
+ note: 'The answer shown above is the most common correct answer for this item. One or more additional correct answers are also defined, and will also be recognized as correct.',
22
+ promptEnabled: true,
23
+ toolbarEditorPosition: 'bottom'
24
+ });
25
+
26
+ const { model } = generate;
27
+
28
+ var config = {
29
+ elements: {
30
+ 'explicit-constructed-response': '../..'
31
+ },
32
+ models: [model('1', 'explicit-constructed-response')]
33
+ };
34
+
35
+ // new init - just shows off print!
36
+
37
+ const init = async () => {
38
+ console.log('define the element...');
39
+ await Promise.all(
40
+ config.models.map(async (m) => {
41
+ try {
42
+ const printTag = `${m.element}-print`;
43
+ if (customElements.get(printTag)) {
44
+ return true;
45
+ } else {
46
+ customElements.define(printTag, PrintElement);
47
+ await customElements.whenDefined(printTag);
48
+ return true;
49
+ }
50
+ } catch (e) {
51
+ return false;
52
+ }
53
+ })
54
+ );
55
+
56
+ console.log('now apply the model...');
57
+ config.models.forEach((m) => {
58
+ const printTag = `${m.element}-print`;
59
+ const h3s = document.createElement('h3');
60
+ h3s.textContent = 'student mode';
61
+ document.body.appendChild(h3s);
62
+ const de = document.createElement(printTag);
63
+ document.body.appendChild(de);
64
+ de.options = {};
65
+ de.model = m;
66
+
67
+ const h3 = document.createElement('h3');
68
+ h3.textContent = 'instructor mode';
69
+ document.body.appendChild(h3);
70
+ const instr = document.createElement(printTag);
71
+ document.body.appendChild(instr);
72
+ instr.options = { mode: 'instructor' };
73
+ instr.model = JSON.parse(JSON.stringify(m));
74
+ });
75
+ };
76
+
77
+ init()
78
+ .then(() => {
79
+ console.log('ready');
80
+ })
81
+ .catch((e) => {
82
+ console.error(e);
83
+ });
@@ -0,0 +1,18 @@
1
+
2
+ <!doctype html>
3
+ <html>
4
+ <head>
5
+ <title>@pie-element/explicit-constructed-response@3.11.3</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>