@eliceio/cdk-cli 0.1.0-alpha.3 → 0.1.0-alpha.5
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 +288 -200
- package/es/cli.js +70 -66
- package/es/commands/build/index.d.ts +1 -1
- package/es/commands/build/index.js +27 -15
- package/es/commands/create/index.d.ts +5 -1
- package/es/commands/create/index.js +34 -15
- package/es/commands/create/install.d.ts +17 -0
- package/es/commands/create/install.js +53 -0
- package/es/commands/create/scaffold.d.ts +4 -1
- package/es/commands/create/scaffold.js +19 -13
- package/es/commands/dev/index.d.ts +1 -1
- package/es/commands/dev/index.js +5 -5
- package/es/commands/doctor/index.d.ts +29 -2
- package/es/commands/doctor/index.js +253 -55
- package/es/commands/mcp/index.d.ts +0 -12
- package/es/commands/mcp/index.js +6 -57
- package/es/commands/setup/index.d.ts +11 -3
- package/es/commands/setup/index.js +112 -37
- package/es/commands/skill/index.d.ts +46 -8
- package/es/commands/skill/index.js +151 -35
- package/es/commands/uninstall/index.d.ts +54 -0
- package/es/commands/uninstall/index.js +304 -0
- package/es/commands/update/index.d.ts +59 -0
- package/es/commands/update/index.js +251 -0
- package/es/commands/validate/index.d.ts +18 -0
- package/es/commands/{check → validate}/index.js +16 -10
- package/es/core/collect.d.ts +5 -2
- package/es/core/config.d.ts +99 -50
- package/es/core/config.js +244 -91
- package/es/core/latest.d.ts +21 -0
- package/es/core/latest.js +43 -0
- package/es/core/manifest.d.ts +2 -1
- package/es/core/manifest.js +2 -1
- package/es/core/minify.js +2 -2
- package/es/core/prepare.d.ts +18 -2
- package/es/core/prepare.js +48 -16
- package/es/core/project-check.d.ts +19 -8
- package/es/core/project-check.js +36 -9
- package/es/core/sandbox.js +2 -2
- package/es/core/sdk.d.ts +39 -0
- package/es/core/sdk.js +95 -0
- package/es/core/templates.d.ts +2 -4
- package/es/core/templates.js +2 -5
- package/es/dev/grading.d.ts +7 -8
- package/es/dev/grading.js +6 -16
- package/es/dev/host-page.d.ts +1 -1
- package/es/dev/host-page.js +12 -10
- package/es/dev/mock-api.d.ts +13 -18
- package/es/dev/mock-api.js +56 -66
- package/es/dev/server.js +52 -52
- package/es/rules/check.js +43 -31
- package/es/rules/index.d.ts +1 -1
- package/es/rules/index.js +1 -1
- package/es/rules/manifest.d.ts +28 -20
- package/es/rules/manifest.js +58 -55
- package/es/rules/types.d.ts +18 -20
- package/es/rules.json.js +2 -2
- package/es/test-packages.d.ts +7 -0
- package/package.json +3 -4
- package/rules.json +27 -43
- package/skills/_shared/always.md +4 -4
- package/skills/elice-content-check/SKILL.md +11 -8
- package/skills/elice-content-create/SKILL.md +8 -7
- package/skills/elice-content-guide/SKILL.md +42 -0
- package/skills/elice-content-guide/topics/00-what-the-person-decides.md +11 -0
- package/skills/elice-content-guide/topics/01-check-the-environment.md +10 -0
- package/skills/elice-content-guide/topics/02-design-the-material.md +35 -0
- package/skills/elice-content-guide/topics/03-create-the-project.md +22 -0
- package/skills/elice-content-guide/topics/04-rules.md +12 -0
- package/skills/elice-content-guide/topics/05-screen-code.md +101 -0
- package/skills/elice-content-guide/topics/06-using-the-quiz-template.md +22 -0
- package/skills/elice-content-guide/topics/07-move-existing-html.md +10 -0
- package/skills/elice-content-guide/topics/08-fix-check-errors.md +24 -0
- package/skills/elice-content-guide/topics/09-check.md +10 -0
- package/skills/elice-content-guide/topics/10-build.md +8 -0
- package/skills/elice-content-guide/topics/11-more.md +4 -0
- package/skills/elice-content-guide/topics/12-upload-with-the-material-mcp.md +41 -0
- package/skills/elice-content-migrate/SKILL.md +8 -7
- package/skills/elice-content-publish/SKILL.md +8 -7
- package/templates/_shared/lib/cdk-mock.d.ts +5 -13
- package/templates/_shared/lib/cdk-mock.js +49 -144
- package/templates/_shared/lib/elice-content.css +68 -1
- package/templates/_shared/lib/elice-content.d.ts +11 -38
- package/templates/_shared/lib/elice-content.js +43 -248
- package/templates/blank/README.md +12 -10
- package/templates/blank/metadata.json +9 -0
- package/templates/blank/package.json +13 -0
- package/templates/blank/screens/edit.js +1 -1
- package/templates/blank/screens/instructor.js +12 -5
- package/templates/blank/screens/learn.js +16 -11
- package/templates/blank/template.json +2 -2
- package/templates/quiz/README.md +15 -12
- package/templates/quiz/core/behaviors.js +4 -1
- package/templates/quiz/core/editor.d.ts +21 -10
- package/templates/quiz/core/editor.js +44 -31
- package/templates/quiz/core/model.d.ts +14 -0
- package/templates/quiz/core/model.js +76 -4
- package/templates/quiz/metadata.json +9 -0
- package/templates/quiz/package.json +13 -0
- package/templates/quiz/screens/edit.js +101 -34
- package/templates/quiz/screens/instructor.js +18 -12
- package/templates/quiz/screens/learn.js +45 -36
- package/templates/quiz/styles.css +65 -22
- package/templates/quiz/template.json +2 -2
- package/templates/quiz/ui/templates/edit.d.ts +1 -0
- package/templates/quiz/ui/templates/edit.js +65 -19
- package/templates/quiz/ui/templates/group.js +10 -2
- package/templates/quiz/ui/texts.js +11 -11
- package/es/commands/check/index.d.ts +0 -15
- package/es/commands/guide/index.d.ts +0 -29
- package/es/commands/guide/index.js +0 -120
- package/guides/content-development.md +0 -294
- package/templates/_shared/lib/cdk.js +0 -3
- package/templates/blank/completion.html +0 -15
- package/templates/blank/content.json +0 -4
- package/templates/blank/elice.config.json +0 -10
- package/templates/blank/screens/completion.js +0 -7
- package/templates/quiz/content.json +0 -35
- package/templates/quiz/elice.config.json +0 -9
- package/templates/quiz/grading.json +0 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// 내용 편집 화면(CMS). 기존 퀴즈 편집 폼을 옮김 (docs/quiz-spec.md §3). 저장 버튼 · 변경 표시는 키트(useSave)가 합니다.
|
|
2
|
-
// 퀴즈는
|
|
3
|
-
//
|
|
2
|
+
// 퀴즈는 채점 방식 pattern 고정 (ADR 0009, 완료 정책은 LXP 설정 탭에서 교육자가 고름, ADR 0012): 문항 카드마다 정답을
|
|
3
|
+
// 고르고 (단일 · 복수 · 그룹은 보기 줄에서 바로, 순서 · 주관식은 아래 "정답"에서), 저장할 때 고른 답으로 정답 정규식 하나를 만들어 검증한 뒤 settings.grading에 함께 저장합니다.
|
|
4
4
|
// 문제 내용(content)은 학생에게도 내려가므로 정답을 넣지 않습니다 (정답은 grading에만, 서버가 학생에게 내려주지 않음).
|
|
5
5
|
// 여기서는 어떤 칸을 어떤 순서로 놓을지만 정합니다. 모양은 ui/(templates/edit.js · texts · theme.css), 동작은 core/.
|
|
6
6
|
import { start, validateAnswerRegex } from '../lib/elice-content.js';
|
|
@@ -8,14 +8,19 @@ import { renderAnswerBody } from '../core/behaviors.js';
|
|
|
8
8
|
import { createEditor } from '../core/editor.js';
|
|
9
9
|
import {
|
|
10
10
|
buildAnswerKey,
|
|
11
|
+
canAddQuestion,
|
|
11
12
|
checkAnswerKey,
|
|
12
13
|
convertType,
|
|
14
|
+
INLINE_ANSWER_TYPES,
|
|
13
15
|
joinAnswers,
|
|
14
16
|
LIMITS,
|
|
15
17
|
newQuestion,
|
|
18
|
+
optionAnswer,
|
|
16
19
|
parseAnswerKey,
|
|
20
|
+
pruneAnswer,
|
|
17
21
|
validateAnswerKey,
|
|
18
22
|
validateQuiz,
|
|
23
|
+
withOptionAnswer,
|
|
19
24
|
} from '../core/model.js';
|
|
20
25
|
import * as templates from '../ui/templates/edit.js';
|
|
21
26
|
import { templates as quizTemplates } from '../ui/templates/index.js';
|
|
@@ -43,8 +48,6 @@ const form = createEditor({
|
|
|
43
48
|
root,
|
|
44
49
|
templates,
|
|
45
50
|
labels: {
|
|
46
|
-
preview: t.preview,
|
|
47
|
-
previewClose: t.previewClose,
|
|
48
51
|
count: t.count,
|
|
49
52
|
group: texts.defaults.group,
|
|
50
53
|
},
|
|
@@ -57,7 +60,7 @@ const swap = (list, i, j) => {
|
|
|
57
60
|
render();
|
|
58
61
|
};
|
|
59
62
|
|
|
60
|
-
/** 문항 카드의 "정답": 학생 화면과 같은 보기 ·
|
|
63
|
+
/** 순서 · 주관식 문항 카드의 "정답": 학생 화면과 같은 보기 · 칸으로 고른다 (주관식은 허용 답 여러 개) */
|
|
61
64
|
function answerField(q) {
|
|
62
65
|
if (q.type === 'text') {
|
|
63
66
|
const node = templates.textAnswers({ placeholder: a.textPlaceholder });
|
|
@@ -81,19 +84,53 @@ function answerField(q) {
|
|
|
81
84
|
return form.ui.section({ label: a.label, hint: a.hint[q.type], body: view.el });
|
|
82
85
|
}
|
|
83
86
|
|
|
87
|
+
/**
|
|
88
|
+
* 단일 · 복수 · 그룹 문항의 보기 줄 정답 칸 (radio · checkbox · 그룹 select). 정답은 보기 id로 두므로
|
|
89
|
+
* 순서를 바꿔도 그대로이고, 보기를 지우면 정답에서 뺀다 (optionsOpts의 onDelete)
|
|
90
|
+
*/
|
|
91
|
+
function inlineAnswer(q) {
|
|
92
|
+
const types = { select_one: 'radio', select_multiple: 'checkbox', group: 'select' };
|
|
93
|
+
return {
|
|
94
|
+
type: types[q.type],
|
|
95
|
+
// 문항마다 다른 이름 (같은 문항의 radio끼리만 묶임)
|
|
96
|
+
name: `answer-${q.id}`,
|
|
97
|
+
choices: q.type === 'group' ? q.groups.map(g => [g.id, g.name]) : undefined,
|
|
98
|
+
get: option => optionAnswer(q, answers[q.id], option.id),
|
|
99
|
+
set: (option, value) => (answers[q.id] = withOptionAnswer(q, answers[q.id], option.id, value)),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/** 보기 목록 옵션: 지우면 정답에서 빼고, 단일 · 복수 · 그룹은 줄마다 정답 칸 */
|
|
104
|
+
function optionsOpts(q) {
|
|
105
|
+
const inline = INLINE_ANSWER_TYPES.includes(q.type);
|
|
106
|
+
return {
|
|
107
|
+
onDelete: () => {
|
|
108
|
+
if (q.type === 'order') q.slots = Math.min(q.slots, q.options.length);
|
|
109
|
+
if (answers[q.id] !== undefined) answers[q.id] = pruneAnswer(q, answers[q.id]);
|
|
110
|
+
},
|
|
111
|
+
answer: inline ? inlineAnswer(q) : undefined,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
|
|
84
115
|
/** 문항 카드 안의 칸들. 유형마다 보이는 칸이 다르다 */
|
|
85
116
|
function questionFields(q, i) {
|
|
86
117
|
const body = [
|
|
87
118
|
form.field(t.title, q.title, v => (q.title = v), { required: true, max: LIMITS.titleMax }),
|
|
88
|
-
|
|
119
|
+
// 문항 설명: 미리보기 없는 여러 줄 칸. 새 문항에는 키가 없고, 적으면 생긴다
|
|
120
|
+
form.field(t.description, q.description ?? '', v => (q.description = v), {
|
|
121
|
+
multiline: true,
|
|
122
|
+
showOptional: false,
|
|
123
|
+
}),
|
|
89
124
|
];
|
|
90
125
|
if (q.type === 'select_one' || q.type === 'select_multiple' || q.type === 'order') {
|
|
91
|
-
const options = form.itemList('option', q.options, `${i}o`,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
126
|
+
const options = form.itemList('option', q.options, `${i}o`, optionsOpts(q));
|
|
127
|
+
body.push(
|
|
128
|
+
form.ui.section({
|
|
129
|
+
label: t.options,
|
|
130
|
+
hint: q.type === 'order' ? undefined : a.hint[q.type],
|
|
131
|
+
body: options,
|
|
132
|
+
})
|
|
133
|
+
);
|
|
97
134
|
}
|
|
98
135
|
if (q.type === 'order') {
|
|
99
136
|
const slots = form.numberField(
|
|
@@ -107,15 +144,27 @@ function questionFields(q, i) {
|
|
|
107
144
|
slots.querySelector('[data-role="input"]')?.addEventListener('change', render);
|
|
108
145
|
body.push(slots);
|
|
109
146
|
}
|
|
110
|
-
if (q.type === 'group')
|
|
147
|
+
if (q.type === 'group') {
|
|
148
|
+
const groups = form.itemList('group', q.groups, `${i}g`, {
|
|
149
|
+
// 지운 그룹에 넣은 보기는 "그룹 없음"으로
|
|
150
|
+
onDelete: () => {
|
|
151
|
+
if (answers[q.id] !== undefined) answers[q.id] = pruneAnswer(q, answers[q.id]);
|
|
152
|
+
},
|
|
153
|
+
// 그룹 이름을 고치면 보기 줄의 그룹 고르기 이름도 바로 바꾼다 (다시 그리면 입력 중 초점을 잃음)
|
|
154
|
+
onInput: g => {
|
|
155
|
+
for (const select of root.querySelectorAll(`select[name="answer-${q.id}"]`))
|
|
156
|
+
for (const option of select.options) if (option.value === g.id) option.textContent = g.name;
|
|
157
|
+
},
|
|
158
|
+
});
|
|
111
159
|
body.push(
|
|
112
|
-
form.ui.section({ label: t.groups, body:
|
|
160
|
+
form.ui.section({ label: t.groups, body: groups }),
|
|
113
161
|
form.ui.section({
|
|
114
162
|
label: t.options,
|
|
115
|
-
hint:
|
|
116
|
-
body: form.itemList('option', q.options, `${i}o
|
|
163
|
+
hint: a.hint.group,
|
|
164
|
+
body: form.itemList('option', q.options, `${i}o`, optionsOpts(q)),
|
|
117
165
|
})
|
|
118
166
|
);
|
|
167
|
+
}
|
|
119
168
|
if (q.type === 'text')
|
|
120
169
|
body.push(
|
|
121
170
|
form.field(t.placeholder, q.placeholder, v => (q.placeholder = v), {
|
|
@@ -123,7 +172,7 @@ function questionFields(q, i) {
|
|
|
123
172
|
hint: t.placeholderHint,
|
|
124
173
|
})
|
|
125
174
|
);
|
|
126
|
-
body.push(answerField(q));
|
|
175
|
+
if (!INLINE_ANSWER_TYPES.includes(q.type)) body.push(answerField(q));
|
|
127
176
|
if (q.type !== 'text') body.push(form.toggle(t.shuffle, q.shuffle, v => (q.shuffle = v)));
|
|
128
177
|
body.push(
|
|
129
178
|
form.toggle(t.explanationOn, q.explanation?.enabled, v => {
|
|
@@ -132,7 +181,12 @@ function questionFields(q, i) {
|
|
|
132
181
|
})
|
|
133
182
|
);
|
|
134
183
|
if (q.explanation?.enabled)
|
|
135
|
-
body.push(
|
|
184
|
+
body.push(
|
|
185
|
+
form.field(t.explanation, q.explanation.text, v => (q.explanation.text = v), {
|
|
186
|
+
multiline: true,
|
|
187
|
+
showOptional: false,
|
|
188
|
+
})
|
|
189
|
+
);
|
|
136
190
|
return body;
|
|
137
191
|
}
|
|
138
192
|
|
|
@@ -167,25 +221,38 @@ function render() {
|
|
|
167
221
|
root.replaceChildren(
|
|
168
222
|
templates.answersIntro({ text: unreadable ? `${a.unreadable} ${a.intro}` : a.intro }),
|
|
169
223
|
form.field(t.quizTitle, draft.title, v => (draft.title = v), { required: true }),
|
|
170
|
-
|
|
224
|
+
// 퀴즈 안내: 라벨 옆 "선택" 표시 없이
|
|
225
|
+
form.field(t.quizDescription, draft.description, v => (draft.description = v), {
|
|
226
|
+
multiline: true,
|
|
227
|
+
showOptional: false,
|
|
228
|
+
}),
|
|
171
229
|
...draft.questions.map(questionCard),
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
230
|
+
// 퀴즈 하나에 문항 하나: 문항이 있으면 "문항 추가" 대신 안내 (이미 여러 문항으로 저장된 퀴즈도 편집 · 저장은 됨)
|
|
231
|
+
canAddQuestion(draft.questions)
|
|
232
|
+
? form.addQuestion(() => {
|
|
233
|
+
draft.questions.push(
|
|
234
|
+
newQuestion(
|
|
235
|
+
'select_one',
|
|
236
|
+
draft.questions.map(q => q.id),
|
|
237
|
+
texts.defaults
|
|
238
|
+
)
|
|
239
|
+
);
|
|
240
|
+
render();
|
|
241
|
+
})
|
|
242
|
+
: templates.singleQuestion({ text: t.singleQuestion })
|
|
182
243
|
);
|
|
183
244
|
save?.markDirty();
|
|
184
245
|
}
|
|
185
246
|
|
|
186
|
-
/**
|
|
187
|
-
|
|
188
|
-
|
|
247
|
+
/**
|
|
248
|
+
* 문제가 있는 문항 카드로 옮기고 문장을 돌려준다.
|
|
249
|
+
* 정답 문제(answer)면 보기 줄에서 고르는 문항은 보기 목록의 첫 정답 칸으로 옮겨 초점을 둔다
|
|
250
|
+
*/
|
|
251
|
+
const problemAt = (problem, { answer = false } = {}) => {
|
|
252
|
+
const card = form.cardAt(problem.questionIndex);
|
|
253
|
+
const pick = answer ? card?.querySelector('[data-role="answer"]') : null;
|
|
254
|
+
(pick ?? card)?.scrollIntoView({ block: 'center' });
|
|
255
|
+
pick?.focus({ preventScroll: true });
|
|
189
256
|
return problem.message;
|
|
190
257
|
};
|
|
191
258
|
|
|
@@ -201,13 +268,13 @@ save = app.useSave({
|
|
|
201
268
|
getGrading: () => {
|
|
202
269
|
const { questions } = draft;
|
|
203
270
|
const missing = validateAnswerKey(questions, answers, a.validation);
|
|
204
|
-
if (missing) return problemAt(missing);
|
|
271
|
+
if (missing) return problemAt(missing, { answer: true });
|
|
205
272
|
const answerKey = buildAnswerKey(questions, answers);
|
|
206
273
|
const base = questions.map(q => (q.type === 'text' ? (answers[q.id] ?? [])[0] : answers[q.id]));
|
|
207
274
|
const regexProblem = validateAnswerRegex(answerKey, [joinAnswers(questions, base)]);
|
|
208
275
|
if (regexProblem) return regexProblem;
|
|
209
276
|
const keyProblem = checkAnswerKey(questions, answers, answerKey, a.validation);
|
|
210
|
-
if (keyProblem) return problemAt(keyProblem);
|
|
277
|
+
if (keyProblem) return problemAt(keyProblem, { answer: true });
|
|
211
278
|
return { type: 'pattern', answer_key: answerKey };
|
|
212
279
|
},
|
|
213
280
|
});
|
|
@@ -11,17 +11,23 @@ const root = document.getElementById('app');
|
|
|
11
11
|
document.title = texts.page.instructor;
|
|
12
12
|
root.replaceChildren(loading());
|
|
13
13
|
const app = await start({ screen: 'instructor' });
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
// 편집 화면에서 아직 내용을 저장하지 않았으면 안내만 보인다
|
|
15
|
+
if (app.hasContent) show();
|
|
16
|
+
else root.replaceChildren(app.emptyState());
|
|
16
17
|
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
function show() {
|
|
19
|
+
const { title, questions = [] } = app.content;
|
|
20
|
+
const counts = questions.reduce((m, q) => ({ ...m, [q.type]: (m[q.type] ?? 0) + 1 }), {});
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
)
|
|
22
|
+
const views = questions.map((q, i) => renderQuestion(q, i, { templates, labels, disabled: true }));
|
|
23
|
+
views.forEach((v) => v.showExplanation());
|
|
24
|
+
|
|
25
|
+
root.replaceChildren(
|
|
26
|
+
instructorHeader({
|
|
27
|
+
title: title ?? '',
|
|
28
|
+
count: questions.length,
|
|
29
|
+
byType: Object.entries(counts).map(([t, n]) => [texts.types[t] ?? t, n]),
|
|
30
|
+
}),
|
|
31
|
+
...views.map((v) => v.el),
|
|
32
|
+
);
|
|
33
|
+
}
|
|
@@ -12,43 +12,52 @@ const root = document.getElementById('app');
|
|
|
12
12
|
document.title = texts.page.learn;
|
|
13
13
|
root.replaceChildren(loading());
|
|
14
14
|
const app = await start({ screen: 'learn' });
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
renderQuestion(q, i, {
|
|
19
|
-
templates,
|
|
20
|
-
labels: { ...labels, types: null },
|
|
21
|
-
seed: app.account?.anonymousId ?? '',
|
|
22
|
-
}),
|
|
23
|
-
);
|
|
15
|
+
// 편집 화면에서 아직 내용을 저장하지 않았으면 안내만 보인다 (기본 문항은 없음)
|
|
16
|
+
if (app.hasContent) show();
|
|
17
|
+
else root.replaceChildren(app.emptyState());
|
|
24
18
|
|
|
25
|
-
|
|
19
|
+
function show() {
|
|
20
|
+
const { title, description, questions = [] } = app.content;
|
|
21
|
+
// 학생 화면에는 문항 유형을 보이지 않는다 (무엇을 할지는 질문 문장이 알려 줌). 교육자 화면에는 보인다
|
|
22
|
+
const views = questions.map((q, i) =>
|
|
23
|
+
renderQuestion(q, i, {
|
|
24
|
+
templates,
|
|
25
|
+
labels: { ...labels, types: null },
|
|
26
|
+
seed: app.account?.anonymousId ?? '',
|
|
27
|
+
}),
|
|
28
|
+
);
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
app.useSubmit({
|
|
29
|
-
getAnswer: () => joinAnswers(questions, views.map((v) => v.getValue())),
|
|
30
|
-
setAnswer: (answer) => {
|
|
31
|
-
const byId = splitAnswers(questions, answer);
|
|
32
|
-
questions.forEach((q, i) => views[i].setValue(decodeAnswer(q, byId[q.id])));
|
|
33
|
-
},
|
|
34
|
-
validate: () => {
|
|
35
|
-
const left = questions.findIndex((q, i) => !isAnswered(q, views[i].getValue()));
|
|
36
|
-
return left < 0 || texts.learn.unanswered(left + 1);
|
|
37
|
-
},
|
|
38
|
-
// 서버 채점 결과는 전체 { isCorrect, score }뿐이라 모두 맞았을 때만 문항마다 정답 표시. 해설은 한 번이라도 제출하면
|
|
39
|
-
onResult: (res) => {
|
|
40
|
-
views.forEach((v) => {
|
|
41
|
-
v.setResult(res.isCorrect === true ? true : null);
|
|
42
|
-
v.showExplanation();
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
});
|
|
30
|
+
root.replaceChildren(learnHeader({ title: title ?? '', description }), ...views.map((v) => v.el));
|
|
46
31
|
|
|
47
|
-
//
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
32
|
+
// 답은 문자열 하나로 낸다 (편집 화면이 만든 정답 정규식과 전체 비교, ADR 0008 · 0009): "q1=b;q2=a,d;…"
|
|
33
|
+
app.useSubmit({
|
|
34
|
+
getAnswer: () => joinAnswers(questions, views.map((v) => v.getValue())),
|
|
35
|
+
setAnswer: (answer) => {
|
|
36
|
+
const byId = splitAnswers(questions, answer);
|
|
37
|
+
questions.forEach((q, i) => views[i].setValue(decodeAnswer(q, byId[q.id])));
|
|
38
|
+
},
|
|
39
|
+
validate: () => {
|
|
40
|
+
const left = questions.findIndex((q, i) => !isAnswered(q, views[i].getValue()));
|
|
41
|
+
return left < 0 || texts.learn.unanswered(left + 1);
|
|
42
|
+
},
|
|
43
|
+
// 서버 채점 결과는 전체 { isCorrect, score }뿐이다. 문항이 하나면 그 결과가 곧 문항의 정답 · 오답이고,
|
|
44
|
+
// 여러 문항이면 어느 문항이 틀렸는지 모르므로 모두 맞았을 때만 정답 표시. 해설은 한 번이라도 제출하면
|
|
45
|
+
onResult: (res) => {
|
|
46
|
+
const single = views.length === 1;
|
|
47
|
+
views.forEach((v) => {
|
|
48
|
+
const correct = typeof res.isCorrect === 'boolean' ? res.isCorrect : null;
|
|
49
|
+
v.setResult(single ? correct : correct === true ? true : null);
|
|
50
|
+
v.showExplanation();
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
// 다시 고치면 그 문항의 결과 색을 지운다 (기존 동작)
|
|
56
|
+
root.addEventListener('input', (e) => clearResult(e.target));
|
|
57
|
+
root.addEventListener('click', (e) => clearResult(e.target));
|
|
58
|
+
function clearResult(target) {
|
|
59
|
+
const card = target instanceof Element ? target.closest('[data-role="question"]') : null;
|
|
60
|
+
const i = card ? questions.findIndex((q) => q.id === card.dataset.id) : -1;
|
|
61
|
+
if (i >= 0 && !app.readOnly) views[i].setResult(null);
|
|
62
|
+
}
|
|
54
63
|
}
|
|
@@ -398,7 +398,12 @@
|
|
|
398
398
|
gap: var(--qz-list-gap);
|
|
399
399
|
min-height: 44px;
|
|
400
400
|
}
|
|
401
|
+
.qz-group:hover .ec-dropzone {
|
|
402
|
+
border-color: var(--qz-accent);
|
|
403
|
+
}
|
|
401
404
|
.qz-pool-head {
|
|
405
|
+
/* 답안 초기화가 숨었다 나타나도 높이가 그대로 (버튼 높이 30px) */
|
|
406
|
+
min-height: 30px;
|
|
402
407
|
display: flex;
|
|
403
408
|
justify-content: space-between;
|
|
404
409
|
align-items: center;
|
|
@@ -408,6 +413,13 @@
|
|
|
408
413
|
}
|
|
409
414
|
|
|
410
415
|
@media (max-width: 767.98px) {
|
|
416
|
+
/* 좁은 화면: 문항 머리의 아이콘 버튼을 좁혀 유형 이름이 덜 잘리게 */
|
|
417
|
+
.qe-card-head {
|
|
418
|
+
gap: 4px;
|
|
419
|
+
}
|
|
420
|
+
.qe-card-head .ec-icon-button {
|
|
421
|
+
width: 32px;
|
|
422
|
+
}
|
|
411
423
|
.qz-order {
|
|
412
424
|
grid-template-columns: 1fr;
|
|
413
425
|
}
|
|
@@ -421,6 +433,19 @@
|
|
|
421
433
|
.qz-group-pool {
|
|
422
434
|
order: -1;
|
|
423
435
|
}
|
|
436
|
+
/* 좁은 화면: 그룹 고르기는 보기 글 아래 줄로 (보기 글 칸이 좁아지지 않게) */
|
|
437
|
+
.qe-option:has(.qe-answer-group) {
|
|
438
|
+
display: grid;
|
|
439
|
+
grid-template-columns: auto auto minmax(0, 1fr) auto;
|
|
440
|
+
}
|
|
441
|
+
.qe-option:has(.qe-answer-group) [data-role='delete'] {
|
|
442
|
+
grid-row: 1;
|
|
443
|
+
grid-column: 4;
|
|
444
|
+
}
|
|
445
|
+
.qe-answer-group {
|
|
446
|
+
grid-row: 2;
|
|
447
|
+
grid-column: 3;
|
|
448
|
+
}
|
|
424
449
|
}
|
|
425
450
|
|
|
426
451
|
/* ---------- 편집 ---------- */
|
|
@@ -435,16 +460,26 @@
|
|
|
435
460
|
}
|
|
436
461
|
.qe-card-head {
|
|
437
462
|
display: flex;
|
|
438
|
-
|
|
463
|
+
/* 좁은 화면에서도 ↑ · ↓ · 삭제가 다음 줄로 넘어가지 않게, 대신 유형 선택이 줄어듦 */
|
|
464
|
+
flex-wrap: nowrap;
|
|
439
465
|
align-items: center;
|
|
440
466
|
gap: 8px;
|
|
441
467
|
font-size: var(--eds-fs-subtitle2);
|
|
442
468
|
font-weight: var(--eds-fw-extrabold);
|
|
443
469
|
}
|
|
470
|
+
.qe-card-head > strong {
|
|
471
|
+
flex: none;
|
|
472
|
+
white-space: nowrap;
|
|
473
|
+
}
|
|
444
474
|
.qe-type {
|
|
445
475
|
width: auto;
|
|
476
|
+
min-width: 0;
|
|
477
|
+
flex: 0 1 auto;
|
|
478
|
+
text-overflow: ellipsis;
|
|
446
479
|
margin-right: auto;
|
|
447
480
|
font-size: var(--eds-fs-body2);
|
|
481
|
+
/* 문항 머리(굵은 글씨)를 물려받지 않게 */
|
|
482
|
+
font-weight: 400;
|
|
448
483
|
}
|
|
449
484
|
.qe-field {
|
|
450
485
|
display: flex;
|
|
@@ -525,17 +560,39 @@
|
|
|
525
560
|
color: var(--qz-text-muted);
|
|
526
561
|
font-weight: var(--eds-fw-bold);
|
|
527
562
|
}
|
|
528
|
-
|
|
529
|
-
|
|
563
|
+
.qe-option-text {
|
|
564
|
+
flex: 1 1 0;
|
|
565
|
+
min-width: 0;
|
|
566
|
+
}
|
|
567
|
+
/* 보기 줄의 정답 칸: radio · checkbox + "정답" (누르는 영역 40px) */
|
|
568
|
+
.qe-answer {
|
|
530
569
|
flex: none;
|
|
531
|
-
|
|
570
|
+
display: flex;
|
|
571
|
+
align-items: center;
|
|
572
|
+
gap: 4px;
|
|
532
573
|
min-height: 40px;
|
|
533
|
-
padding: 0;
|
|
534
|
-
border-color: var(--qz-border);
|
|
574
|
+
padding: 0 4px;
|
|
535
575
|
color: var(--eds-text-secondary);
|
|
576
|
+
font-size: var(--eds-fs-caption);
|
|
577
|
+
font-weight: var(--eds-fw-bold);
|
|
578
|
+
cursor: pointer;
|
|
536
579
|
}
|
|
537
|
-
.qe-
|
|
538
|
-
|
|
580
|
+
.qe-answer input {
|
|
581
|
+
width: 18px;
|
|
582
|
+
height: 18px;
|
|
583
|
+
margin: 0;
|
|
584
|
+
padding: 0;
|
|
585
|
+
accent-color: var(--qz-accent);
|
|
586
|
+
cursor: pointer;
|
|
587
|
+
}
|
|
588
|
+
.qe-answer:has(input:checked) {
|
|
589
|
+
color: var(--qz-accent);
|
|
590
|
+
}
|
|
591
|
+
/* 그룹 분류 보기 줄의 정답 그룹 고르기 */
|
|
592
|
+
.qe-answer-group {
|
|
593
|
+
flex: 0 1 160px;
|
|
594
|
+
width: auto;
|
|
595
|
+
min-width: 0;
|
|
539
596
|
}
|
|
540
597
|
.qe-add {
|
|
541
598
|
align-self: flex-start;
|
|
@@ -554,17 +611,3 @@
|
|
|
554
611
|
height: 18px;
|
|
555
612
|
accent-color: var(--qz-accent);
|
|
556
613
|
}
|
|
557
|
-
.qe-link {
|
|
558
|
-
min-height: 0;
|
|
559
|
-
padding: 0 4px;
|
|
560
|
-
border: 0;
|
|
561
|
-
background: none;
|
|
562
|
-
color: var(--qz-accent);
|
|
563
|
-
font-size: var(--eds-fs-caption);
|
|
564
|
-
font-weight: var(--eds-fw-medium);
|
|
565
|
-
}
|
|
566
|
-
.qe-preview {
|
|
567
|
-
padding: 12px 16px;
|
|
568
|
-
border: 1px dashed var(--qz-border);
|
|
569
|
-
border-radius: var(--eds-radius);
|
|
570
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quiz",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"title": "퀴즈",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "한 문항 퀴즈 (여러 문항은 페이지를 여러 개로). 문항 없이 시작해 편집 화면 \"문항 추가\"로 선택 · 순서 · 주관식 · 그룹 분류 문항 하나를 만듦. 정답은 편집 화면에서 정하고 기준 답안(pattern)으로 채점 (완료 정책은 LXP 설정 탭에서 교육자가 고름)"
|
|
6
6
|
}
|