@eliceio/cdk-cli 0.1.0-alpha.5 → 0.1.0-alpha.7
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/README.md +110 -84
- package/es/cli.js +7 -22
- package/es/commands/build/index.d.ts +5 -3
- package/es/commands/build/index.js +20 -11
- package/es/commands/create/scaffold.d.ts +2 -0
- package/es/commands/create/scaffold.js +15 -1
- package/es/commands/dev/index.d.ts +1 -1
- package/es/commands/dev/index.js +1 -1
- package/es/commands/doctor/index.d.ts +1 -1
- package/es/commands/doctor/index.js +5 -6
- package/es/commands/setup/index.d.ts +4 -7
- package/es/commands/setup/index.js +41 -70
- package/es/commands/uninstall/index.d.ts +9 -8
- package/es/commands/uninstall/index.js +41 -47
- package/es/commands/update/index.d.ts +4 -2
- package/es/commands/update/index.js +27 -18
- package/es/core/collect.js +1 -1
- package/es/core/config.d.ts +1 -1
- package/es/core/config.js +3 -3
- package/es/{commands/mcp/index.d.ts → core/mcp.d.ts} +11 -18
- package/es/{commands/mcp/index.js → core/mcp.js} +29 -51
- package/es/core/minify.js +31 -2
- package/es/core/prepare.js +1 -1
- package/es/core/sandbox.d.ts +25 -0
- package/es/core/sandbox.js +110 -8
- package/es/{commands/skill/index.d.ts → core/skills.d.ts} +1 -17
- package/es/{commands/skill/index.js → core/skills.js} +6 -22
- package/es/dev/grading.d.ts +1 -1
- package/es/dev/grading.js +1 -1
- package/es/dev/host-page.js +20 -5
- package/es/dev/inject.d.ts +6 -0
- package/es/dev/inject.js +16 -1
- package/es/dev/mock-api.js +0 -16
- package/es/dev/server.d.ts +4 -2
- package/es/dev/server.js +11 -3
- package/es/rules/check.js +71 -8
- package/es/rules/csp.d.ts +26 -0
- package/es/rules/csp.js +42 -0
- package/es/rules/index.d.ts +2 -1
- package/es/rules/index.js +2 -1
- package/es/rules/refs.d.ts +12 -2
- package/es/rules/refs.js +50 -18
- package/es/rules/types.d.ts +5 -0
- package/es/rules/unused.d.ts +2 -0
- package/es/rules/unused.js +4 -3
- package/es/rules.json.js +2 -2
- package/package.json +2 -2
- package/rules.json +37 -15
- package/skills/_shared/always.md +2 -1
- package/skills/elice-content-create/SKILL.md +2 -1
- package/skills/elice-content-guide/SKILL.md +1 -1
- package/skills/elice-content-guide/topics/01-check-the-environment.md +2 -2
- package/skills/elice-content-guide/topics/02-design-the-material.md +2 -0
- package/skills/elice-content-guide/topics/03-create-the-project.md +2 -2
- package/skills/elice-content-guide/topics/04-rules.md +3 -1
- package/skills/elice-content-guide/topics/05-screen-code.md +44 -13
- package/skills/elice-content-guide/topics/07-move-existing-html.md +1 -1
- package/skills/elice-content-guide/topics/08-fix-check-errors.md +21 -18
- package/skills/elice-content-guide/topics/09-check.md +1 -0
- package/skills/elice-content-guide/topics/10-build.md +1 -1
- package/skills/elice-content-guide/topics/12-upload-with-the-material-mcp.md +2 -2
- package/skills/elice-content-migrate/SKILL.md +4 -3
- package/skills/elice-content-publish/SKILL.md +1 -1
- package/templates/_shared/lib/cdk-mock.js +3 -3
- package/templates/_shared/lib/elice-content-editor.d.ts +80 -0
- package/templates/_shared/lib/elice-content-editor.js +1062 -0
- package/templates/_shared/lib/elice-content.css +354 -1
- package/templates/_shared/lib/elice-content.js +10 -3
- package/templates/blank/README.md +27 -2
- package/templates/blank/commentary.txt +5 -0
- package/templates/blank/screens/edit.js +38 -17
- package/templates/blank/screens/instructor.js +20 -8
- package/templates/blank/screens/learn.js +151 -13
- package/templates/blank/styles.css +171 -0
- package/templates/blank/template.json +2 -2
- package/templates/quiz/README.md +2 -2
- package/templates/quiz/core/editor.d.ts +2 -0
- package/templates/quiz/core/editor.js +16 -6
- package/templates/quiz/core/model.js +1 -1
- package/templates/quiz/screens/edit.js +117 -24
- package/templates/quiz/styles.css +86 -12
- package/templates/quiz/template.json +1 -1
- package/templates/quiz/ui/templates/edit.d.ts +4 -0
- package/templates/quiz/ui/templates/edit.js +46 -10
- package/templates/quiz/ui/templates/page.js +1 -2
- package/templates/quiz/ui/templates/text.js +10 -7
- package/templates/quiz/ui/texts.js +13 -9
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
checkAnswerKey,
|
|
13
13
|
convertType,
|
|
14
14
|
INLINE_ANSWER_TYPES,
|
|
15
|
+
isAnswered,
|
|
15
16
|
joinAnswers,
|
|
16
17
|
LIMITS,
|
|
17
18
|
newQuestion,
|
|
@@ -42,6 +43,14 @@ const parsed = savedKey ? parseAnswerKey(draft.questions, savedKey) : {};
|
|
|
42
43
|
/** @type {Record<string, unknown>} */
|
|
43
44
|
const answers = parsed ?? {};
|
|
44
45
|
const unreadable = Boolean(savedKey) && parsed === null;
|
|
46
|
+
// 순서 맞추기 정답 칸 (문항 id → 화면). 끌어 놓기는 window에서 끝나 이벤트로 읽으면 마지막 놓기를 놓치므로,
|
|
47
|
+
// 값이 필요할 때(저장 · 다시 그리기 · 보기 삭제) 칸에서 바로 읽는다
|
|
48
|
+
const answerViews = new Map();
|
|
49
|
+
const readAnswerViews = () => {
|
|
50
|
+
for (const [id, view] of answerViews) answers[id] = view.getValue();
|
|
51
|
+
};
|
|
52
|
+
// 유형을 바꿔 정답을 다시 골라야 하는 문항 id (다음 저장까지 카드 위에 알림)
|
|
53
|
+
const retyped = new Set();
|
|
45
54
|
|
|
46
55
|
const form = createEditor({
|
|
47
56
|
rerender: render,
|
|
@@ -77,10 +86,7 @@ function answerField(q) {
|
|
|
77
86
|
}
|
|
78
87
|
const view = renderAnswerBody(q, { templates: quizTemplates });
|
|
79
88
|
if (answers[q.id] !== undefined) view.setValue(answers[q.id]);
|
|
80
|
-
|
|
81
|
-
const read = () => queueMicrotask(() => (answers[q.id] = view.getValue()));
|
|
82
|
-
for (const type of ['input', 'change', 'click', 'pointerup'])
|
|
83
|
-
view.el.addEventListener(type, read);
|
|
89
|
+
answerViews.set(q.id, view);
|
|
84
90
|
return form.ui.section({ label: a.label, hint: a.hint[q.type], body: view.el });
|
|
85
91
|
}
|
|
86
92
|
|
|
@@ -104,17 +110,40 @@ function inlineAnswer(q) {
|
|
|
104
110
|
function optionsOpts(q) {
|
|
105
111
|
const inline = INLINE_ANSWER_TYPES.includes(q.type);
|
|
106
112
|
return {
|
|
113
|
+
// 순서 맞추기 칸 수를 따로 정하지 않았으면(보기 수와 같음) 보기를 더할 때 같이 늘린다
|
|
114
|
+
onAdd: () => {
|
|
115
|
+
if (q.type === 'order' && q.slots === q.options.length - 1) q.slots = q.options.length;
|
|
116
|
+
},
|
|
107
117
|
onDelete: () => {
|
|
118
|
+
readAnswerViews();
|
|
108
119
|
if (q.type === 'order') q.slots = Math.min(q.slots, q.options.length);
|
|
109
120
|
if (answers[q.id] !== undefined) answers[q.id] = pruneAnswer(q, answers[q.id]);
|
|
121
|
+
// 다시 그릴 때 지우기 전 칸 값으로 덮지 않게
|
|
122
|
+
answerViews.delete(q.id);
|
|
110
123
|
},
|
|
124
|
+
// 순서 맞추기: 보기 글을 고치면 정답 칸의 보기 이름도 바로 바꾼다 (다시 그리면 입력 중 초점을 잃음)
|
|
125
|
+
onInput:
|
|
126
|
+
q.type === 'order'
|
|
127
|
+
? o => {
|
|
128
|
+
const view = answerViews.get(q.id);
|
|
129
|
+
for (const chip of view?.el.querySelectorAll(`[data-role="chip"][data-option="${o.id}"]`) ?? [])
|
|
130
|
+
chip.textContent = o.text;
|
|
131
|
+
}
|
|
132
|
+
: undefined,
|
|
111
133
|
answer: inline ? inlineAnswer(q) : undefined,
|
|
112
134
|
};
|
|
113
135
|
}
|
|
114
136
|
|
|
137
|
+
/** 정답을 고르는 묶음 (저장하지 못한 정답 문제를 여기에 표시) */
|
|
138
|
+
const answerArea = section => {
|
|
139
|
+
section.dataset.role = 'answers';
|
|
140
|
+
return section;
|
|
141
|
+
};
|
|
142
|
+
|
|
115
143
|
/** 문항 카드 안의 칸들. 유형마다 보이는 칸이 다르다 */
|
|
116
144
|
function questionFields(q, i) {
|
|
117
145
|
const body = [
|
|
146
|
+
retyped.has(q.id) && templates.typeWarning({ text: a.typeChanged }),
|
|
118
147
|
form.field(t.title, q.title, v => (q.title = v), { required: true, max: LIMITS.titleMax }),
|
|
119
148
|
// 문항 설명: 미리보기 없는 여러 줄 칸. 새 문항에는 키가 없고, 적으면 생긴다
|
|
120
149
|
form.field(t.description, q.description ?? '', v => (q.description = v), {
|
|
@@ -124,13 +153,12 @@ function questionFields(q, i) {
|
|
|
124
153
|
];
|
|
125
154
|
if (q.type === 'select_one' || q.type === 'select_multiple' || q.type === 'order') {
|
|
126
155
|
const options = form.itemList('option', q.options, `${i}o`, optionsOpts(q));
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
);
|
|
156
|
+
const section = form.ui.section({
|
|
157
|
+
label: t.options,
|
|
158
|
+
hint: q.type === 'order' ? undefined : a.hint[q.type],
|
|
159
|
+
body: options,
|
|
160
|
+
});
|
|
161
|
+
body.push(q.type === 'order' ? section : answerArea(section));
|
|
134
162
|
}
|
|
135
163
|
if (q.type === 'order') {
|
|
136
164
|
const slots = form.numberField(
|
|
@@ -146,7 +174,7 @@ function questionFields(q, i) {
|
|
|
146
174
|
}
|
|
147
175
|
if (q.type === 'group') {
|
|
148
176
|
const groups = form.itemList('group', q.groups, `${i}g`, {
|
|
149
|
-
// 지운 그룹에 넣은 보기는 "그룹 없음"으로
|
|
177
|
+
// 지운 그룹에 넣은 보기는 "오답 (그룹 없음)"으로
|
|
150
178
|
onDelete: () => {
|
|
151
179
|
if (answers[q.id] !== undefined) answers[q.id] = pruneAnswer(q, answers[q.id]);
|
|
152
180
|
},
|
|
@@ -158,11 +186,13 @@ function questionFields(q, i) {
|
|
|
158
186
|
});
|
|
159
187
|
body.push(
|
|
160
188
|
form.ui.section({ label: t.groups, body: groups }),
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
189
|
+
answerArea(
|
|
190
|
+
form.ui.section({
|
|
191
|
+
label: t.options,
|
|
192
|
+
hint: a.hint.group,
|
|
193
|
+
body: form.itemList('option', q.options, `${i}o`, optionsOpts(q)),
|
|
194
|
+
})
|
|
195
|
+
)
|
|
166
196
|
);
|
|
167
197
|
}
|
|
168
198
|
if (q.type === 'text')
|
|
@@ -172,22 +202,25 @@ function questionFields(q, i) {
|
|
|
172
202
|
hint: t.placeholderHint,
|
|
173
203
|
})
|
|
174
204
|
);
|
|
175
|
-
if (!INLINE_ANSWER_TYPES.includes(q.type)) body.push(answerField(q));
|
|
176
|
-
|
|
177
|
-
|
|
205
|
+
if (!INLINE_ANSWER_TYPES.includes(q.type)) body.push(answerArea(answerField(q)));
|
|
206
|
+
// 표시 옵션: 보기 · 정답과 줄로 나눈다
|
|
207
|
+
const display = [];
|
|
208
|
+
if (q.type !== 'text') display.push(form.toggle(t.shuffle, q.shuffle, v => (q.shuffle = v)));
|
|
209
|
+
display.push(
|
|
178
210
|
form.toggle(t.explanationOn, q.explanation?.enabled, v => {
|
|
179
211
|
q.explanation = { ...(q.explanation ?? { text: '' }), enabled: v };
|
|
180
212
|
render();
|
|
181
213
|
})
|
|
182
214
|
);
|
|
183
215
|
if (q.explanation?.enabled)
|
|
184
|
-
|
|
216
|
+
display.push(
|
|
185
217
|
form.field(t.explanation, q.explanation.text, v => (q.explanation.text = v), {
|
|
186
218
|
multiline: true,
|
|
187
219
|
showOptional: false,
|
|
188
220
|
})
|
|
189
221
|
);
|
|
190
|
-
|
|
222
|
+
body.push(templates.displayOptions({ label: t.display, body: display }));
|
|
223
|
+
return body.filter(Boolean);
|
|
191
224
|
}
|
|
192
225
|
|
|
193
226
|
function questionCard(q, i) {
|
|
@@ -201,23 +234,63 @@ function questionCard(q, i) {
|
|
|
201
234
|
},
|
|
202
235
|
{
|
|
203
236
|
type: type => {
|
|
237
|
+
readAnswerViews();
|
|
238
|
+
// 고른 정답이 있었을 때만 알림 (유형이 바뀌면 답 모양이 달라지므로 정답을 다시 고른다)
|
|
239
|
+
const hadAnswer = isAnswered(q, answers[q.id]);
|
|
204
240
|
draft.questions[i] = convertType(q, type, texts.defaults);
|
|
205
|
-
// 유형이 바뀌면 답 모양이 달라지므로 정답을 다시 고른다
|
|
206
241
|
delete answers[q.id];
|
|
242
|
+
answerViews.delete(q.id);
|
|
243
|
+
if (hadAnswer) retyped.add(q.id);
|
|
207
244
|
render();
|
|
208
245
|
},
|
|
209
246
|
up: () => swap(draft.questions, i, i - 1),
|
|
210
247
|
down: () => swap(draft.questions, i, i + 1),
|
|
248
|
+
// 지운 문항은 알림의 "되돌리기"로 같은 자리에 되살린다 (정답도 함께)
|
|
211
249
|
remove: () => {
|
|
250
|
+
readAnswerViews();
|
|
251
|
+
const removed = { q: structuredClone(q), answer: structuredClone(answers[q.id]) };
|
|
212
252
|
draft.questions.splice(i, 1);
|
|
213
253
|
delete answers[q.id];
|
|
254
|
+
answerViews.delete(q.id);
|
|
255
|
+
retyped.delete(q.id);
|
|
256
|
+
undo = () => {
|
|
257
|
+
draft.questions.splice(i, 0, removed.q);
|
|
258
|
+
if (removed.answer !== undefined) answers[q.id] = removed.answer;
|
|
259
|
+
render();
|
|
260
|
+
};
|
|
261
|
+
undoAt = i;
|
|
214
262
|
render();
|
|
215
263
|
},
|
|
216
264
|
}
|
|
217
265
|
);
|
|
218
266
|
}
|
|
219
267
|
|
|
268
|
+
/** 문항 삭제 뒤 되돌리기 (다음에 다시 그리면 없어짐) */
|
|
269
|
+
let undo = null;
|
|
270
|
+
let undoAt = 0;
|
|
271
|
+
const UNDO_MS = 6000;
|
|
272
|
+
|
|
273
|
+
/** 삭제 알림. 시간이 지나면 지운다 (다시 그리지 않음: 저장한 뒤라면 변경 표시가 생기지 않게) */
|
|
274
|
+
function undoNotice(restore, index) {
|
|
275
|
+
const node = templates.undoNotice({ text: t.questionDeleted(index + 1), action: t.undo });
|
|
276
|
+
const button = node.querySelector('[data-role="undo"]');
|
|
277
|
+
button.addEventListener('click', restore);
|
|
278
|
+
setTimeout(() => {
|
|
279
|
+
const next = node.nextElementSibling;
|
|
280
|
+
const focused = node.contains(document.activeElement);
|
|
281
|
+
node.remove();
|
|
282
|
+
if (focused) next?.focus();
|
|
283
|
+
}, UNDO_MS);
|
|
284
|
+
queueMicrotask(() => button.focus());
|
|
285
|
+
return node;
|
|
286
|
+
}
|
|
287
|
+
|
|
220
288
|
function render() {
|
|
289
|
+
readAnswerViews();
|
|
290
|
+
answerViews.clear();
|
|
291
|
+
const cards = draft.questions.map(questionCard);
|
|
292
|
+
if (undo) cards.splice(undoAt, 0, undoNotice(undo, undoAt));
|
|
293
|
+
undo = null;
|
|
221
294
|
root.replaceChildren(
|
|
222
295
|
templates.answersIntro({ text: unreadable ? `${a.unreadable} ${a.intro}` : a.intro }),
|
|
223
296
|
form.field(t.quizTitle, draft.title, v => (draft.title = v), { required: true }),
|
|
@@ -226,7 +299,7 @@ function render() {
|
|
|
226
299
|
multiline: true,
|
|
227
300
|
showOptional: false,
|
|
228
301
|
}),
|
|
229
|
-
...
|
|
302
|
+
...cards,
|
|
230
303
|
// 퀴즈 하나에 문항 하나: 문항이 있으면 "문항 추가" 대신 안내 (이미 여러 문항으로 저장된 퀴즈도 편집 · 저장은 됨)
|
|
231
304
|
canAddQuestion(draft.questions)
|
|
232
305
|
? form.addQuestion(() => {
|
|
@@ -251,11 +324,27 @@ function render() {
|
|
|
251
324
|
const problemAt = (problem, { answer = false } = {}) => {
|
|
252
325
|
const card = form.cardAt(problem.questionIndex);
|
|
253
326
|
const pick = answer ? card?.querySelector('[data-role="answer"]') : null;
|
|
327
|
+
if (answer) markAnswerError(card, problem.message);
|
|
254
328
|
(pick ?? card)?.scrollIntoView({ block: 'center' });
|
|
255
329
|
pick?.focus({ preventScroll: true });
|
|
256
330
|
return problem.message;
|
|
257
331
|
};
|
|
258
332
|
|
|
333
|
+
/** 정답 묶음을 오류로 표시하고 문장을 그 위에 둔다. 그 안에서 다시 고르면 지운다 */
|
|
334
|
+
function markAnswerError(card, message) {
|
|
335
|
+
const area = card?.querySelector('[data-role="answers"]');
|
|
336
|
+
if (!area) return;
|
|
337
|
+
area.querySelector('[data-role="answer-error"]')?.remove();
|
|
338
|
+
area.dataset.error = '';
|
|
339
|
+
area.lastElementChild.before(templates.answerError({ text: message }));
|
|
340
|
+
const clear = () => {
|
|
341
|
+
delete area.dataset.error;
|
|
342
|
+
area.querySelector('[data-role="answer-error"]')?.remove();
|
|
343
|
+
for (const type of ['input', 'change', 'pointerup']) area.removeEventListener(type, clear);
|
|
344
|
+
};
|
|
345
|
+
for (const type of ['input', 'change', 'pointerup']) area.addEventListener(type, clear);
|
|
346
|
+
}
|
|
347
|
+
|
|
259
348
|
render();
|
|
260
349
|
save = app.useSave({
|
|
261
350
|
label: t.done,
|
|
@@ -266,6 +355,7 @@ save = app.useSave({
|
|
|
266
355
|
},
|
|
267
356
|
// 정답 → 정답 정규식. 검증(정답 · 지운 보기 → 정규식 공통 검사 → 왕복 · 오답)을 통과해야 저장한다
|
|
268
357
|
getGrading: () => {
|
|
358
|
+
readAnswerViews();
|
|
269
359
|
const { questions } = draft;
|
|
270
360
|
const missing = validateAnswerKey(questions, answers, a.validation);
|
|
271
361
|
if (missing) return problemAt(missing, { answer: true });
|
|
@@ -275,6 +365,9 @@ save = app.useSave({
|
|
|
275
365
|
if (regexProblem) return regexProblem;
|
|
276
366
|
const keyProblem = checkAnswerKey(questions, answers, answerKey, a.validation);
|
|
277
367
|
if (keyProblem) return problemAt(keyProblem, { answer: true });
|
|
368
|
+
// 저장하면 유형 바꾸기 알림을 지운다
|
|
369
|
+
retyped.clear();
|
|
370
|
+
for (const node of root.querySelectorAll('[data-role="type-warning"]')) node.remove();
|
|
278
371
|
return { type: 'pattern', answer_key: answerKey };
|
|
279
372
|
},
|
|
280
373
|
});
|
|
@@ -178,6 +178,11 @@
|
|
|
178
178
|
.qz-question:disabled .qz-option:hover {
|
|
179
179
|
background: var(--qz-option-bg);
|
|
180
180
|
}
|
|
181
|
+
.qz-text-field {
|
|
182
|
+
display: flex;
|
|
183
|
+
flex-direction: column;
|
|
184
|
+
gap: 6px;
|
|
185
|
+
}
|
|
181
186
|
.qz-text {
|
|
182
187
|
min-height: 12rem;
|
|
183
188
|
resize: vertical;
|
|
@@ -401,6 +406,17 @@
|
|
|
401
406
|
.qz-group:hover .ec-dropzone {
|
|
402
407
|
border-color: var(--qz-accent);
|
|
403
408
|
}
|
|
409
|
+
/* 읽기 전용(교육자 화면 · 튜터링): 놓으라는 안내 · 누르는 손 모양을 감춘다 (빈 칸 자리는 그대로) */
|
|
410
|
+
.qz-question:disabled .qz-group {
|
|
411
|
+
cursor: default;
|
|
412
|
+
}
|
|
413
|
+
.qz-question:disabled .qz-group:hover .ec-dropzone {
|
|
414
|
+
border-color: var(--ec-border);
|
|
415
|
+
}
|
|
416
|
+
.qz-question:disabled .ec-dropzone > *,
|
|
417
|
+
.qz-question:disabled .qz-empty {
|
|
418
|
+
visibility: hidden;
|
|
419
|
+
}
|
|
404
420
|
.qz-pool-head {
|
|
405
421
|
/* 답안 초기화가 숨었다 나타나도 높이가 그대로 (버튼 높이 30px) */
|
|
406
422
|
min-height: 30px;
|
|
@@ -446,6 +462,10 @@
|
|
|
446
462
|
grid-row: 2;
|
|
447
463
|
grid-column: 3;
|
|
448
464
|
}
|
|
465
|
+
/* 좁은 화면의 그룹 고르기는 보기 글 아래 줄이라 열 머리를 두지 않는다 (고르기 안의 이름으로 알 수 있음) */
|
|
466
|
+
.qe-option.qe-answer-head-select {
|
|
467
|
+
display: none;
|
|
468
|
+
}
|
|
449
469
|
}
|
|
450
470
|
|
|
451
471
|
/* ---------- 편집 ---------- */
|
|
@@ -564,17 +584,16 @@
|
|
|
564
584
|
flex: 1 1 0;
|
|
565
585
|
min-width: 0;
|
|
566
586
|
}
|
|
567
|
-
/* 보기 줄의 정답 칸: radio · checkbox
|
|
568
|
-
.qe-answer {
|
|
587
|
+
/* 보기 줄의 정답 칸: radio · checkbox (누르는 영역 40px). 이름표는 목록 위 "정답" 열 머리 하나 */
|
|
588
|
+
.qe-answer-col {
|
|
569
589
|
flex: none;
|
|
590
|
+
width: 40px;
|
|
570
591
|
display: flex;
|
|
571
592
|
align-items: center;
|
|
572
|
-
|
|
593
|
+
justify-content: center;
|
|
594
|
+
}
|
|
595
|
+
.qe-answer {
|
|
573
596
|
min-height: 40px;
|
|
574
|
-
padding: 0 4px;
|
|
575
|
-
color: var(--eds-text-secondary);
|
|
576
|
-
font-size: var(--eds-fs-caption);
|
|
577
|
-
font-weight: var(--eds-fw-bold);
|
|
578
597
|
cursor: pointer;
|
|
579
598
|
}
|
|
580
599
|
.qe-answer input {
|
|
@@ -585,8 +604,32 @@
|
|
|
585
604
|
accent-color: var(--qz-accent);
|
|
586
605
|
cursor: pointer;
|
|
587
606
|
}
|
|
588
|
-
|
|
589
|
-
|
|
607
|
+
/* 정답으로 고른 줄 (그룹은 그룹에 넣은 보기) */
|
|
608
|
+
.qe-option[data-correct] {
|
|
609
|
+
background: var(--qz-accent-soft);
|
|
610
|
+
}
|
|
611
|
+
/* 목록 위 "정답" 열 머리: 줄의 정답 칸과 같은 자리 */
|
|
612
|
+
.qe-answer-head {
|
|
613
|
+
color: var(--eds-text-secondary);
|
|
614
|
+
font-size: var(--eds-fs-caption);
|
|
615
|
+
font-weight: var(--eds-fw-bold);
|
|
616
|
+
}
|
|
617
|
+
.qe-handle-space {
|
|
618
|
+
flex: none;
|
|
619
|
+
width: 32px;
|
|
620
|
+
}
|
|
621
|
+
/* 그룹 분류: 그룹 고르기는 보기 글 뒤, 삭제 버튼(40px) 앞 */
|
|
622
|
+
.qe-answer-head-select {
|
|
623
|
+
justify-content: flex-end;
|
|
624
|
+
}
|
|
625
|
+
.qe-answer-head-select .qe-handle-space {
|
|
626
|
+
display: none;
|
|
627
|
+
}
|
|
628
|
+
.qe-answer-head-select .qe-answer-col {
|
|
629
|
+
flex: 0 1 160px;
|
|
630
|
+
justify-content: flex-start;
|
|
631
|
+
margin-right: 46px;
|
|
632
|
+
padding-left: 12px;
|
|
590
633
|
}
|
|
591
634
|
/* 그룹 분류 보기 줄의 정답 그룹 고르기 */
|
|
592
635
|
.qe-answer-group {
|
|
@@ -594,12 +637,43 @@
|
|
|
594
637
|
width: auto;
|
|
595
638
|
min-width: 0;
|
|
596
639
|
}
|
|
640
|
+
/* 저장하지 못한 정답 (정답을 고르지 않음 등): 정답 묶음을 오류 색으로 */
|
|
641
|
+
.qe-section[data-role='answers'][data-error] > :last-child {
|
|
642
|
+
outline: 1px solid var(--eds-error-main);
|
|
643
|
+
outline-offset: 4px;
|
|
644
|
+
border-radius: var(--eds-radius);
|
|
645
|
+
background: var(--eds-error-background);
|
|
646
|
+
}
|
|
647
|
+
.qe-answer-error {
|
|
648
|
+
margin: 0;
|
|
649
|
+
color: var(--eds-error-main);
|
|
650
|
+
font-size: var(--eds-fs-caption);
|
|
651
|
+
font-weight: var(--eds-fw-bold);
|
|
652
|
+
}
|
|
653
|
+
/* 유형을 바꿔 정답이 초기화됨 */
|
|
654
|
+
.qe-warning {
|
|
655
|
+
margin: 0;
|
|
656
|
+
padding: 8px 12px;
|
|
657
|
+
border-radius: var(--eds-radius);
|
|
658
|
+
background: var(--ec-warn-bg);
|
|
659
|
+
color: var(--eds-warning-dark);
|
|
660
|
+
font-size: var(--eds-fs-caption);
|
|
661
|
+
font-weight: var(--eds-fw-semibold);
|
|
662
|
+
}
|
|
663
|
+
/* 최소 개수라 지울 수 없을 때 목록 아래 안내 */
|
|
664
|
+
.qe-caption {
|
|
665
|
+
margin: 0;
|
|
666
|
+
color: var(--eds-text-tertiary);
|
|
667
|
+
font-size: var(--eds-fs-caption);
|
|
668
|
+
}
|
|
597
669
|
.qe-add {
|
|
598
|
-
align-self:
|
|
670
|
+
align-self: stretch;
|
|
599
671
|
border-style: dashed;
|
|
600
672
|
}
|
|
601
|
-
|
|
602
|
-
|
|
673
|
+
/* 표시 옵션 (답안 순서 섞기 · 해설): 보기 · 정답과 줄로 나눔 */
|
|
674
|
+
.qe-display {
|
|
675
|
+
padding-top: 16px;
|
|
676
|
+
border-top: 1px solid var(--ec-line);
|
|
603
677
|
}
|
|
604
678
|
.qe-switch {
|
|
605
679
|
display: flex;
|
|
@@ -14,3 +14,7 @@ export declare const addQuestion: Template;
|
|
|
14
14
|
export declare const answersIntro: Template;
|
|
15
15
|
export declare const textAnswers: Template;
|
|
16
16
|
export declare const singleQuestion: Template;
|
|
17
|
+
export declare const typeWarning: Template;
|
|
18
|
+
export declare const answerError: Template;
|
|
19
|
+
export declare const undoNotice: Template;
|
|
20
|
+
export declare const displayOptions: Template;
|
|
@@ -5,17 +5,16 @@ import { html } from '../../core/dom.js';
|
|
|
5
5
|
import { texts } from '../texts.js';
|
|
6
6
|
|
|
7
7
|
const t = texts.edit;
|
|
8
|
-
/** 삭제
|
|
8
|
+
/** 삭제 아이콘 (문항은 휴지통, 보기 · 그룹은 ✕). 요소는 한 자리에만 들어가므로 쓸 때마다 새로 만든다 (색은 버튼 글자색을 따름) */
|
|
9
9
|
const icons = {
|
|
10
10
|
trash: () => html`
|
|
11
11
|
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
12
12
|
<path d="M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4h6v3" />
|
|
13
13
|
</svg>
|
|
14
14
|
`,
|
|
15
|
-
|
|
16
|
-
<svg viewBox="0 0 24 24" width="
|
|
17
|
-
<
|
|
18
|
-
<path d="M8 12h8" />
|
|
15
|
+
xmark: () => html`
|
|
16
|
+
<svg viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-hidden="true">
|
|
17
|
+
<path d="M6 6l12 12M18 6L6 18" />
|
|
19
18
|
</svg>
|
|
20
19
|
`,
|
|
21
20
|
};
|
|
@@ -93,8 +92,22 @@ export const section = ({ label, hint, body }) => html`
|
|
|
93
92
|
</div>
|
|
94
93
|
`;
|
|
95
94
|
|
|
96
|
-
/**
|
|
97
|
-
|
|
95
|
+
/**
|
|
96
|
+
* 보기 · 그룹 목록. rows: row()들 (같은 부모 아래 형제로 두어야 끌어서 순서 바꾸기가 됨)
|
|
97
|
+
* answer: 정답 칸 종류(있으면 줄의 정답 칸 위에 "정답" 열 머리, data-role="answer-head") ·
|
|
98
|
+
* atMin: 최소 개수라 지울 수 없음 (목록 아래 안내)
|
|
99
|
+
*/
|
|
100
|
+
export const list = ({ kind, rows, add, answer, atMin, min }) => html`
|
|
101
|
+
<div class="qe-options">
|
|
102
|
+
${answer &&
|
|
103
|
+
html`<div class="qe-option qe-answer-head qe-answer-head-${answer}" data-role="answer-head" aria-hidden="true">
|
|
104
|
+
<span class="qe-handle-space"></span>
|
|
105
|
+
<span class="qe-answer-col">${t.answer}</span>
|
|
106
|
+
</div>`}
|
|
107
|
+
${rows}${add}
|
|
108
|
+
${atMin && html`<p class="qe-caption">${KIND[kind].min(min)}</p>`}
|
|
109
|
+
</div>
|
|
110
|
+
`;
|
|
98
111
|
|
|
99
112
|
/**
|
|
100
113
|
* 보기 줄의 정답 칸. type: 'radio'(단일) · 'checkbox'(복수) · 'select'(그룹 고르기, choices: [그룹 id, 이름]).
|
|
@@ -114,14 +127,13 @@ const answerControl = ({ type, name, choices = [] }, index) =>
|
|
|
114
127
|
</select>
|
|
115
128
|
`
|
|
116
129
|
: html`
|
|
117
|
-
<label class="qe-answer">
|
|
130
|
+
<label class="qe-answer qe-answer-col">
|
|
118
131
|
<input
|
|
119
132
|
type="${type}"
|
|
120
133
|
data-role="answer"
|
|
121
134
|
name="${name}"
|
|
122
135
|
aria-label="${t.answerLabel(index + 1)}"
|
|
123
136
|
/>
|
|
124
|
-
<span aria-hidden="true">${t.answer}</span>
|
|
125
137
|
</label>
|
|
126
138
|
`;
|
|
127
139
|
|
|
@@ -155,7 +167,7 @@ export const row = ({ kind, index, canDelete, min, answer }) => {
|
|
|
155
167
|
title="${canDelete ? '' : k.min(min)}"
|
|
156
168
|
${!canDelete && 'disabled'}
|
|
157
169
|
>
|
|
158
|
-
${icons.
|
|
170
|
+
${icons.xmark()}
|
|
159
171
|
</button>
|
|
160
172
|
</div>
|
|
161
173
|
`;
|
|
@@ -221,6 +233,30 @@ export const card = ({ q, index, count, types, body }) => html`
|
|
|
221
233
|
</section>
|
|
222
234
|
`;
|
|
223
235
|
|
|
236
|
+
/** 문항 카드 맨 위 알림 (유형을 바꿔 정답이 초기화됨). data-role="type-warning" */
|
|
237
|
+
export const typeWarning = ({ text }) =>
|
|
238
|
+
html`<p class="qe-warning" data-role="type-warning" role="status">${text}</p>`;
|
|
239
|
+
|
|
240
|
+
/** 저장하지 못한 정답 문제 (정답 자리 위). data-role="answer-error" */
|
|
241
|
+
export const answerError = ({ text }) =>
|
|
242
|
+
html`<p class="qe-answer-error" data-role="answer-error" role="alert">${text}</p>`;
|
|
243
|
+
|
|
244
|
+
/** 문항 삭제 뒤 되돌리기 알림. data-role="undo" (되돌리기 버튼) */
|
|
245
|
+
export const undoNotice = ({ text, action }) => html`
|
|
246
|
+
<div class="ec-notice" role="status">
|
|
247
|
+
<span>${text}</span>
|
|
248
|
+
<button type="button" class="ec-text-button" data-role="undo">${action}</button>
|
|
249
|
+
</div>
|
|
250
|
+
`;
|
|
251
|
+
|
|
252
|
+
/** 표시 옵션 묶음 (답안 순서 섞기 · 해설): 보기 목록과 줄로 나눈다 */
|
|
253
|
+
export const displayOptions = ({ label, body }) => html`
|
|
254
|
+
<div class="qe-section qe-display">
|
|
255
|
+
<span class="qe-label">${label}</span>
|
|
256
|
+
${body}
|
|
257
|
+
</div>
|
|
258
|
+
`;
|
|
259
|
+
|
|
224
260
|
/** 편집 화면 맨 위 안내 (정답을 어디서 고르는지) */
|
|
225
261
|
export const answersIntro = ({ text }) => html`<p class="qe-hint qe-answers-intro">${text}</p>`;
|
|
226
262
|
|
|
@@ -6,9 +6,8 @@ import { texts } from '../texts.js';
|
|
|
6
6
|
/** 내용을 받기 전까지 보이는 문구 (학생 · 교육자 · 편집 공통) */
|
|
7
7
|
export const loading = () => html`<p class="ec-muted">${texts.page.loading}</p>`;
|
|
8
8
|
|
|
9
|
-
/** 학생 화면 머리:
|
|
9
|
+
/** 학생 화면 머리: 제목 · 안내 */
|
|
10
10
|
export const learnHeader = ({ title, description }) => html`
|
|
11
|
-
<span class="qz-badge">${texts.learn.badge}</span>
|
|
12
11
|
<h1 class="qz-title">${title}</h1>
|
|
13
12
|
${description ? markdown(description, 'qz-markdown qz-lead') : null}
|
|
14
13
|
`;
|
|
@@ -5,12 +5,15 @@ import { texts } from '../texts.js';
|
|
|
5
5
|
|
|
6
6
|
const t = texts.question;
|
|
7
7
|
|
|
8
|
-
/** @param {{ q: object }} props */
|
|
8
|
+
/** @param {{ q: object }} props. 아래 안내: 채점은 앞뒤 공백을 지우고 비교 (정답은 보이지 않음) */
|
|
9
9
|
export const text = ({ q }) => html`
|
|
10
|
-
<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
<div class="qz-text-field">
|
|
11
|
+
<textarea
|
|
12
|
+
class="qz-text"
|
|
13
|
+
data-role="input"
|
|
14
|
+
placeholder="${q.placeholder || t.textPlaceholder}"
|
|
15
|
+
aria-label="${t.textLabel}"
|
|
16
|
+
></textarea>
|
|
17
|
+
<p class="qz-muted">${t.textTrim}</p>
|
|
18
|
+
</div>
|
|
16
19
|
`;
|
|
@@ -22,16 +22,17 @@ export const texts = {
|
|
|
22
22
|
/** 편집 화면의 정답 (ADR 0009: 퀴즈는 채점해 통과하면 완료 · 기준 답안 고정, 정답은 문항마다 여기서 고름) */
|
|
23
23
|
answers: {
|
|
24
24
|
intro:
|
|
25
|
-
'정답은
|
|
25
|
+
'정답은 보기 줄에서 고릅니다(순서 맞추기 · 주관식은 "정답"에서). 저장하면 고른 정답으로 채점하며, 정답은 학생에게 보이지 않습니다.',
|
|
26
26
|
label: '정답',
|
|
27
27
|
hint: {
|
|
28
|
-
select_one: '정답
|
|
29
|
-
select_multiple: '정답
|
|
28
|
+
select_one: "정답인 보기를 '정답' 열에서 고르세요.",
|
|
29
|
+
select_multiple: "정답인 보기를 '정답' 열에서 모두 고르세요.",
|
|
30
30
|
order: '정답 순서대로 칸에 놓으세요.',
|
|
31
|
-
group:
|
|
32
|
-
text: '정답으로 인정할 답을
|
|
31
|
+
group: "보기마다 들어갈 그룹을 '정답' 열에서 고르세요. \"오답 (그룹 없음)\"인 보기는 어느 그룹에도 넣지 않는 오답 보기입니다.",
|
|
32
|
+
text: '정답으로 인정할 답을 한 줄에 하나씩 적으세요. 여러 줄이면 그중 하나만 맞아도 정답입니다. 앞뒤 공백은 무시합니다.',
|
|
33
33
|
},
|
|
34
34
|
textPlaceholder: '예: 가중치\nweight',
|
|
35
|
+
typeChanged: '유형을 바꾸면 고른 정답이 초기화됩니다. 정답을 다시 고른 뒤 저장하세요.',
|
|
35
36
|
unreadable:
|
|
36
37
|
'저장된 정답(기준 답안)을 이 화면이 읽지 못했어요. 문항마다 정답을 다시 골라 저장해 주세요.',
|
|
37
38
|
validation: {
|
|
@@ -46,7 +47,6 @@ export const texts = {
|
|
|
46
47
|
|
|
47
48
|
/** 학생 화면 */
|
|
48
49
|
learn: {
|
|
49
|
-
badge: '확인 문제',
|
|
50
50
|
unanswered: no => `${no}번 문항에 답해 주세요.`,
|
|
51
51
|
},
|
|
52
52
|
|
|
@@ -55,17 +55,18 @@ export const texts = {
|
|
|
55
55
|
badge: '교육자 화면',
|
|
56
56
|
summary: (count, byType) => `문항 ${count}개 · ${byType.join(' · ')}`,
|
|
57
57
|
summaryType: (type, n) => `${type} ${n}`,
|
|
58
|
-
note: '정답은 내용 편집 화면에서 문항마다 정합니다. 모든 문항을 맞혀야
|
|
58
|
+
note: '정답은 내용 편집 화면에서 문항마다 정합니다. 모든 문항을 맞혀야 100점입니다.',
|
|
59
59
|
},
|
|
60
60
|
|
|
61
61
|
/** 문항 (학생 · 교육자 공통) */
|
|
62
62
|
question: {
|
|
63
63
|
title: (no, title) => `${no}. ${title}`,
|
|
64
64
|
correct: '정답',
|
|
65
|
-
wrong: '다시 한번 풀어보세요.',
|
|
65
|
+
wrong: '다시 한번 풀어보세요. 답을 고친 뒤 다시 제출하세요.',
|
|
66
66
|
explanation: '퀴즈 해설 보기',
|
|
67
67
|
textPlaceholder: '답안을 작성해 주세요.',
|
|
68
68
|
textLabel: '답안',
|
|
69
|
+
textTrim: '앞뒤 공백은 무시하고 비교합니다.',
|
|
69
70
|
pool: '보기',
|
|
70
71
|
answer: '답안',
|
|
71
72
|
orderPoolEmpty: '항목을 다시 이곳으로 옮길 수 있습니다.',
|
|
@@ -91,6 +92,8 @@ export const texts = {
|
|
|
91
92
|
questionUp: no => `문항 ${no} 위로`,
|
|
92
93
|
questionDown: no => `문항 ${no} 아래로`,
|
|
93
94
|
questionDelete: no => `문항 ${no} 삭제`,
|
|
95
|
+
questionDeleted: no => `문항 ${no}을 삭제했습니다.`,
|
|
96
|
+
undo: '되돌리기',
|
|
94
97
|
addQuestion: '+ 문항 추가',
|
|
95
98
|
singleQuestion: '퀴즈 하나에 문항은 하나입니다. 여러 문항은 퀴즈 페이지를 여러 개 만들어 주세요.',
|
|
96
99
|
title: '질문',
|
|
@@ -111,11 +114,12 @@ export const texts = {
|
|
|
111
114
|
answer: '정답',
|
|
112
115
|
answerLabel: no => `보기 ${no} 정답`,
|
|
113
116
|
answerGroup: no => `보기 ${no} 정답 그룹`,
|
|
114
|
-
answerNoGroup: '그룹 없음
|
|
117
|
+
answerNoGroup: '오답 (그룹 없음)',
|
|
115
118
|
slots: '답안 칸 수',
|
|
116
119
|
slotsHint: '보기 중 답안 칸에 놓을 개수. 나머지 보기는 오답 보기가 됩니다.',
|
|
117
120
|
placeholder: '입력란 힌트',
|
|
118
121
|
placeholderHint: '비우면 "답안을 작성해 주세요."',
|
|
122
|
+
display: '표시 옵션',
|
|
119
123
|
shuffle: '답안 순서 섞기 (학생마다 보기 순서가 달라집니다)',
|
|
120
124
|
explanationOn: '해설 사용 (학생이 한 번 제출하면 보입니다)',
|
|
121
125
|
explanation: '해설',
|