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,495 +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, viewport-fit=cover">
|
|
6
|
-
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
7
|
-
<meta name="mobile-web-app-capable" content="yes">
|
|
8
|
-
<title>Live Chip Editor - CogniKit</title>
|
|
9
|
-
<link rel="stylesheet" href="./styles/global.css">
|
|
10
|
-
<style>
|
|
11
|
-
* {
|
|
12
|
-
margin: 0;
|
|
13
|
-
padding: 0;
|
|
14
|
-
box-sizing: border-box;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
:root {
|
|
18
|
-
--edu-bg: 247 249 252;
|
|
19
|
-
--edu-card: 255 255 255;
|
|
20
|
-
--edu-ink: 31 41 55;
|
|
21
|
-
--edu-second-ink: 71 85 105;
|
|
22
|
-
--edu-third-ink: 100 116 139;
|
|
23
|
-
--edu-inverted-ink: 248 250 252;
|
|
24
|
-
--edu-success: 22 163 74;
|
|
25
|
-
--edu-error: 220 38 38;
|
|
26
|
-
--edu-warning: 255 222 33;
|
|
27
|
-
--edu-neutral: 14 165 233;
|
|
28
|
-
--edu-first-accent: 173 198 255;
|
|
29
|
-
--edu-second-accent: 245 158 11;
|
|
30
|
-
--edu-third-accent: 236 72 153;
|
|
31
|
-
--edu-border: 229 231 235;
|
|
32
|
-
--edu-muted: 243 244 246;
|
|
33
|
-
--edu-radius: 0.375rem;
|
|
34
|
-
--edu-shadow-color: 0 0 0;
|
|
35
|
-
--edu-pad: 1rem;
|
|
36
|
-
--edu-mar: 0;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
body {
|
|
41
|
-
font-family: system-ui, -apple-system, sans-serif;
|
|
42
|
-
background: rgb(var(--edu-background));
|
|
43
|
-
color: rgb(var(--edu-ink));
|
|
44
|
-
min-height: 100dvh;
|
|
45
|
-
padding: 2rem;
|
|
46
|
-
padding-bottom: max(2rem, env(safe-area-inset-bottom));
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.container {
|
|
50
|
-
max-width: 1200px;
|
|
51
|
-
margin: 0 auto;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
h1 {
|
|
55
|
-
font-size: 2rem;
|
|
56
|
-
margin-bottom: 0.5rem;
|
|
57
|
-
color: rgb(var(--edu-first-accent));
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
.subtitle {
|
|
61
|
-
color: rgb(var(--edu-second-ink));
|
|
62
|
-
margin-bottom: 3rem;
|
|
63
|
-
font-size: 1rem;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.editor-layout {
|
|
67
|
-
display: grid;
|
|
68
|
-
grid-template-columns: 1fr 1fr;
|
|
69
|
-
gap: 2rem;
|
|
70
|
-
align-items: start;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.preview-section {
|
|
74
|
-
background: rgb(var(--edu-card));
|
|
75
|
-
border: 1px solid rgb(var(--edu-border));
|
|
76
|
-
border-radius: var(--edu-radius);
|
|
77
|
-
padding: 3rem;
|
|
78
|
-
display: flex;
|
|
79
|
-
flex-direction: column;
|
|
80
|
-
align-items: center;
|
|
81
|
-
justify-content: center;
|
|
82
|
-
min-height: 400px;
|
|
83
|
-
position: sticky;
|
|
84
|
-
top: 2rem;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
.preview-label {
|
|
88
|
-
font-size: 0.85rem;
|
|
89
|
-
color: rgb(var(--edu-second-ink));
|
|
90
|
-
margin-bottom: 2rem;
|
|
91
|
-
text-transform: uppercase;
|
|
92
|
-
letter-spacing: 1px;
|
|
93
|
-
font-weight: 600;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.controls-section {
|
|
97
|
-
background: rgb(var(--edu-card));
|
|
98
|
-
border: 1px solid rgb(var(--edu-border));
|
|
99
|
-
border-radius: var(--edu-radius);
|
|
100
|
-
padding: 2rem;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
.control-group {
|
|
104
|
-
margin-bottom: 1.5rem;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
.control-group label {
|
|
108
|
-
display: block;
|
|
109
|
-
font-size: 0.9rem;
|
|
110
|
-
font-weight: 600;
|
|
111
|
-
margin-bottom: 0.5rem;
|
|
112
|
-
color: rgb(var(--edu-ink));
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
.control-group input[type="text"],
|
|
116
|
-
.control-group input[type="color"],
|
|
117
|
-
.control-group select,
|
|
118
|
-
.control-group textarea {
|
|
119
|
-
width: 100%;
|
|
120
|
-
padding: 0.75rem;
|
|
121
|
-
border: 1px solid rgb(var(--edu-border));
|
|
122
|
-
border-radius: 6px;
|
|
123
|
-
background: rgb(var(--edu-background));
|
|
124
|
-
color: rgb(var(--edu-ink));
|
|
125
|
-
font-size: 0.95rem;
|
|
126
|
-
font-family: inherit;
|
|
127
|
-
min-height: 44px;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
.control-group textarea {
|
|
131
|
-
resize: vertical;
|
|
132
|
-
min-height: 80px;
|
|
133
|
-
font-family: 'Courier New', monospace;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.control-group input[type="color"] {
|
|
137
|
-
height: 50px;
|
|
138
|
-
cursor: pointer;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.checkbox-group {
|
|
142
|
-
display: flex;
|
|
143
|
-
align-items: center;
|
|
144
|
-
gap: 0.75rem;
|
|
145
|
-
padding: 0.5rem 0;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.checkbox-group input[type="checkbox"] {
|
|
149
|
-
width: 24px;
|
|
150
|
-
height: 24px;
|
|
151
|
-
cursor: pointer;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
.checkbox-group label {
|
|
155
|
-
margin: 0;
|
|
156
|
-
cursor: pointer;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
.code-preview {
|
|
160
|
-
margin-top: 2rem;
|
|
161
|
-
padding-top: 2rem;
|
|
162
|
-
border-top: 1px solid rgb(var(--edu-border));
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
.code-preview h3 {
|
|
166
|
-
font-size: 1rem;
|
|
167
|
-
margin-bottom: 1rem;
|
|
168
|
-
color: rgb(var(--edu-first-accent));
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
.code-block {
|
|
172
|
-
background: rgb(var(--edu-background));
|
|
173
|
-
border: 1px solid rgb(var(--edu-border));
|
|
174
|
-
border-radius: 6px;
|
|
175
|
-
padding: 1rem;
|
|
176
|
-
font-family: 'Courier New', monospace;
|
|
177
|
-
font-size: 0.85rem;
|
|
178
|
-
overflow-x: auto;
|
|
179
|
-
white-space: pre-wrap;
|
|
180
|
-
word-break: break-all;
|
|
181
|
-
color: rgb(var(--edu-second-ink));
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
.copy-button {
|
|
185
|
-
margin-top: 0.5rem;
|
|
186
|
-
padding: 0.5rem 1rem;
|
|
187
|
-
background: rgb(var(--edu-first-accent));
|
|
188
|
-
color: white;
|
|
189
|
-
border: none;
|
|
190
|
-
border-radius: 6px;
|
|
191
|
-
cursor: pointer;
|
|
192
|
-
font-size: 0.9rem;
|
|
193
|
-
min-height: 44px;
|
|
194
|
-
transition: all 0.2s;
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
.copy-button:hover {
|
|
198
|
-
opacity: 0.9;
|
|
199
|
-
transform: translateY(-1px);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.copy-button:active {
|
|
203
|
-
transform: translateY(0);
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/* Mobile responsive */
|
|
207
|
-
@media (max-width: 768px) {
|
|
208
|
-
body {
|
|
209
|
-
padding: 1rem;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
.editor-layout {
|
|
213
|
-
grid-template-columns: 1fr;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
.preview-section {
|
|
217
|
-
position: static;
|
|
218
|
-
padding: 2rem 1rem;
|
|
219
|
-
min-height: 300px;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
h1 {
|
|
223
|
-
font-size: 1.5rem;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
</style>
|
|
227
|
-
</head>
|
|
228
|
-
<body>
|
|
229
|
-
<div class="container">
|
|
230
|
-
<h1>Live Chip Editor</h1>
|
|
231
|
-
<p class="subtitle">Customize and preview your chip component in real-time</p>
|
|
232
|
-
|
|
233
|
-
<div class="editor-layout">
|
|
234
|
-
<!-- Preview Section -->
|
|
235
|
-
<div class="preview-section">
|
|
236
|
-
<div class="preview-label">Live Preview</div>
|
|
237
|
-
<edu-chip id="liveChip" variant="outline" prefix="A">Option Text</edu-chip>
|
|
238
|
-
</div>
|
|
239
|
-
|
|
240
|
-
<!-- Controls Section -->
|
|
241
|
-
<div class="controls-section">
|
|
242
|
-
<h2 style="margin-bottom: 1.5rem; font-size: 1.25rem;">Controls</h2>
|
|
243
|
-
|
|
244
|
-
<div class="control-group">
|
|
245
|
-
<label for="variantSelect">Variant</label>
|
|
246
|
-
<select id="variantSelect">
|
|
247
|
-
<option value="outline" selected>Outline</option>
|
|
248
|
-
<option value="elegant">Elegant</option>
|
|
249
|
-
<option value="playful">Playful</option>
|
|
250
|
-
<option value="empty">Empty</option>
|
|
251
|
-
<option value="letter">Letter</option>
|
|
252
|
-
<option value="minimal">Minimal</option>
|
|
253
|
-
<option value="glass">Glass</option>
|
|
254
|
-
<option value="card">Card</option>
|
|
255
|
-
<option value="sign">Sign</option>
|
|
256
|
-
</select>
|
|
257
|
-
</div>
|
|
258
|
-
|
|
259
|
-
<div class="control-group">
|
|
260
|
-
<label for="prefixInput">Prefix (optional)</label>
|
|
261
|
-
<input type="text" id="prefixInput" placeholder="e.g., A, 1, i" value="A">
|
|
262
|
-
</div>
|
|
263
|
-
|
|
264
|
-
<div class="control-group">
|
|
265
|
-
<label for="contentInput">Content (slot content)</label>
|
|
266
|
-
<textarea id="contentInput" placeholder="Enter chip content">Option Text</textarea>
|
|
267
|
-
</div>
|
|
268
|
-
|
|
269
|
-
<div class="control-group">
|
|
270
|
-
<label for="modalitySelect">Modality</label>
|
|
271
|
-
<select id="modalitySelect">
|
|
272
|
-
<option value="text" selected>Text</option>
|
|
273
|
-
<option value="image">Image</option>
|
|
274
|
-
<option value="audio">Audio</option>
|
|
275
|
-
<option value="video">Video</option>
|
|
276
|
-
<option value="tts">Text-to-Speech</option>
|
|
277
|
-
<option value="anchor">Anchor (File Upload)</option>
|
|
278
|
-
<!-- All the others require to set the inner HTML of the chip -->
|
|
279
|
-
<option value="complex">Complex</option>
|
|
280
|
-
</select>
|
|
281
|
-
</div>
|
|
282
|
-
|
|
283
|
-
<div class="control-group">
|
|
284
|
-
<label for="dataInput">Data (for modality)</label>
|
|
285
|
-
<textarea id="dataInput" placeholder="e.g., URL, text, etc."></textarea>
|
|
286
|
-
</div>
|
|
287
|
-
|
|
288
|
-
<div class="control-group">
|
|
289
|
-
<label for="displaySelect">Display Mode</label>
|
|
290
|
-
<select id="displaySelect">
|
|
291
|
-
<option value="in-line" selected>In-line</option>
|
|
292
|
-
<option value="dialog">Dialog</option>
|
|
293
|
-
</select>
|
|
294
|
-
</div>
|
|
295
|
-
|
|
296
|
-
<div class="control-group">
|
|
297
|
-
<label for="stateSelect">State (feedback)</label>
|
|
298
|
-
<select id="stateSelect">
|
|
299
|
-
<option value="" selected>None</option>
|
|
300
|
-
<option value="correct">Correct</option>
|
|
301
|
-
<option value="wrong">Wrong</option>
|
|
302
|
-
<option value="missed">Missed</option>
|
|
303
|
-
</select>
|
|
304
|
-
</div>
|
|
305
|
-
|
|
306
|
-
<div class="control-group">
|
|
307
|
-
<label for="colorInput">Custom Color</label>
|
|
308
|
-
<input type="color" id="colorInput" value="#6366f1">
|
|
309
|
-
<div class="control-group checkbox-group">
|
|
310
|
-
<input type="checkbox" id="coloredCheck">
|
|
311
|
-
<label for="coloredCheck">colored</label>
|
|
312
|
-
</div>
|
|
313
|
-
|
|
314
|
-
</div>
|
|
315
|
-
|
|
316
|
-
<div class="control-group">
|
|
317
|
-
<label for="valueInput">Value (data attribute)</label>
|
|
318
|
-
<input type="text" id="valueInput" placeholder="e.g., option-1">
|
|
319
|
-
</div>
|
|
320
|
-
|
|
321
|
-
<div class="control-group checkbox-group">
|
|
322
|
-
<input type="checkbox" id="selectedCheck">
|
|
323
|
-
<label for="selectedCheck">Selected</label>
|
|
324
|
-
</div>
|
|
325
|
-
|
|
326
|
-
<div class="control-group checkbox-group">
|
|
327
|
-
<input type="checkbox" id="disabledCheck">
|
|
328
|
-
<label for="disabledCheck">Disabled</label>
|
|
329
|
-
</div>
|
|
330
|
-
|
|
331
|
-
<div class="control-group checkbox-group">
|
|
332
|
-
<input type="checkbox" id="draggableCheck">
|
|
333
|
-
<label for="draggableCheck">Draggable</label>
|
|
334
|
-
</div>
|
|
335
|
-
|
|
336
|
-
<!-- Code Preview -->
|
|
337
|
-
<div class="code-preview">
|
|
338
|
-
<h3>Generated HTML</h3>
|
|
339
|
-
<div class="code-block" id="codePreview"></div>
|
|
340
|
-
<button class="copy-button" id="copyButton">Copy Code</button>
|
|
341
|
-
</div>
|
|
342
|
-
</div>
|
|
343
|
-
</div>
|
|
344
|
-
</div>
|
|
345
|
-
|
|
346
|
-
<script type="module">
|
|
347
|
-
import { EduChip } from '../app.js';
|
|
348
|
-
|
|
349
|
-
const chip = document.getElementById('liveChip');
|
|
350
|
-
const codePreview = document.getElementById('codePreview');
|
|
351
|
-
const copyButton = document.getElementById('copyButton');
|
|
352
|
-
|
|
353
|
-
// Control elements
|
|
354
|
-
const variantSelect = document.getElementById('variantSelect');
|
|
355
|
-
const prefixInput = document.getElementById('prefixInput');
|
|
356
|
-
const contentInput = document.getElementById('contentInput');
|
|
357
|
-
const modalitySelect = document.getElementById('modalitySelect');
|
|
358
|
-
const dataInput = document.getElementById('dataInput');
|
|
359
|
-
const displaySelect = document.getElementById('displaySelect');
|
|
360
|
-
const stateSelect = document.getElementById('stateSelect');
|
|
361
|
-
const colorInput = document.getElementById('colorInput');
|
|
362
|
-
const valueInput = document.getElementById('valueInput');
|
|
363
|
-
const selectedCheck = document.getElementById('selectedCheck');
|
|
364
|
-
const disabledCheck = document.getElementById('disabledCheck');
|
|
365
|
-
const draggableCheck = document.getElementById('draggableCheck');
|
|
366
|
-
const coloredCheck = document.getElementById('coloredCheck');
|
|
367
|
-
|
|
368
|
-
function updateChip() {
|
|
369
|
-
// Update variant
|
|
370
|
-
chip.variant = variantSelect.value;
|
|
371
|
-
|
|
372
|
-
// Update prefix
|
|
373
|
-
if (prefixInput.value.trim()) {
|
|
374
|
-
chip.prefix = prefixInput.value.trim();
|
|
375
|
-
} else {
|
|
376
|
-
chip.prefix = null;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// Update content
|
|
380
|
-
chip.innerHTML = contentInput.value;
|
|
381
|
-
|
|
382
|
-
// Update modality
|
|
383
|
-
chip.modality = modalitySelect.value;
|
|
384
|
-
|
|
385
|
-
// Update data
|
|
386
|
-
if (dataInput.value.trim()) {
|
|
387
|
-
chip.data = dataInput.value.trim();
|
|
388
|
-
} else {
|
|
389
|
-
chip.removeAttribute('data');
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
// Update display mode
|
|
393
|
-
chip.displayMode = displaySelect.value;
|
|
394
|
-
|
|
395
|
-
// Update state
|
|
396
|
-
if (stateSelect.value) {
|
|
397
|
-
chip.chipState = stateSelect.value;
|
|
398
|
-
} else {
|
|
399
|
-
chip.chipState = null;
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
// Update color
|
|
403
|
-
chip.color = colorInput.value;
|
|
404
|
-
chip.colored = coloredCheck.checked;
|
|
405
|
-
|
|
406
|
-
// Update value
|
|
407
|
-
if (valueInput.value.trim()) {
|
|
408
|
-
chip.value = valueInput.value.trim();
|
|
409
|
-
} else {
|
|
410
|
-
chip.removeAttribute('value');
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
// Update boolean attributes
|
|
414
|
-
chip.selected = selectedCheck.checked;
|
|
415
|
-
chip.disabled = disabledCheck.checked;
|
|
416
|
-
chip.draggable = draggableCheck.checked;
|
|
417
|
-
|
|
418
|
-
updateCodePreview();
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
function updateCodePreview() {
|
|
422
|
-
const attrs = [];
|
|
423
|
-
|
|
424
|
-
attrs.push(`variant="${chip.variant}"`);
|
|
425
|
-
|
|
426
|
-
if (chip.hasAttribute('prefix')) {
|
|
427
|
-
attrs.push(`prefix="${chip.prefix}"`);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
if (chip.modality !== 'text') {
|
|
431
|
-
attrs.push(`modality="${chip.modality}"`);
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
if (chip.hasAttribute('data')) {
|
|
435
|
-
attrs.push(`data="${chip.data}"`);
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
if (chip.displayMode !== 'in-line') {
|
|
439
|
-
attrs.push(`display="${chip.displayMode}"`);
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
if (chip.chipState) {
|
|
443
|
-
attrs.push(`state="${chip.chipState}"`);
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
attrs.push(`color="${chip.color}"`);
|
|
447
|
-
|
|
448
|
-
if (chip.hasAttribute('value')) {
|
|
449
|
-
attrs.push(`value="${chip.value}"`);
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
if (chip.selected) attrs.push('selected');
|
|
453
|
-
if (chip.disabled) attrs.push('disabled');
|
|
454
|
-
if (chip.draggable) attrs.push('draggable');
|
|
455
|
-
if (chip.colored) attrs.push('colored');
|
|
456
|
-
|
|
457
|
-
const content = chip.textContent || 'Option Text';
|
|
458
|
-
const code = `<edu-chip ${attrs.join(' ')}>\n ${content}\n</edu-chip>`;
|
|
459
|
-
|
|
460
|
-
codePreview.textContent = code;
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
// Event listeners
|
|
464
|
-
variantSelect.addEventListener('change', updateChip);
|
|
465
|
-
prefixInput.addEventListener('input', updateChip);
|
|
466
|
-
contentInput.addEventListener('input', updateChip);
|
|
467
|
-
modalitySelect.addEventListener('change', updateChip);
|
|
468
|
-
dataInput.addEventListener('input', updateChip);
|
|
469
|
-
displaySelect.addEventListener('change', updateChip);
|
|
470
|
-
stateSelect.addEventListener('change', updateChip);
|
|
471
|
-
colorInput.addEventListener('input', updateChip);
|
|
472
|
-
valueInput.addEventListener('input', updateChip);
|
|
473
|
-
selectedCheck.addEventListener('change', updateChip);
|
|
474
|
-
disabledCheck.addEventListener('change', updateChip);
|
|
475
|
-
draggableCheck.addEventListener('change', updateChip);
|
|
476
|
-
coloredCheck.addEventListener('change', updateChip);
|
|
477
|
-
|
|
478
|
-
// Copy button
|
|
479
|
-
copyButton.addEventListener('click', async () => {
|
|
480
|
-
try {
|
|
481
|
-
await navigator.clipboard.writeText(codePreview.textContent);
|
|
482
|
-
copyButton.textContent = 'Copied!';
|
|
483
|
-
setTimeout(() => {
|
|
484
|
-
copyButton.textContent = 'Copy Code';
|
|
485
|
-
}, 2000);
|
|
486
|
-
} catch (err) {
|
|
487
|
-
console.error('Failed to copy:', err);
|
|
488
|
-
}
|
|
489
|
-
});
|
|
490
|
-
|
|
491
|
-
// Initial update
|
|
492
|
-
updateChip();
|
|
493
|
-
</script>
|
|
494
|
-
</body>
|
|
495
|
-
</html>
|