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
package/public/tables-demo.html
DELETED
|
@@ -1,534 +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">
|
|
6
|
-
<title>CogniKit - Tables Showcase</title>
|
|
7
|
-
<style>
|
|
8
|
-
* {
|
|
9
|
-
margin: 0;
|
|
10
|
-
padding: 0;
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
html, body {
|
|
15
|
-
width: 100%;
|
|
16
|
-
height: 100%;
|
|
17
|
-
overflow: hidden;
|
|
18
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
19
|
-
-webkit-font-smoothing: antialiased;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
:root {
|
|
23
|
-
--edu-bg: 247 249 252;
|
|
24
|
-
--edu-card: 255 255 255;
|
|
25
|
-
--edu-ink: 31 41 55;
|
|
26
|
-
--edu-second-ink: 71 85 105;
|
|
27
|
-
--edu-third-ink: 100 116 139;
|
|
28
|
-
--edu-inverted-ink: 248 250 252;
|
|
29
|
-
--edu-success: 22 163 74;
|
|
30
|
-
--edu-error: 220 38 38;
|
|
31
|
-
--edu-warning: 255 222 33;
|
|
32
|
-
--edu-neutral: 14 165 233;
|
|
33
|
-
--edu-first-accent: 49 120 198;
|
|
34
|
-
--edu-second-accent: 245 158 11;
|
|
35
|
-
--edu-third-accent: 236 72 153;
|
|
36
|
-
--edu-border: 229 231 235;
|
|
37
|
-
--edu-muted: 243 244 246;
|
|
38
|
-
--edu-radius: 0.375rem;
|
|
39
|
-
--edu-shadow-color: 0 0 0;
|
|
40
|
-
--edu-pad: 1rem;
|
|
41
|
-
--edu-mar: 0;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
body {
|
|
45
|
-
background: rgb(var(--edu-bg));
|
|
46
|
-
display: flex;
|
|
47
|
-
flex-direction: column;
|
|
48
|
-
height: 100vh;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.header {
|
|
52
|
-
display: flex;
|
|
53
|
-
align-items: center;
|
|
54
|
-
justify-content: space-between;
|
|
55
|
-
padding: 1rem 1.5rem;
|
|
56
|
-
background: rgb(var(--edu-card));
|
|
57
|
-
border-bottom: 2px solid rgb(var(--edu-border));
|
|
58
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
|
|
59
|
-
flex-shrink: 0;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.header h1 {
|
|
63
|
-
font-size: 1.25rem;
|
|
64
|
-
color: rgb(var(--edu-ink));
|
|
65
|
-
font-weight: 700;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.header-info {
|
|
69
|
-
font-size: 0.9rem;
|
|
70
|
-
color: rgb(var(--edu-second-ink));
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.main-layout {
|
|
74
|
-
flex: 1;
|
|
75
|
-
display: flex;
|
|
76
|
-
overflow: hidden;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.sidebar {
|
|
80
|
-
width: 320px;
|
|
81
|
-
background: rgb(var(--edu-card));
|
|
82
|
-
border-right: 2px solid rgb(var(--edu-border));
|
|
83
|
-
overflow-y: auto;
|
|
84
|
-
padding: 1.5rem;
|
|
85
|
-
flex-shrink: 0;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
.sidebar h2 {
|
|
89
|
-
font-size: 1rem;
|
|
90
|
-
color: rgb(var(--edu-ink));
|
|
91
|
-
margin-bottom: 1rem;
|
|
92
|
-
font-weight: 600;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
.example-group {
|
|
96
|
-
margin-bottom: 2rem;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.example-group h3 {
|
|
100
|
-
font-size: 0.85rem;
|
|
101
|
-
color: rgb(var(--edu-second-ink));
|
|
102
|
-
text-transform: uppercase;
|
|
103
|
-
letter-spacing: 0.05em;
|
|
104
|
-
font-weight: 600;
|
|
105
|
-
margin-bottom: 0.75rem;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.example-btn {
|
|
109
|
-
width: 100%;
|
|
110
|
-
padding: 0.75rem 1rem;
|
|
111
|
-
margin-bottom: 0.5rem;
|
|
112
|
-
background: rgb(var(--edu-bg));
|
|
113
|
-
border: 2px solid rgb(var(--edu-border));
|
|
114
|
-
border-radius: 8px;
|
|
115
|
-
color: rgb(var(--edu-ink));
|
|
116
|
-
font-size: 0.9rem;
|
|
117
|
-
font-weight: 500;
|
|
118
|
-
cursor: pointer;
|
|
119
|
-
text-align: left;
|
|
120
|
-
transition: all 0.2s;
|
|
121
|
-
display: flex;
|
|
122
|
-
flex-direction: column;
|
|
123
|
-
gap: 0.25rem;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.example-btn:hover {
|
|
127
|
-
border-color: rgb(var(--edu-first-accent));
|
|
128
|
-
background: rgb(var(--edu-card));
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
.example-btn.active {
|
|
132
|
-
background: rgb(var(--edu-first-accent));
|
|
133
|
-
border-color: rgb(var(--edu-first-accent));
|
|
134
|
-
color: rgb(var(--edu-inverted-ink));
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
.example-btn-title {
|
|
138
|
-
font-weight: 600;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.example-btn-desc {
|
|
142
|
-
font-size: 0.75rem;
|
|
143
|
-
opacity: 0.8;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.viewport {
|
|
147
|
-
flex: 1;
|
|
148
|
-
display: flex;
|
|
149
|
-
align-items: center;
|
|
150
|
-
justify-content: center;
|
|
151
|
-
padding: 2rem;
|
|
152
|
-
overflow: hidden;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
.interaction-container {
|
|
156
|
-
width: 100%;
|
|
157
|
-
height: 100%;
|
|
158
|
-
max-width: 1000px;
|
|
159
|
-
display: flex;
|
|
160
|
-
flex-direction: column;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
edu-window {
|
|
164
|
-
width: 100%;
|
|
165
|
-
height: 100%;
|
|
166
|
-
display: block;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
.variant-controls {
|
|
170
|
-
margin-bottom: 1.5rem;
|
|
171
|
-
padding-bottom: 1.5rem;
|
|
172
|
-
border-bottom: 2px solid rgb(var(--edu-border));
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
.variant-controls label {
|
|
176
|
-
display: block;
|
|
177
|
-
font-size: 0.85rem;
|
|
178
|
-
font-weight: 600;
|
|
179
|
-
color: rgb(var(--edu-ink));
|
|
180
|
-
margin-bottom: 0.5rem;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.variant-controls select {
|
|
184
|
-
width: 100%;
|
|
185
|
-
padding: 0.5rem;
|
|
186
|
-
border: 2px solid rgb(var(--edu-border));
|
|
187
|
-
border-radius: 6px;
|
|
188
|
-
background: rgb(var(--edu-bg));
|
|
189
|
-
color: rgb(var(--edu-ink));
|
|
190
|
-
font-size: 0.9rem;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
@media (max-width: 768px) {
|
|
194
|
-
.main-layout {
|
|
195
|
-
flex-direction: column;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.sidebar {
|
|
199
|
-
width: 100%;
|
|
200
|
-
max-height: 40vh;
|
|
201
|
-
border-right: none;
|
|
202
|
-
border-bottom: 2px solid rgb(var(--edu-border));
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
.viewport {
|
|
206
|
-
padding: 1rem;
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
</style>
|
|
210
|
-
</head>
|
|
211
|
-
<body>
|
|
212
|
-
<div class="header">
|
|
213
|
-
<h1>📊 CogniKit Tables Showcase</h1>
|
|
214
|
-
<div class="header-info">All Table Types & Configurations</div>
|
|
215
|
-
</div>
|
|
216
|
-
|
|
217
|
-
<div class="main-layout">
|
|
218
|
-
<div class="sidebar">
|
|
219
|
-
<h2>Examples</h2>
|
|
220
|
-
|
|
221
|
-
<div class="variant-controls">
|
|
222
|
-
<label for="variant-select">Variant Style</label>
|
|
223
|
-
<select id="variant-select">
|
|
224
|
-
<option value="elegant">Elegant</option>
|
|
225
|
-
<option value="playful">Playful</option>
|
|
226
|
-
<option value="outline" selected>Outline</option>
|
|
227
|
-
<option value="letter">Letter</option>
|
|
228
|
-
<option value="sign">Sign</option>
|
|
229
|
-
<option value="minimal">Minimal</option>
|
|
230
|
-
<option value="glass">Glass</option>
|
|
231
|
-
<option value="card">Card</option>
|
|
232
|
-
<option value="empty">Empty</option>
|
|
233
|
-
</select>
|
|
234
|
-
</div>
|
|
235
|
-
|
|
236
|
-
<div class="example-group">
|
|
237
|
-
<h3>Classification Tables</h3>
|
|
238
|
-
<button class="example-btn" data-example="classification-basic">
|
|
239
|
-
<span class="example-btn-title">Programming Languages</span>
|
|
240
|
-
<span class="example-btn-desc">Multi-select • Checkbox mode</span>
|
|
241
|
-
</button>
|
|
242
|
-
</div>
|
|
243
|
-
|
|
244
|
-
<div class="example-group">
|
|
245
|
-
<h3>N-ary Choice Tables</h3>
|
|
246
|
-
<button class="example-btn" data-example="nary-basic">
|
|
247
|
-
<span class="example-btn-title">True/False Statements</span>
|
|
248
|
-
<span class="example-btn-desc">Single-select • Radio mode</span>
|
|
249
|
-
</button>
|
|
250
|
-
<button class="example-btn" data-example="nary-science">
|
|
251
|
-
<span class="example-btn-title">Element States</span>
|
|
252
|
-
<span class="example-btn-desc">Solid/Liquid/Gas classification</span>
|
|
253
|
-
</button>
|
|
254
|
-
</div>
|
|
255
|
-
|
|
256
|
-
<div class="example-group">
|
|
257
|
-
<h3>Adjacency Tables</h3>
|
|
258
|
-
<button class="example-btn" data-example="adjacency-numbers">
|
|
259
|
-
<span class="example-btn-title">Department Influence</span>
|
|
260
|
-
<span class="example-btn-desc">Number inputs • Symmetric matrix</span>
|
|
261
|
-
</button>
|
|
262
|
-
<button class="example-btn" data-example="adjacency-select">
|
|
263
|
-
<span class="example-btn-title">How People Think About Each Other</span>
|
|
264
|
-
<span class="example-btn-desc">Select • intelligent/naive/cool/boring</span>
|
|
265
|
-
</button>
|
|
266
|
-
<button class="example-btn" data-example="adjacency-text">
|
|
267
|
-
<span class="example-btn-title">Cross-Department Projects</span>
|
|
268
|
-
<span class="example-btn-desc">Text inputs • Free-form responses</span>
|
|
269
|
-
</button>
|
|
270
|
-
</div>
|
|
271
|
-
|
|
272
|
-
<div class="example-group">
|
|
273
|
-
<h3>Lookup Tables</h3>
|
|
274
|
-
<button class="example-btn" data-example="lookup-prices">
|
|
275
|
-
<span class="example-btn-title">Product Prices by Country</span>
|
|
276
|
-
<span class="example-btn-desc">Number inputs • Pricing data</span>
|
|
277
|
-
</button>
|
|
278
|
-
<button class="example-btn" data-example="lookup-ratings">
|
|
279
|
-
<span class="example-btn-title">Service Ratings</span>
|
|
280
|
-
<span class="example-btn-desc">Select dropdowns • Star ratings</span>
|
|
281
|
-
</button>
|
|
282
|
-
<button class="example-btn" data-example="lookup-schedule">
|
|
283
|
-
<span class="example-btn-title">Class Schedule</span>
|
|
284
|
-
<span class="example-btn-desc">Text inputs • Teacher assignments</span>
|
|
285
|
-
</button>
|
|
286
|
-
<button class="example-btn" data-example="lookup-partial">
|
|
287
|
-
<span class="example-btn-title">Product Availability</span>
|
|
288
|
-
<span class="example-btn-desc">Partial table • Disabled cells demo</span>
|
|
289
|
-
</button>
|
|
290
|
-
</div>
|
|
291
|
-
</div>
|
|
292
|
-
|
|
293
|
-
<div class="viewport">
|
|
294
|
-
<div class="interaction-container">
|
|
295
|
-
<edu-window id="interaction-viewport"></edu-window>
|
|
296
|
-
</div>
|
|
297
|
-
</div>
|
|
298
|
-
</div>
|
|
299
|
-
|
|
300
|
-
<script type="module">
|
|
301
|
-
import {
|
|
302
|
-
ClassificationMatrix,
|
|
303
|
-
NaryChoiceTable,
|
|
304
|
-
AdjacencyTable,
|
|
305
|
-
LookupTable,
|
|
306
|
-
InteractionsBaseShell,
|
|
307
|
-
adjacencyTableDataParser,
|
|
308
|
-
lookupTableDataParser,
|
|
309
|
-
basicTableDataParser
|
|
310
|
-
} from './app.js';
|
|
311
|
-
|
|
312
|
-
const viewport = document.getElementById('interaction-viewport');
|
|
313
|
-
const variantSelect = document.getElementById('variant-select');
|
|
314
|
-
let currentInteraction = null;
|
|
315
|
-
let currentVariant = 'outline';
|
|
316
|
-
|
|
317
|
-
// Example definitions
|
|
318
|
-
const examples = {
|
|
319
|
-
'classification-basic': {
|
|
320
|
-
type: 'ClassificationMatrix',
|
|
321
|
-
name: 'Programming Languages',
|
|
322
|
-
code: `
|
|
323
|
-
INTERPRETED = Python | JavaScript | Ruby;
|
|
324
|
-
COMPILED = C++ | Rust | Go;
|
|
325
|
-
STRONGLY_TYPED = Python | C++ | Rust | Go;
|
|
326
|
-
WEAKLY_TYPED = JavaScript | Ruby;
|
|
327
|
-
`.trim(),
|
|
328
|
-
config: { variant: 'outline' }
|
|
329
|
-
},
|
|
330
|
-
|
|
331
|
-
'nary-basic': {
|
|
332
|
-
type: 'NaryChoiceTable',
|
|
333
|
-
name: 'True/False Statements',
|
|
334
|
-
code: `
|
|
335
|
-
TRUE = Water is blue | An active volcano is hot | Paris is in France;
|
|
336
|
-
FALSE = MJ was a piano player | Africa is above Europe | A chef is someone who writes poems;
|
|
337
|
-
`.trim(),
|
|
338
|
-
config: { variant: 'outline' }
|
|
339
|
-
},
|
|
340
|
-
|
|
341
|
-
'nary-science': {
|
|
342
|
-
type: 'NaryChoiceTable',
|
|
343
|
-
name: 'Element States',
|
|
344
|
-
code: `
|
|
345
|
-
SOLID = Ice | Iron | Diamond;
|
|
346
|
-
LIQUID = Water | Mercury | Oil;
|
|
347
|
-
GAS = Oxygen | Helium | Steam;
|
|
348
|
-
`.trim(),
|
|
349
|
-
config: { variant: 'outline' }
|
|
350
|
-
},
|
|
351
|
-
|
|
352
|
-
'adjacency-numbers': {
|
|
353
|
-
type: 'AdjacencyTable',
|
|
354
|
-
name: 'Department Influence (1-5 scale)',
|
|
355
|
-
code: `
|
|
356
|
-
marketing = 4 | 2 | 3;
|
|
357
|
-
it = 3 | 5 | 4;
|
|
358
|
-
finance = 2 | 3 | 4;
|
|
359
|
-
hr = 4 | 3 | 2;
|
|
360
|
-
`.trim(),
|
|
361
|
-
config: { variant: 'outline', cellKind: 'number' }
|
|
362
|
-
},
|
|
363
|
-
|
|
364
|
-
'adjacency-select': {
|
|
365
|
-
type: 'AdjacencyTable',
|
|
366
|
-
name: 'How People Think About Each Other',
|
|
367
|
-
code: `
|
|
368
|
-
alice = intelligent | cool | naive;
|
|
369
|
-
bob = cool | boring | intelligent;
|
|
370
|
-
charlie = naive | intelligent | cool;
|
|
371
|
-
diana = boring | naive | intelligent;
|
|
372
|
-
`.trim(),
|
|
373
|
-
config: { variant: 'outline', cellKind: 'select' }
|
|
374
|
-
},
|
|
375
|
-
|
|
376
|
-
'adjacency-text': {
|
|
377
|
-
type: 'AdjacencyTable',
|
|
378
|
-
name: 'Cross-Department Projects',
|
|
379
|
-
code: `
|
|
380
|
-
sales = Customer Portal | Analytics Dashboard;
|
|
381
|
-
engineering = Product Launch | Data Pipeline;
|
|
382
|
-
marketing = Brand Redesign | SEO Campaign;
|
|
383
|
-
`.trim(),
|
|
384
|
-
config: { variant: 'outline', cellKind: 'text' }
|
|
385
|
-
},
|
|
386
|
-
|
|
387
|
-
'lookup-prices': {
|
|
388
|
-
type: 'LookupTable',
|
|
389
|
-
name: 'Product Prices by Country (USD)',
|
|
390
|
-
code: `
|
|
391
|
-
= Japan | USA | France | Germany;
|
|
392
|
-
Milk = 2 | 4 | 3 | 2.5;
|
|
393
|
-
Sugar = 1 | 1.5 | 2 | 1.8;
|
|
394
|
-
Eggs = 1 | 3 | 1.5 | 2;
|
|
395
|
-
Bread = 1.5 | 2.5 | 2 | 1.8;
|
|
396
|
-
`.trim(),
|
|
397
|
-
config: { variant: 'outline', cellKind: 'number' }
|
|
398
|
-
},
|
|
399
|
-
|
|
400
|
-
'lookup-ratings': {
|
|
401
|
-
type: 'LookupTable',
|
|
402
|
-
name: 'Service Ratings (1-5 stars)',
|
|
403
|
-
code: `
|
|
404
|
-
= Speed | Quality | Support | Value;
|
|
405
|
-
Restaurant_A = 5 | 4 | 3 | 5;
|
|
406
|
-
Restaurant_B = 3 | 5 | 4 | 3;
|
|
407
|
-
Restaurant_C = 4 | 3 | 5 | 4;
|
|
408
|
-
`.trim(),
|
|
409
|
-
config: { variant: 'outline', cellKind: 'select' }
|
|
410
|
-
},
|
|
411
|
-
|
|
412
|
-
'lookup-schedule': {
|
|
413
|
-
type: 'LookupTable',
|
|
414
|
-
name: 'Class Schedule',
|
|
415
|
-
code: `
|
|
416
|
-
= Monday | Tuesday | Wednesday | Thursday | Friday;
|
|
417
|
-
Math = Mr_Smith | Ms_Jones | Mr_Smith | Ms_Jones | Mr_Smith;
|
|
418
|
-
Science = Dr_Brown | Dr_Brown | Ms_White | Ms_White | Dr_Brown;
|
|
419
|
-
English = Ms_Davis | Mr_Wilson | Ms_Davis | Mr_Wilson | Ms_Davis;
|
|
420
|
-
`.trim(),
|
|
421
|
-
config: { variant: 'outline', cellKind: 'text' }
|
|
422
|
-
},
|
|
423
|
-
|
|
424
|
-
'lookup-partial': {
|
|
425
|
-
type: 'LookupTable',
|
|
426
|
-
name: 'Product Availability by Region',
|
|
427
|
-
code: `
|
|
428
|
-
= North_America | Europe | Asia | South_America;
|
|
429
|
-
Laptop = 1299 | 1399 | - | 1499;
|
|
430
|
-
Smartphone = 899 | 999 | 799 | -;
|
|
431
|
-
Tablet = - | 599 | 499 | 699;
|
|
432
|
-
Smartwatch = 399 | - | 349 | 399;
|
|
433
|
-
`.trim(),
|
|
434
|
-
config: { variant: 'outline', cellKind: 'number' }
|
|
435
|
-
}
|
|
436
|
-
};
|
|
437
|
-
|
|
438
|
-
function parseAndCreateInteraction(example) {
|
|
439
|
-
const { type, code, config } = example;
|
|
440
|
-
config.variant = currentVariant;
|
|
441
|
-
|
|
442
|
-
let data, interaction;
|
|
443
|
-
|
|
444
|
-
switch (type) {
|
|
445
|
-
case 'ClassificationMatrix': {
|
|
446
|
-
const parsed = basicTableDataParser(code);
|
|
447
|
-
if (parsed.errors) {
|
|
448
|
-
console.error('Parse errors:', parsed.errors);
|
|
449
|
-
throw new Error('Failed to parse classification data');
|
|
450
|
-
}
|
|
451
|
-
interaction = new ClassificationMatrix(parsed.data, config);
|
|
452
|
-
break;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
case 'NaryChoiceTable': {
|
|
456
|
-
const parsed = basicTableDataParser(code);
|
|
457
|
-
if (parsed.errors) {
|
|
458
|
-
console.error('Parse errors:', parsed.errors);
|
|
459
|
-
throw new Error('Failed to parse n-ary data');
|
|
460
|
-
}
|
|
461
|
-
interaction = new NaryChoiceTable(parsed.data, config);
|
|
462
|
-
break;
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
case 'AdjacencyTable': {
|
|
466
|
-
const parsed = adjacencyTableDataParser(code);
|
|
467
|
-
if (parsed.errors) {
|
|
468
|
-
console.error('Parse errors:', parsed.errors);
|
|
469
|
-
throw new Error('Failed to parse adjacency data');
|
|
470
|
-
}
|
|
471
|
-
interaction = new AdjacencyTable(parsed.data, config);
|
|
472
|
-
break;
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
case 'LookupTable': {
|
|
476
|
-
const parsed = lookupTableDataParser(code);
|
|
477
|
-
if (parsed.errors) {
|
|
478
|
-
console.error('Parse errors:', parsed.errors);
|
|
479
|
-
throw new Error('Failed to parse lookup data');
|
|
480
|
-
}
|
|
481
|
-
interaction = new LookupTable(parsed.data, config);
|
|
482
|
-
break;
|
|
483
|
-
}
|
|
484
|
-
|
|
485
|
-
default:
|
|
486
|
-
throw new Error('Unknown table type: ' + type);
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
return interaction;
|
|
490
|
-
}
|
|
491
|
-
|
|
492
|
-
function loadExample(exampleKey) {
|
|
493
|
-
try {
|
|
494
|
-
const example = examples[exampleKey];
|
|
495
|
-
if (!example) throw new Error('Example not found: ' + exampleKey);
|
|
496
|
-
|
|
497
|
-
const interaction = parseAndCreateInteraction(example);
|
|
498
|
-
viewport.setInteraction(interaction);
|
|
499
|
-
currentInteraction = interaction;
|
|
500
|
-
|
|
501
|
-
// Update active button
|
|
502
|
-
document.querySelectorAll('.example-btn').forEach(btn => {
|
|
503
|
-
btn.classList.toggle('active', btn.dataset.example === exampleKey);
|
|
504
|
-
});
|
|
505
|
-
|
|
506
|
-
console.log(`✅ Loaded: ${example.name} (${example.type})`);
|
|
507
|
-
} catch (error) {
|
|
508
|
-
console.error('❌ Error loading example:', error);
|
|
509
|
-
alert('Error: ' + error.message);
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
// Event listeners
|
|
514
|
-
document.querySelectorAll('.example-btn').forEach(btn => {
|
|
515
|
-
btn.addEventListener('click', () => {
|
|
516
|
-
loadExample(btn.dataset.example);
|
|
517
|
-
});
|
|
518
|
-
});
|
|
519
|
-
|
|
520
|
-
variantSelect.addEventListener('change', (e) => {
|
|
521
|
-
currentVariant = e.target.value;
|
|
522
|
-
if (currentInteraction) {
|
|
523
|
-
currentInteraction.onVariantChange(currentVariant);
|
|
524
|
-
viewport.setAttribute('variant', currentVariant);
|
|
525
|
-
}
|
|
526
|
-
});
|
|
527
|
-
|
|
528
|
-
// Load first example on page load
|
|
529
|
-
window.addEventListener('DOMContentLoaded', () => {
|
|
530
|
-
loadExample('classification-basic');
|
|
531
|
-
});
|
|
532
|
-
</script>
|
|
533
|
-
</body>
|
|
534
|
-
</html>
|