cognikit 0.1.0 → 0.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/dist/client.d.ts +10 -0
- package/dist/client.js +4601 -0
- package/dist/client.js.map +7 -0
- package/dist/index.d.ts +9 -4
- package/dist/index.js +2075 -1992
- package/dist/index.js.map +4 -4
- package/dist/interactions/categorize-the-words/static.d.ts +1 -1
- package/dist/interactions/fill-blanks/static.d.ts +1 -1
- package/dist/interactions/mark-the-words/static.d.ts +1 -1
- package/dist/interactions/text-transformation/static.d.ts +1 -1
- package/dist/shared/config.d.ts +18 -0
- package/dist/shared/icons.d.ts +3 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/managers/SoundManager.d.ts +1 -2
- package/dist/shared/ssr.d.ts +1 -0
- package/package.json +10 -5
- package/public/app.js +13713 -0
- package/public/app.js.map +7 -0
- package/public/assets/audio/failure.mp3 +0 -0
- package/public/assets/audio/flip.mp3 +0 -0
- package/public/assets/audio/low-time.mp3 +0 -0
- package/public/assets/audio/plus.mp3 +0 -0
- package/public/assets/audio/pop.mp3 +0 -0
- package/public/assets/audio/start.mp3 +0 -0
- package/public/assets/audio/success.mp3 +0 -0
- package/public/assets/eduguiders-logo.png +0 -0
- package/public/assets/icons/audio.svg +83 -0
- package/public/assets/icons/data.svg +2 -0
- package/public/assets/icons/down.svg +2 -0
- package/public/assets/icons/drag-horizontal-svgrepo-com.svg +4 -0
- package/public/assets/icons/drag-vertical-svgrepo-com.svg +4 -0
- package/public/assets/icons/error.svg +2 -0
- package/public/assets/icons/eye-disabled.svg +8 -0
- package/public/assets/icons/eye.svg +5 -0
- package/public/assets/icons/image-picture-svgrepo-com-dark.svg +17 -0
- package/public/assets/icons/image.svg +17 -0
- package/public/assets/icons/link.svg +5 -0
- package/public/assets/icons/repeat.svg +7 -0
- package/public/assets/icons/star.svg +4 -0
- package/public/assets/icons/up.svg +2 -0
- package/public/assets/icons/video.svg +6 -0
- package/public/assets/images/pointing-hand.svg +1 -0
- package/public/examples/chip.html +495 -0
- package/public/index.html +754 -0
- package/public/scalable-bare.html +432 -0
- package/public/tables-demo.html +534 -0
- package/public/text-interactions-demo.html +604 -0
|
@@ -0,0 +1,432 @@
|
|
|
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>
|