cognikit 1.0.2 → 1.1.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/dist/builders/classification/index.d.ts +24 -0
- package/dist/builders/fill-blanks/index.d.ts +48 -0
- package/dist/client.js +2574 -2666
- package/dist/client.js.map +4 -4
- package/dist/core/builders/index.d.ts +48 -0
- package/dist/core/index.d.ts +2 -1
- package/dist/core/{BaseInteraction.d.ts → interactions/index.d.ts} +11 -12
- package/dist/engines/index.d.ts +0 -1
- package/dist/engines/tables/index.d.ts +40 -2
- package/dist/engines/tables/{implementation/utils.d.ts → utils.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2570 -2662
- package/dist/index.js.map +4 -4
- package/dist/interactions/adjacency-table/index.d.ts +6 -7
- package/dist/interactions/classification-matrix/index.d.ts +7 -6
- package/dist/interactions/fill-blanks/index.d.ts +36 -2
- package/dist/interactions/index.d.ts +0 -2
- package/dist/interactions/list-recall/index.d.ts +27 -1
- package/dist/interactions/lookup-table/index.d.ts +6 -7
- package/dist/interactions/mark-the-words/index.d.ts +34 -2
- package/dist/interactions/mcq-mrq/index.d.ts +37 -2
- package/dist/interactions/nary-choice-table/index.d.ts +7 -13
- package/dist/interactions/open-classification/index.d.ts +9 -6
- package/dist/interactions/rank-order/index.d.ts +49 -2
- package/dist/interactions/registry.d.ts +5 -5
- package/dist/interactions/sequential-classification/index.d.ts +8 -6
- package/dist/interactions/simultaneous-association/index.d.ts +7 -12
- package/dist/{shared/managers → managers}/AnimationsManager.d.ts +6 -1
- package/dist/managers/DragAndDropManager.d.ts +37 -0
- package/dist/{core/utilities/ProgressTracker.d.ts → managers/ProgressManager.d.ts} +8 -8
- package/dist/managers/ScoringManager.d.ts +73 -0
- package/dist/managers/index.d.ts +4 -0
- package/dist/shared/config.d.ts +1 -1
- package/dist/shared/index.d.ts +0 -2
- package/dist/shared/utils.d.ts +2 -1
- package/dist/shell/builders/index.d.ts +29 -0
- package/dist/shell/index.d.ts +2 -1
- package/dist/shell/{simple-shell/script.d.ts → interactions/index.d.ts} +8 -7
- package/dist/types/Builders.d.ts +17 -0
- package/dist/types/Data.d.ts +49 -9
- package/dist/types/Global.d.ts +2 -23
- package/dist/types/Grading.d.ts +2 -0
- package/dist/types/Input.d.ts +12 -16
- package/dist/types/Interactions.d.ts +10 -14
- package/dist/types/Tables.d.ts +2 -2
- package/dist/ui/{misc/block.d.ts → block/index.d.ts} +1 -1
- package/dist/ui/{misc/chip/chip.d.ts → chip/index.d.ts} +8 -4
- package/dist/ui/{misc/dialog.d.ts → dialog/index.d.ts} +0 -1
- package/dist/ui/index.d.ts +4 -1
- package/dist/ui/input/index.d.ts +22 -1
- package/dist/ui/{misc/media.d.ts → media/index.d.ts} +1 -1
- package/package.json +1 -1
- package/public/app.js +5874 -8649
- package/public/app.js.map +4 -4
- package/public/assets/images/landscape.jpg +0 -0
- package/public/assets/images/mountains.jpg +0 -0
- package/public/builders.html +87 -0
- package/public/examples/data.ts +167 -0
- package/public/index.html +1008 -779
- package/dist/core/utilities/index.d.ts +0 -1
- package/dist/engines/tables/implementation/graders.d.ts +0 -23
- package/dist/engines/tables/implementation/index.d.ts +0 -4
- package/dist/engines/tables/implementation/parsers.d.ts +0 -36
- package/dist/engines/tables/implementation/validators.d.ts +0 -9
- package/dist/engines/tables/script.d.ts +0 -37
- package/dist/engines/text/implementation/graders.d.ts +0 -69
- package/dist/engines/text/implementation/index.d.ts +0 -3
- package/dist/engines/text/implementation/parsers.d.ts +0 -9
- package/dist/engines/text/implementation/validators.d.ts +0 -41
- package/dist/engines/text/index.d.ts +0 -2
- package/dist/engines/text/script.d.ts +0 -56
- package/dist/interactions/categorize-the-words/index.d.ts +0 -2
- package/dist/interactions/categorize-the-words/sequential.d.ts +0 -33
- package/dist/interactions/categorize-the-words/static.d.ts +0 -22
- package/dist/interactions/fill-blanks/sequential.d.ts +0 -32
- package/dist/interactions/fill-blanks/static.d.ts +0 -23
- package/dist/interactions/list-recall/script.d.ts +0 -25
- package/dist/interactions/mark-the-words/sequential.d.ts +0 -34
- package/dist/interactions/mark-the-words/static.d.ts +0 -40
- package/dist/interactions/mcq-mrq/implementation/grader.d.ts +0 -20
- package/dist/interactions/mcq-mrq/implementation/index.d.ts +0 -3
- package/dist/interactions/mcq-mrq/implementation/parser.d.ts +0 -21
- package/dist/interactions/mcq-mrq/implementation/validator.d.ts +0 -17
- package/dist/interactions/mcq-mrq/script.d.ts +0 -37
- package/dist/interactions/rank-order/implementation/grader.d.ts +0 -15
- package/dist/interactions/rank-order/implementation/index.d.ts +0 -3
- package/dist/interactions/rank-order/implementation/parser.d.ts +0 -25
- package/dist/interactions/rank-order/implementation/validator.d.ts +0 -3
- package/dist/interactions/rank-order/script.d.ts +0 -39
- package/dist/interactions/shared/association-implementation/grader.d.ts +0 -3
- package/dist/interactions/shared/association-implementation/index.d.ts +0 -1
- package/dist/interactions/shared/association-implementation/validator.d.ts +0 -0
- package/dist/interactions/shared/classification-implementation/grader.d.ts +0 -3
- package/dist/interactions/shared/classification-implementation/index.d.ts +0 -1
- package/dist/interactions/shared/classification-implementation/parser.d.ts +0 -11
- package/dist/interactions/shared/classification-implementation/validator.d.ts +0 -3
- package/dist/interactions/text-transformation/index.d.ts +0 -2
- package/dist/interactions/text-transformation/sequential.d.ts +0 -37
- package/dist/interactions/text-transformation/static.d.ts +0 -47
- package/dist/shared/dsl.d.ts +0 -9
- package/dist/shared/managers/index.d.ts +0 -3
- package/dist/shared/types.d.ts +0 -25
- package/dist/shell/simple-shell/index.d.ts +0 -1
- package/dist/types/Text.d.ts +0 -125
- package/dist/ui/input/input/index.d.ts +0 -1
- package/dist/ui/input/input/input.d.ts +0 -22
- package/dist/ui/misc/chip/index.d.ts +0 -1
- package/dist/ui/misc/index.d.ts +0 -4
- package/public/assets/images/pointing-hand.svg +0 -1
- package/public/examples/chip.html +0 -495
- package/public/scalable-bare.html +0 -432
- package/public/tables-demo.html +0 -534
- package/public/text-interactions-demo.html +0 -604
- /package/dist/{interactions/list-recall/implementation → builders/list}/index.d.ts +0 -0
- /package/dist/{core/utilities/ScoringTracker.d.ts → builders/matching/inde.d.ts} +0 -0
- /package/dist/{ui/input/color → builders/ordering}/index.d.ts +0 -0
- /package/dist/{ui/input/letter → builders/tables}/index.d.ts +0 -0
- /package/dist/{interactions/list-recall/implementation/grader.d.ts → builders/text/index.d.ts} +0 -0
- /package/dist/interactions/{list-recall/implementation/parser.d.ts → exp/CategorizeTheWords.d.ts} +0 -0
- /package/dist/interactions/{list-recall/implementation/validator.d.ts → exp/DndFillBlanks.d.ts} +0 -0
- /package/dist/interactions/{shared/association-implementation/parser.d.ts → exp/TextTransformation.d.ts} +0 -0
- /package/dist/{shared/managers → managers}/SoundManager.d.ts +0 -0
- /package/dist/ui/{input/color/color-picker.d.ts → exp/color/index.d.ts} +0 -0
- /package/dist/ui/{input/letter/letter-picker.d.ts → exp/letter/index.d.ts} +0 -0
|
@@ -1,432 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, user-scalable=yes, viewport-fit=cover">
|
|
6
|
-
<meta name="mobile-web-app-capable" content="yes">
|
|
7
|
-
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
8
|
-
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
|
9
|
-
<meta name="theme-color" content="#f7f9fc">
|
|
10
|
-
<title>Temporal Sequencing (Bare) - CogniKit</title>
|
|
11
|
-
<style>
|
|
12
|
-
* {
|
|
13
|
-
margin: 0;
|
|
14
|
-
padding: 0;
|
|
15
|
-
box-sizing: border-box;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
html, body {
|
|
19
|
-
width: 100%;
|
|
20
|
-
height: 100%;
|
|
21
|
-
overflow: hidden;
|
|
22
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
23
|
-
-webkit-font-smoothing: antialiased;
|
|
24
|
-
-moz-osx-font-smoothing: grayscale;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
:root {
|
|
28
|
-
--edu-bg: 247 249 252;
|
|
29
|
-
--edu-card: 255 255 255;
|
|
30
|
-
--edu-ink: 31 41 55;
|
|
31
|
-
--edu-second-ink: 71 85 105;
|
|
32
|
-
--edu-third-ink: 100 116 139;
|
|
33
|
-
--edu-inverted-ink: 248 250 252;
|
|
34
|
-
--edu-success: 22 163 74;
|
|
35
|
-
--edu-error: 220 38 38;
|
|
36
|
-
--edu-warning: 255 222 33;
|
|
37
|
-
--edu-neutral: 14 165 233;
|
|
38
|
-
--edu-first-accent: 49 120 198;
|
|
39
|
-
--edu-second-accent: 245 158 11;
|
|
40
|
-
--edu-third-accent: 236 72 153;
|
|
41
|
-
--edu-border: 229 231 235;
|
|
42
|
-
--edu-muted: 243 244 246;
|
|
43
|
-
--edu-radius: 0.375rem;
|
|
44
|
-
--edu-shadow-color: 0 0 0;
|
|
45
|
-
--edu-pad: 1rem;
|
|
46
|
-
--edu-mar: 0;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
body {
|
|
50
|
-
background: rgb(var(--edu-bg));
|
|
51
|
-
display: flex;
|
|
52
|
-
flex-direction: column;
|
|
53
|
-
height: 100vh;
|
|
54
|
-
height: 100dvh;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
/* Header */
|
|
58
|
-
.header {
|
|
59
|
-
display: flex;
|
|
60
|
-
align-items: center;
|
|
61
|
-
justify-content: space-between;
|
|
62
|
-
padding: 1rem 1.5rem;
|
|
63
|
-
background: rgb(var(--edu-card));
|
|
64
|
-
border-bottom: 2px solid rgb(var(--edu-border));
|
|
65
|
-
box-shadow: 0 2px 8px rgba(var(--edu-shadow-color), 0.05);
|
|
66
|
-
flex-shrink: 0;
|
|
67
|
-
gap: 1rem;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
.header h1 {
|
|
71
|
-
font-size: 1.25rem;
|
|
72
|
-
color: rgb(var(--edu-ink));
|
|
73
|
-
font-weight: 700;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.header-controls {
|
|
77
|
-
display: flex;
|
|
78
|
-
gap: 0.75rem;
|
|
79
|
-
align-items: center;
|
|
80
|
-
flex-wrap: wrap;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.control-group {
|
|
84
|
-
display: flex;
|
|
85
|
-
gap: 0.5rem;
|
|
86
|
-
align-items: center;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
.control-group label {
|
|
90
|
-
font-size: 0.9rem;
|
|
91
|
-
font-weight: 600;
|
|
92
|
-
color: rgb(var(--edu-second-ink));
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.control-group select {
|
|
96
|
-
padding: 0.5rem 1rem;
|
|
97
|
-
border-radius: 8px;
|
|
98
|
-
border: 2px solid rgb(var(--edu-border));
|
|
99
|
-
background: rgb(var(--edu-bg));
|
|
100
|
-
color: rgb(var(--edu-ink));
|
|
101
|
-
font-size: 0.9rem;
|
|
102
|
-
cursor: pointer;
|
|
103
|
-
transition: all 0.2s;
|
|
104
|
-
min-height: 40px;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.control-group select:hover {
|
|
108
|
-
border-color: rgb(var(--edu-first-accent));
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.btn {
|
|
112
|
-
padding: 0.5rem 1rem;
|
|
113
|
-
border-radius: 8px;
|
|
114
|
-
border: 2px solid rgb(var(--edu-border));
|
|
115
|
-
background: rgb(var(--edu-card));
|
|
116
|
-
color: rgb(var(--edu-ink));
|
|
117
|
-
font-weight: 600;
|
|
118
|
-
font-size: 0.9rem;
|
|
119
|
-
cursor: pointer;
|
|
120
|
-
transition: all 0.2s;
|
|
121
|
-
min-height: 40px;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
.btn:hover {
|
|
125
|
-
border-color: rgb(var(--edu-first-accent));
|
|
126
|
-
background: rgba(var(--edu-first-accent), 0.1);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
.btn:active {
|
|
130
|
-
transform: scale(0.98);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
.btn-primary {
|
|
134
|
-
background: rgb(var(--edu-first-accent));
|
|
135
|
-
border-color: rgb(var(--edu-first-accent));
|
|
136
|
-
color: rgb(var(--edu-inverted-ink));
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.btn-primary:hover {
|
|
140
|
-
opacity: 0.9;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
/* Main viewport */
|
|
144
|
-
.main-viewport {
|
|
145
|
-
flex: 1;
|
|
146
|
-
display: flex;
|
|
147
|
-
align-items: center;
|
|
148
|
-
justify-content: center;
|
|
149
|
-
padding: 1.5rem;
|
|
150
|
-
overflow: hidden;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.interaction-container {
|
|
154
|
-
width: 100%;
|
|
155
|
-
height: 100%;
|
|
156
|
-
max-width: 1200px;
|
|
157
|
-
display: flex;
|
|
158
|
-
flex-direction: column;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
#interaction {
|
|
162
|
-
flex: 1;
|
|
163
|
-
width: 100%;
|
|
164
|
-
min-height: 0;
|
|
165
|
-
display: flex;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
temporal-sequencing,
|
|
169
|
-
temporal-sequencing-scalable,
|
|
170
|
-
rank-order-scalable,
|
|
171
|
-
rank-order {
|
|
172
|
-
width: 100%;
|
|
173
|
-
height: 100%;
|
|
174
|
-
display: block;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/* Status bar */
|
|
178
|
-
.status-bar {
|
|
179
|
-
padding: 0.75rem;
|
|
180
|
-
background: rgba(var(--edu-first-accent), 0.1);
|
|
181
|
-
border-radius: 8px;
|
|
182
|
-
margin-bottom: 1rem;
|
|
183
|
-
flex-shrink: 0;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.status-bar p {
|
|
187
|
-
color: rgb(var(--edu-ink));
|
|
188
|
-
font-size: 0.9rem;
|
|
189
|
-
margin: 0.25rem 0;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
.status-bar strong {
|
|
193
|
-
color: rgb(var(--edu-first-accent));
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/* Mobile styles */
|
|
197
|
-
@media (max-width: 768px) {
|
|
198
|
-
.header {
|
|
199
|
-
padding: 0.75rem 1rem;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.header h1 {
|
|
203
|
-
font-size: 1rem;
|
|
204
|
-
flex: 1;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.main-viewport {
|
|
208
|
-
padding: 1rem;
|
|
209
|
-
}
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
@media (max-width: 480px) {
|
|
213
|
-
.main-viewport {
|
|
214
|
-
padding: 0.5rem;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.header {
|
|
218
|
-
padding: 0.5rem;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
.control-group label {
|
|
222
|
-
display: none;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
</style>
|
|
226
|
-
</head>
|
|
227
|
-
<body>
|
|
228
|
-
<!-- Header -->
|
|
229
|
-
<div class="header">
|
|
230
|
-
<h1>Interactions (Bare)</h1>
|
|
231
|
-
<div class="header-controls">
|
|
232
|
-
<div class="control-group">
|
|
233
|
-
<label for="interaction-select">Interaction:</label>
|
|
234
|
-
<select id="interaction-select">
|
|
235
|
-
<option value="rank-order-scalable" selected>Rank Order (Scalable)</option>
|
|
236
|
-
<option value="simultaneous-association">Simultaneous Association</option>
|
|
237
|
-
<option value="sequential-classification">Sequential Classification</option>
|
|
238
|
-
<option value="open-classification">Open Classification</option>
|
|
239
|
-
<option value="mcq">MCQ</option>
|
|
240
|
-
</select>
|
|
241
|
-
</div>
|
|
242
|
-
<div class="control-group">
|
|
243
|
-
<label for="variant-select">Variant:</label>
|
|
244
|
-
<select id="variant-select">
|
|
245
|
-
<option value="elegant">Elegant</option>
|
|
246
|
-
<option value="playful">Playful</option>
|
|
247
|
-
<option value="outline">Outline</option>
|
|
248
|
-
<option value="letter">Letter</option>
|
|
249
|
-
<option value="sign" selected>Sign</option>
|
|
250
|
-
<option value="minimal">Minimal</option>
|
|
251
|
-
<option value="glass">Glass</option>
|
|
252
|
-
<option value="card">Card</option>
|
|
253
|
-
<option value="empty">Empty</option>
|
|
254
|
-
</select>
|
|
255
|
-
</div>
|
|
256
|
-
<button class="btn" id="hint-btn">Hint</button>
|
|
257
|
-
<button class="btn" id="reset-btn">Reset</button>
|
|
258
|
-
<button class="btn btn-primary" id="submit-btn">Submit</button>
|
|
259
|
-
</div>
|
|
260
|
-
</div>
|
|
261
|
-
|
|
262
|
-
<!-- Main Viewport -->
|
|
263
|
-
<div class="main-viewport">
|
|
264
|
-
<div class="interaction-container">
|
|
265
|
-
<div id="interaction"></div>
|
|
266
|
-
</div>
|
|
267
|
-
</div>
|
|
268
|
-
|
|
269
|
-
<script type="module">
|
|
270
|
-
import {
|
|
271
|
-
RankOrder,
|
|
272
|
-
SequentialClassification,
|
|
273
|
-
OpenClassification,
|
|
274
|
-
MCQ,
|
|
275
|
-
SimultaneousAssociation,
|
|
276
|
-
parseYamlAssets,
|
|
277
|
-
validateAndNormalizeAssets
|
|
278
|
-
} from './app.js';
|
|
279
|
-
|
|
280
|
-
// ==================== DATA ====================
|
|
281
|
-
const temporalData = {
|
|
282
|
-
type: 'seriation',
|
|
283
|
-
items: ['Egg', 'Caterpillar', 'Chrysalis', 'Butterfly', 'Reproduction', 'Death']
|
|
284
|
-
};
|
|
285
|
-
|
|
286
|
-
const associationData = {
|
|
287
|
-
type: 'association',
|
|
288
|
-
pairs: [
|
|
289
|
-
{ left: 'Sun', right: 'Day' },
|
|
290
|
-
{ left: 'Moon', right: 'Night' },
|
|
291
|
-
{ left: 'Snow', right: 'Winter' },
|
|
292
|
-
{ left: 'Beach', right: 'Summer' },
|
|
293
|
-
{ left: 'School', right: 'Study' },
|
|
294
|
-
{ left: 'Rain', right: 'Umbrella' }
|
|
295
|
-
],
|
|
296
|
-
distractors: ['Oven', 'library']
|
|
297
|
-
};
|
|
298
|
-
|
|
299
|
-
const classificationData = {
|
|
300
|
-
type: 'classification',
|
|
301
|
-
categories: [
|
|
302
|
-
{ label: 'Animals', items: ['Cat', 'Dog', 'Elephant'] },
|
|
303
|
-
{ label: 'Fruits', items: ['Apple', 'Banana', 'Orange'] },
|
|
304
|
-
{ label: 'Vehicles', items: ['Car', 'Bike', 'Plane'] }
|
|
305
|
-
],
|
|
306
|
-
distractors: ['Spoon', 'Cloud']
|
|
307
|
-
};
|
|
308
|
-
|
|
309
|
-
const mcqData = {
|
|
310
|
-
type: 'recognition',
|
|
311
|
-
data: [
|
|
312
|
-
{
|
|
313
|
-
question: 'Which of these is a mammal?',
|
|
314
|
-
options: ['Shark', 'Dolphin', 'Trout', 'Octopus'],
|
|
315
|
-
correctOptions: ['Dolphin']
|
|
316
|
-
},
|
|
317
|
-
{
|
|
318
|
-
question: 'Select all prime numbers below 10.',
|
|
319
|
-
options: ['2', '3', '4', '5', '6', '7', '8', '9'],
|
|
320
|
-
correctOptions: ['2', '3', '5', '7']
|
|
321
|
-
}
|
|
322
|
-
]
|
|
323
|
-
};
|
|
324
|
-
|
|
325
|
-
const temporalAssetsYaml = `
|
|
326
|
-
butterfly:
|
|
327
|
-
type: image
|
|
328
|
-
url: https://images.unsplash.com/photo-1533048324814-79b0a31982f1?q=80&w=768&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D
|
|
329
|
-
`;
|
|
330
|
-
|
|
331
|
-
const parsedAssets = parseYamlAssets(temporalAssetsYaml);
|
|
332
|
-
const normalizedAssets = validateAndNormalizeAssets(parsedAssets);
|
|
333
|
-
|
|
334
|
-
// ==================== CONFIG ====================
|
|
335
|
-
let currentVariant = 'outline';
|
|
336
|
-
|
|
337
|
-
const config = {
|
|
338
|
-
variant: currentVariant,
|
|
339
|
-
shuffle: true,
|
|
340
|
-
animationsEnabled: true,
|
|
341
|
-
soundEnabled: true
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
// ==================== DOM ELEMENTS ====================
|
|
345
|
-
const interactionElement = document.getElementById('interaction');
|
|
346
|
-
const interactionSelect = document.getElementById('interaction-select');
|
|
347
|
-
const variantSelect = document.getElementById('variant-select');
|
|
348
|
-
const hintBtn = document.getElementById('hint-btn');
|
|
349
|
-
const resetBtn = document.getElementById('reset-btn');
|
|
350
|
-
const submitBtn = document.getElementById('submit-btn');
|
|
351
|
-
|
|
352
|
-
// ==================== INITIALIZE INTERACTION ====================
|
|
353
|
-
let interaction;
|
|
354
|
-
|
|
355
|
-
function mountInteraction(type) {
|
|
356
|
-
interactionElement.innerHTML = '';
|
|
357
|
-
|
|
358
|
-
if (type === 'rank-order-scalable') {
|
|
359
|
-
interaction = new RankOrder(temporalData, config, normalizedAssets);
|
|
360
|
-
} else if (type === 'simultaneous-association') {
|
|
361
|
-
interaction = new SimultaneousAssociation(associationData, config, normalizedAssets, {
|
|
362
|
-
rightColumnLabel: 'Right Items',
|
|
363
|
-
leftColumnLabel: 'Left Items',
|
|
364
|
-
layoutDirection: 'vertical'
|
|
365
|
-
});
|
|
366
|
-
} else if (type === 'sequential-classification') {
|
|
367
|
-
interaction = new SequentialClassification(classificationData, config, normalizedAssets);
|
|
368
|
-
} else if (type === 'open-classification') {
|
|
369
|
-
interaction = new OpenClassification(classificationData, config, normalizedAssets);
|
|
370
|
-
} else if (type === 'mcq') {
|
|
371
|
-
interaction = new MCQ(mcqData, config, normalizedAssets);
|
|
372
|
-
} else {
|
|
373
|
-
interaction = new RankOrder(temporalData, config, normalizedAssets);
|
|
374
|
-
}
|
|
375
|
-
interactionElement.append(interaction);
|
|
376
|
-
bindInteractionEvents();
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// Variant change
|
|
380
|
-
variantSelect.addEventListener('change', (e) => {
|
|
381
|
-
currentVariant = e.target.value;
|
|
382
|
-
config.variant = currentVariant;
|
|
383
|
-
if (interaction?.onVariantChange) interaction.onVariantChange(currentVariant);
|
|
384
|
-
});
|
|
385
|
-
|
|
386
|
-
interactionSelect.addEventListener('change', (e) => {
|
|
387
|
-
mountInteraction(e.target.value);
|
|
388
|
-
});
|
|
389
|
-
|
|
390
|
-
// Hint button
|
|
391
|
-
hintBtn.addEventListener('click', () => {
|
|
392
|
-
interaction.onHint();
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
// Reset button
|
|
396
|
-
resetBtn.addEventListener('click', () => {
|
|
397
|
-
interaction.reset();
|
|
398
|
-
console.log('Interaction reset');
|
|
399
|
-
});
|
|
400
|
-
|
|
401
|
-
// Submit button
|
|
402
|
-
submitBtn.addEventListener('click', () => {
|
|
403
|
-
if (!interaction.isInteractionComplete()) {
|
|
404
|
-
alert('Please complete the interaction before submitting');
|
|
405
|
-
return;
|
|
406
|
-
}
|
|
407
|
-
interaction.submit();
|
|
408
|
-
});
|
|
409
|
-
|
|
410
|
-
// Listen to interaction events
|
|
411
|
-
function bindInteractionEvents() {
|
|
412
|
-
interaction.addEventListener('interaction:state-changed', (e) => {
|
|
413
|
-
console.log('State changed:', e.detail);
|
|
414
|
-
});
|
|
415
|
-
|
|
416
|
-
interaction.addEventListener('interaction:graded', (e) => {
|
|
417
|
-
console.log('Interaction graded:', e.detail);
|
|
418
|
-
const result = e.detail.result;
|
|
419
|
-
alert(`Score: ${result.score.toFixed(1)}%\nCorrect: ${result.correct}/${result.total}`);
|
|
420
|
-
});
|
|
421
|
-
|
|
422
|
-
interaction.addEventListener('interaction:hint-shown', (e) => {
|
|
423
|
-
console.log('Hint shown:', e.detail);
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
// Log initial state
|
|
428
|
-
mountInteraction('temporal-scalable');
|
|
429
|
-
console.log('Bare demo initialized');
|
|
430
|
-
</script>
|
|
431
|
-
</body>
|
|
432
|
-
</html>
|