@eliceio/cdk-cli 1.1.0 → 1.2.1
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 +65 -38
- package/es/cli.js +35 -2
- package/es/commands/create/index.js +2 -2
- package/es/commands/dev/index.d.ts +8 -3
- package/es/commands/dev/index.js +72 -3
- package/es/commands/doctor/index.d.ts +1 -1
- package/es/commands/doctor/index.js +10 -13
- package/es/commands/setup/index.d.ts +1 -1
- package/es/commands/setup/index.js +4 -3
- package/es/commands/uninstall/index.d.ts +1 -1
- package/es/commands/uninstall/index.js +7 -30
- package/es/core/config.d.ts +2 -2
- package/es/core/config.js +2 -2
- package/es/core/skills.d.ts +22 -4
- package/es/core/skills.js +89 -17
- package/es/dev/browser.d.ts +22 -0
- package/es/dev/browser.js +105 -0
- package/es/dev/check.d.ts +84 -0
- package/es/dev/check.js +326 -0
- package/es/dev/host-page.js +10 -0
- package/es/dev/mock-api.js +1 -1
- package/es/dev/server.d.ts +2 -0
- package/es/dev/server.js +1 -0
- package/es/rules/check.js +1 -1
- package/es/rules/manifest.d.ts +1 -1
- package/es/rules/manifest.js +2 -2
- package/es/test-old-skill.d.ts +5 -0
- package/package.json +3 -2
- package/skills/_shared/always.md +13 -5
- package/skills/{elice-content-guide/topics → _shared/references}/00-what-the-person-decides.md +2 -2
- package/skills/{elice-content-guide/topics → _shared/references}/02-design-the-material.md +13 -4
- package/skills/{elice-content-guide/topics → _shared/references}/03-create-the-project.md +2 -2
- package/skills/_shared/references/05-screen-code.md +169 -0
- package/skills/{elice-content-guide/topics → _shared/references}/06-using-the-quiz-template.md +4 -3
- package/skills/{elice-content-guide/topics → _shared/references}/07-move-existing-html.md +1 -1
- package/skills/_shared/references/08-fix-check-errors.md +28 -0
- package/skills/_shared/references/09-check.md +29 -0
- package/skills/_shared/references/10-build.md +8 -0
- package/skills/_shared/references/12-upload-with-the-material-mcp.md +83 -0
- package/skills/elice-content-check/SKILL.md +7 -9
- package/skills/elice-content-create/SKILL.md +12 -10
- package/skills/elice-content-migrate/SKILL.md +10 -8
- package/skills/elice-content-publish/SKILL.md +10 -8
- package/templates/_shared/lib/cdk-mock.d.ts +1 -1
- package/templates/_shared/lib/cdk-mock.js +2 -2
- package/templates/_shared/lib/elice-content.css +1 -1
- package/templates/_shared/lib/elice-content.d.ts +1 -1
- package/templates/_shared/lib/elice-content.js +35 -18
- package/templates/blank/README.md +24 -21
- package/templates/blank/screens/edit.js +1 -1
- package/templates/blank/template.json +1 -1
- package/templates/quiz/README.md +8 -7
- package/templates/quiz/core/editor.js +141 -4
- package/templates/quiz/core/model.js +4 -3
- package/templates/quiz/metadata.json +1 -1
- package/templates/quiz/screens/edit.js +673 -162
- package/templates/quiz/screens/learn.js +1 -1
- package/templates/quiz/styles.css +557 -73
- package/templates/quiz/template.json +2 -2
- package/templates/quiz/ui/templates/edit.d.ts +1 -1
- package/templates/quiz/ui/templates/edit.js +417 -76
- package/templates/quiz/ui/templates/page.js +2 -17
- package/templates/quiz/ui/templates/question.js +1 -1
- package/templates/quiz/ui/texts.js +40 -27
- package/skills/elice-content-guide/SKILL.md +0 -42
- package/skills/elice-content-guide/topics/05-screen-code.md +0 -132
- package/skills/elice-content-guide/topics/08-fix-check-errors.md +0 -27
- package/skills/elice-content-guide/topics/09-check.md +0 -11
- package/skills/elice-content-guide/topics/10-build.md +0 -8
- package/skills/elice-content-guide/topics/12-upload-with-the-material-mcp.md +0 -41
- package/templates/quiz/instructor.html +0 -17
- package/templates/quiz/screens/instructor.js +0 -33
- /package/skills/{elice-content-guide/topics → _shared/references}/01-check-the-environment.md +0 -0
- /package/skills/{elice-content-guide/topics → _shared/references}/04-rules.md +0 -0
- /package/skills/{elice-content-guide/topics → _shared/references}/11-more.md +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quiz",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"title": "퀴즈",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "퀴즈 (문항 20개까지, 모두 맞혀야 100점). 문항 없이 시작해 편집 화면 \"문항 추가\"로 선택 · 순서 · 주관식 · 그룹 분류 문항을 만듦. 편집 화면은 카드 · 밑줄 칸 디자인(보기 줄에서 정답 체크, 순서 맞추기는 보기를 정답 순서대로 적음). 정답은 편집 화면에서 정하고 기준 답안(pattern)으로 채점 (완료 정책은 LXP 자료 편집 화면의 '설정'에서 교육자가 고름)"
|
|
6
6
|
}
|
|
@@ -13,7 +13,7 @@ export declare const card: Template;
|
|
|
13
13
|
export declare const addQuestion: Template;
|
|
14
14
|
export declare const answersIntro: Template;
|
|
15
15
|
export declare const textAnswers: Template;
|
|
16
|
-
export declare const
|
|
16
|
+
export declare const questionLimit: Template;
|
|
17
17
|
export declare const typeWarning: Template;
|
|
18
18
|
export declare const answerError: Template;
|
|
19
19
|
export declare const undoNotice: Template;
|
|
@@ -1,19 +1,136 @@
|
|
|
1
1
|
// 내용 편집 화면(CMS)의 HTML 조각. 값 넣기 · 입력 반영 · 끌어서 순서 바꾸기는 core/editor.js가 붙입니다.
|
|
2
2
|
// 마크업 · 클래스는 자유롭게 바꿔도 되고, 각 조각에 적힌 data-role만 남기면 동작이 그대로입니다.
|
|
3
3
|
// 입력 칸에는 값을 넣지 않습니다 (동작이 value로 넣음).
|
|
4
|
-
import { html } from
|
|
5
|
-
import { texts } from
|
|
4
|
+
import { html } from "../../core/dom.js";
|
|
5
|
+
import { texts } from "../texts.js";
|
|
6
6
|
|
|
7
7
|
const t = texts.edit;
|
|
8
|
+
// 정답 칸 문구 (texts.answers). 이름을 따로 두는 것은 doctor의 정답 파일 이름 검사(answers.*)에 걸리지 않게 하려는 것
|
|
9
|
+
const ta = texts.answers;
|
|
8
10
|
/** 삭제 아이콘 (문항은 휴지통, 보기 · 그룹은 ✕). 요소는 한 자리에만 들어가므로 쓸 때마다 새로 만든다 (색은 버튼 글자색을 따름) */
|
|
9
11
|
const icons = {
|
|
10
12
|
trash: () => html`
|
|
11
|
-
<svg
|
|
12
|
-
|
|
13
|
+
<svg
|
|
14
|
+
viewBox="0 0 24 24"
|
|
15
|
+
width="18"
|
|
16
|
+
height="18"
|
|
17
|
+
fill="none"
|
|
18
|
+
stroke="currentColor"
|
|
19
|
+
stroke-width="2"
|
|
20
|
+
stroke-linecap="round"
|
|
21
|
+
stroke-linejoin="round"
|
|
22
|
+
aria-hidden="true"
|
|
23
|
+
>
|
|
24
|
+
<path
|
|
25
|
+
d="M4 7h16M10 11v6M14 11v6M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2l1-12M9 7V4h6v3"
|
|
26
|
+
/>
|
|
27
|
+
</svg>
|
|
28
|
+
`,
|
|
29
|
+
info: () => html`
|
|
30
|
+
<svg
|
|
31
|
+
viewBox="0 0 24 24"
|
|
32
|
+
width="20"
|
|
33
|
+
height="20"
|
|
34
|
+
fill="none"
|
|
35
|
+
stroke="currentColor"
|
|
36
|
+
stroke-width="2"
|
|
37
|
+
stroke-linecap="round"
|
|
38
|
+
stroke-linejoin="round"
|
|
39
|
+
aria-hidden="true"
|
|
40
|
+
>
|
|
41
|
+
<circle cx="12" cy="12" r="9" />
|
|
42
|
+
<path d="M12 11v5M12 8h.01" />
|
|
43
|
+
</svg>
|
|
44
|
+
`,
|
|
45
|
+
check: () => html`
|
|
46
|
+
<svg
|
|
47
|
+
viewBox="0 0 24 24"
|
|
48
|
+
width="20"
|
|
49
|
+
height="20"
|
|
50
|
+
fill="none"
|
|
51
|
+
stroke="currentColor"
|
|
52
|
+
stroke-width="2.5"
|
|
53
|
+
stroke-linecap="round"
|
|
54
|
+
stroke-linejoin="round"
|
|
55
|
+
aria-hidden="true"
|
|
56
|
+
>
|
|
57
|
+
<path d="M5 12.5l4.5 4.5L19 7.5" />
|
|
58
|
+
</svg>
|
|
59
|
+
`,
|
|
60
|
+
textbox: () => html`
|
|
61
|
+
<svg
|
|
62
|
+
viewBox="0 0 24 24"
|
|
63
|
+
width="16"
|
|
64
|
+
height="16"
|
|
65
|
+
fill="none"
|
|
66
|
+
stroke="currentColor"
|
|
67
|
+
stroke-width="2"
|
|
68
|
+
stroke-linecap="round"
|
|
69
|
+
stroke-linejoin="round"
|
|
70
|
+
aria-hidden="true"
|
|
71
|
+
>
|
|
72
|
+
<rect x="3" y="6" width="18" height="12" rx="2" />
|
|
73
|
+
<path d="M8 10v4" />
|
|
74
|
+
</svg>
|
|
75
|
+
`,
|
|
76
|
+
align: () => html`
|
|
77
|
+
<svg
|
|
78
|
+
viewBox="0 0 24 24"
|
|
79
|
+
width="16"
|
|
80
|
+
height="16"
|
|
81
|
+
fill="none"
|
|
82
|
+
stroke="currentColor"
|
|
83
|
+
stroke-width="2"
|
|
84
|
+
stroke-linecap="round"
|
|
85
|
+
stroke-linejoin="round"
|
|
86
|
+
aria-hidden="true"
|
|
87
|
+
>
|
|
88
|
+
<path d="M4 6h16M4 10h10M4 14h16M4 18h10" />
|
|
89
|
+
</svg>
|
|
90
|
+
`,
|
|
91
|
+
bulb: () => html`
|
|
92
|
+
<svg
|
|
93
|
+
viewBox="0 0 24 24"
|
|
94
|
+
width="16"
|
|
95
|
+
height="16"
|
|
96
|
+
fill="none"
|
|
97
|
+
stroke="currentColor"
|
|
98
|
+
stroke-width="2"
|
|
99
|
+
stroke-linecap="round"
|
|
100
|
+
stroke-linejoin="round"
|
|
101
|
+
aria-hidden="true"
|
|
102
|
+
>
|
|
103
|
+
<path
|
|
104
|
+
d="M9 18h6M10 21h4M12 3a6 6 0 0 0-3.5 10.9c.6.5 1 1.2 1 2.1h5c0-.9.4-1.6 1-2.1A6 6 0 0 0 12 3z"
|
|
105
|
+
/>
|
|
106
|
+
</svg>
|
|
107
|
+
`,
|
|
108
|
+
shuffle: () => html`
|
|
109
|
+
<svg
|
|
110
|
+
viewBox="0 0 24 24"
|
|
111
|
+
width="16"
|
|
112
|
+
height="16"
|
|
113
|
+
fill="none"
|
|
114
|
+
stroke="currentColor"
|
|
115
|
+
stroke-width="2"
|
|
116
|
+
stroke-linecap="round"
|
|
117
|
+
stroke-linejoin="round"
|
|
118
|
+
aria-hidden="true"
|
|
119
|
+
>
|
|
120
|
+
<path d="M16 3h5v5M4 20 21 3M21 16v5h-5M15 15l6 6M4 4l5 5" />
|
|
13
121
|
</svg>
|
|
14
122
|
`,
|
|
15
123
|
xmark: () => html`
|
|
16
|
-
<svg
|
|
124
|
+
<svg
|
|
125
|
+
viewBox="0 0 24 24"
|
|
126
|
+
width="18"
|
|
127
|
+
height="18"
|
|
128
|
+
fill="none"
|
|
129
|
+
stroke="currentColor"
|
|
130
|
+
stroke-width="2"
|
|
131
|
+
stroke-linecap="round"
|
|
132
|
+
aria-hidden="true"
|
|
133
|
+
>
|
|
17
134
|
<path d="M6 6l12 12M18 6L6 18" />
|
|
18
135
|
</svg>
|
|
19
136
|
`,
|
|
@@ -21,19 +138,19 @@ const icons = {
|
|
|
21
138
|
/** 보기 · 그룹 목록에서 종류마다 다른 문구와 번호 표시 */
|
|
22
139
|
const KIND = {
|
|
23
140
|
option: {
|
|
24
|
-
marker: i => String(i + 1),
|
|
25
|
-
name: i => t.option(i + 1),
|
|
26
|
-
input: i => t.option(i + 1),
|
|
27
|
-
remove: i => t.optionDelete(i + 1),
|
|
141
|
+
marker: (i) => String(i + 1),
|
|
142
|
+
name: (i) => t.option(i + 1),
|
|
143
|
+
input: (i) => t.option(i + 1),
|
|
144
|
+
remove: (i) => t.optionDelete(i + 1),
|
|
28
145
|
min: t.optionsMin,
|
|
29
146
|
max: t.optionsMax,
|
|
30
147
|
add: t.addOption,
|
|
31
148
|
},
|
|
32
149
|
group: {
|
|
33
|
-
marker: i => String.fromCharCode(65 + i),
|
|
34
|
-
name: i => t.group(i + 1),
|
|
35
|
-
input: i => t.groupName(i + 1),
|
|
36
|
-
remove: i => t.groupDelete(i + 1),
|
|
150
|
+
marker: (i) => String.fromCharCode(65 + i),
|
|
151
|
+
name: (i) => t.group(i + 1),
|
|
152
|
+
input: (i) => t.groupName(i + 1),
|
|
153
|
+
remove: (i) => t.groupDelete(i + 1),
|
|
37
154
|
min: t.groupsMin,
|
|
38
155
|
max: t.groupsMax,
|
|
39
156
|
add: t.addGroup,
|
|
@@ -59,54 +176,156 @@ export const field = ({
|
|
|
59
176
|
<label class="qe-field">
|
|
60
177
|
<span class="qe-label">${label}${mark}</span>
|
|
61
178
|
${hint && html`<span class="qe-hint">${hint}</span>`}
|
|
62
|
-
${
|
|
63
|
-
|
|
64
|
-
|
|
179
|
+
${
|
|
180
|
+
multiline
|
|
181
|
+
? html`<textarea class="qe-input" data-role="input"></textarea>`
|
|
182
|
+
: html`<input class="qe-input" data-role="input" />`
|
|
183
|
+
}
|
|
65
184
|
${max && html`<span class="qe-count" data-role="count"></span>`}
|
|
66
185
|
</label>
|
|
67
186
|
`;
|
|
68
187
|
};
|
|
69
188
|
|
|
189
|
+
/**
|
|
190
|
+
* 라벨 없는 바로 쓰는 칸 (퀴즈 제목 · 안내, 질문 · 설명). 보이는 라벨 대신 placeholder와 글자 크기로 무슨 칸인지 알리고,
|
|
191
|
+
* 화면 낭독기에는 aria-label로 이름을 준다. size: 'title'(퀴즈 제목) · 'question'(질문) · 'body'(안내 · 설명)
|
|
192
|
+
* data-role="input" (input · textarea) · max가 있고 showCount가 false가 아니면 data-role="count" (글자 수, 칸에 초점이 있을 때만 보임)
|
|
193
|
+
* showCount: false면 max(입력 제한)는 지키되 글자 수 표시는 뺀다
|
|
194
|
+
* 필수 칸은 data-required: 비운 채 저장하면 동작이 aria-invalid를 붙인다 (빨간 밑줄)
|
|
195
|
+
*/
|
|
196
|
+
export const inlineField = ({
|
|
197
|
+
label,
|
|
198
|
+
placeholder,
|
|
199
|
+
size = "body",
|
|
200
|
+
required = false,
|
|
201
|
+
max,
|
|
202
|
+
showCount = true,
|
|
203
|
+
multiline = false,
|
|
204
|
+
}) => html`
|
|
205
|
+
<div class="qe-inline qe-inline-${size}">
|
|
206
|
+
${
|
|
207
|
+
multiline
|
|
208
|
+
? html`<textarea
|
|
209
|
+
class="qe-inline-input"
|
|
210
|
+
data-role="input"
|
|
211
|
+
rows="1"
|
|
212
|
+
aria-label="${label}"
|
|
213
|
+
placeholder="${placeholder}"
|
|
214
|
+
${required && "data-required aria-required=true"}
|
|
215
|
+
></textarea>`
|
|
216
|
+
: html`<input
|
|
217
|
+
class="qe-inline-input"
|
|
218
|
+
data-role="input"
|
|
219
|
+
aria-label="${label}"
|
|
220
|
+
placeholder="${placeholder}"
|
|
221
|
+
${required && "data-required aria-required=true"}
|
|
222
|
+
/>`
|
|
223
|
+
}
|
|
224
|
+
${max && showCount && html`<span class="qe-count" data-role="count"></span>`}
|
|
225
|
+
</div>
|
|
226
|
+
`;
|
|
227
|
+
|
|
228
|
+
/** 퀴즈 제목 · 안내 묶음. 카드 모양 없이 배경 위에 바로 둔다 */
|
|
229
|
+
export const quizInfo = ({ body }) =>
|
|
230
|
+
html`<section class="qe-card qe-quiz-info">${body}</section>`;
|
|
231
|
+
|
|
70
232
|
/** 숫자 칸 (순서 맞추기 답안 칸 수). data-role="input" */
|
|
71
233
|
export const numberField = ({ label, hint, max }) => html`
|
|
72
234
|
<label class="qe-field">
|
|
73
235
|
<span class="qe-label">${label}</span>
|
|
74
236
|
<span class="qe-hint">${hint}</span>
|
|
75
|
-
<input
|
|
237
|
+
<input
|
|
238
|
+
type="number"
|
|
239
|
+
min="1"
|
|
240
|
+
max="${max}"
|
|
241
|
+
class="qe-input qe-number"
|
|
242
|
+
data-role="input"
|
|
243
|
+
/>
|
|
76
244
|
</label>
|
|
77
245
|
`;
|
|
78
246
|
|
|
79
|
-
/**
|
|
80
|
-
|
|
81
|
-
|
|
247
|
+
/**
|
|
248
|
+
* 켜고 끄기 EDS Chip (꺼짐 outlined · 켜짐 muted primary + 체크). data-role="input" (checkbox, 화면에서만 숨김). title: 마우스를 올리면 보이는 보충 설명
|
|
249
|
+
* icon: icons의 이름 (예: 'shuffle')
|
|
250
|
+
*/
|
|
251
|
+
export const toggle = ({ label, title = "", icon }) => html`
|
|
252
|
+
<label class="qe-switch" title="${title}">
|
|
82
253
|
<input type="checkbox" data-role="input" />
|
|
254
|
+
${icon && html`<span class="qe-chip-icon qe-chip-off">${icons[icon]?.()}</span>`}
|
|
255
|
+
${icon && html`<span class="qe-chip-icon qe-chip-on">${icons.check()}</span>`}
|
|
83
256
|
<span>${label}</span>
|
|
84
257
|
</label>
|
|
85
258
|
`;
|
|
86
259
|
|
|
87
|
-
/**
|
|
88
|
-
|
|
260
|
+
/**
|
|
261
|
+
* 제목이 붙은 묶음 (보기 · 그룹 · 정답). action: 제목줄 오른쪽에 둘 요소 (예: 보기 순서 섞기 토글)
|
|
262
|
+
* hintInline: true면 안내를 제목 바로 옆(같은 줄, 길면 말줄임)에 둔다. 아니면 제목 아래 줄
|
|
263
|
+
*/
|
|
264
|
+
export const section = ({ label, hint, body, action, hintInline = false }) => html`
|
|
89
265
|
<div class="qe-section">
|
|
90
|
-
<
|
|
91
|
-
|
|
266
|
+
<div class="qe-section-head">
|
|
267
|
+
<span class="qe-label">${label}</span>
|
|
268
|
+
${hint && hintInline && html`<span class="qe-hint-inline" title="${hint}">${hint}</span>`}
|
|
269
|
+
${action}
|
|
270
|
+
</div>
|
|
271
|
+
${hint && !hintInline && html`<span class="qe-hint">${hint}</span>`} ${body}
|
|
92
272
|
</div>
|
|
93
273
|
`;
|
|
94
274
|
|
|
275
|
+
/**
|
|
276
|
+
* 필요할 때만 여는 칸 (설명 · 해설). 닫혀 있으면 윤곽선 알약 버튼만 보인다.
|
|
277
|
+
* title이 있으면(해설) 열렸을 때 머리줄(아이콘 · 제목 · 지우기)이 있는 카드 안에 칸을 둔다.
|
|
278
|
+
* data-role="reveal" (열기 버튼) · "reveal-body" (열린 칸 묶음, 닫히면 hidden) · "reveal-close" (비우고 닫기)
|
|
279
|
+
* icon: icons의 이름 (예: 'bulb') · hint: 이름 옆에 두는 보조 글자 (글을 써도 사라지지 않는 안내)
|
|
280
|
+
*/
|
|
281
|
+
const revealClose = (name, glyph) => html`
|
|
282
|
+
<button
|
|
283
|
+
type="button"
|
|
284
|
+
class="ec-icon-button ec-danger"
|
|
285
|
+
data-role="reveal-close"
|
|
286
|
+
aria-label="${t.revealClose(name)}"
|
|
287
|
+
title="${t.revealClose(name)}"
|
|
288
|
+
>
|
|
289
|
+
${glyph}
|
|
290
|
+
</button>
|
|
291
|
+
`;
|
|
292
|
+
|
|
293
|
+
export const reveal = ({ label, field, title, icon, hint }) =>
|
|
294
|
+
title
|
|
295
|
+
? html`
|
|
296
|
+
<div class="qe-reveal qe-reveal-card">
|
|
297
|
+
<button type="button" class="qe-reveal-button" data-role="reveal">
|
|
298
|
+
${icon && icons[icon]?.()}<span>${label}</span
|
|
299
|
+
><span aria-hidden="true">+</span>
|
|
300
|
+
</button>
|
|
301
|
+
<div class="qe-reveal-body" data-role="reveal-body">
|
|
302
|
+
<div class="qe-reveal-head">
|
|
303
|
+
${icon && icons[icon]?.()}<strong>${title}</strong>
|
|
304
|
+
${hint && html`<span class="qe-reveal-hint" title="${hint}">${hint}</span>`}
|
|
305
|
+
${revealClose(title, icons.trash())}
|
|
306
|
+
</div>
|
|
307
|
+
<div class="qe-reveal-field">${field}</div>
|
|
308
|
+
</div>
|
|
309
|
+
</div>
|
|
310
|
+
`
|
|
311
|
+
: html`
|
|
312
|
+
<div class="qe-reveal">
|
|
313
|
+
<button type="button" class="qe-reveal-button" data-role="reveal">
|
|
314
|
+
${label}
|
|
315
|
+
</button>
|
|
316
|
+
<div class="qe-reveal-body" data-role="reveal-body">
|
|
317
|
+
${field} ${revealClose(label, icons.xmark())}
|
|
318
|
+
</div>
|
|
319
|
+
</div>
|
|
320
|
+
`;
|
|
321
|
+
|
|
95
322
|
/**
|
|
96
323
|
* 보기 · 그룹 목록. rows: row()들 (같은 부모 아래 형제로 두어야 끌어서 순서 바꾸기가 됨)
|
|
97
|
-
* answer: 정답 칸 종류(있으면
|
|
98
|
-
* atMin: 최소 개수라 지울 수 없음 (
|
|
324
|
+
* answer: 정답 칸 종류(있으면 줄마다 정답 칸이 붙음, 열 머리는 두지 않음) ·
|
|
325
|
+
* atMin: 최소 개수라 지울 수 없음 (줄의 ✕ 버튼이 비활성이 되고 마우스를 올리면 이유가 보임)
|
|
99
326
|
*/
|
|
100
327
|
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>
|
|
328
|
+
<div class="qe-options">${rows}${add}</div>
|
|
110
329
|
`;
|
|
111
330
|
|
|
112
331
|
/**
|
|
@@ -114,7 +333,7 @@ export const list = ({ kind, rows, add, answer, atMin, min }) => html`
|
|
|
114
333
|
* name: 문항마다 다른 이름 (같은 문항의 radio끼리 묶임). data-role="answer" (input · select, 값은 동작이 넣음)
|
|
115
334
|
*/
|
|
116
335
|
const answerControl = ({ type, name, choices = [] }, index) =>
|
|
117
|
-
type ===
|
|
336
|
+
type === "select"
|
|
118
337
|
? html`
|
|
119
338
|
<select
|
|
120
339
|
class="qe-input qe-answer-group"
|
|
@@ -127,7 +346,7 @@ const answerControl = ({ type, name, choices = [] }, index) =>
|
|
|
127
346
|
</select>
|
|
128
347
|
`
|
|
129
348
|
: html`
|
|
130
|
-
<label class="qe-answer qe-answer-col">
|
|
349
|
+
<label class="qe-answer qe-answer-col" title="${t.answerTitle}">
|
|
131
350
|
<input
|
|
132
351
|
type="${type}"
|
|
133
352
|
data-role="answer"
|
|
@@ -139,10 +358,17 @@ const answerControl = ({ type, name, choices = [] }, index) =>
|
|
|
139
358
|
|
|
140
359
|
/**
|
|
141
360
|
* 보기 · 그룹 한 줄. kind: 'option' | 'group' · index: 0부터 · canDelete: 최소 개수보다 많음
|
|
142
|
-
* answer: 있으면 정답 칸 (answerControl, 단일 · 복수 · 그룹 문항의 보기)
|
|
361
|
+
* answer: 있으면 정답 칸 (answerControl, 단일 · 복수 · 그룹 문항의 보기) · numbered: false면 번호 표시를 뺀다 (단일 · 복수 선택)
|
|
143
362
|
* data-role="handle" (끌기 손잡이) · data-role="input" · data-role="delete" · 있으면 data-role="answer"
|
|
144
363
|
*/
|
|
145
|
-
export const row = ({
|
|
364
|
+
export const row = ({
|
|
365
|
+
kind,
|
|
366
|
+
index,
|
|
367
|
+
canDelete,
|
|
368
|
+
min,
|
|
369
|
+
answer,
|
|
370
|
+
numbered = true,
|
|
371
|
+
}) => {
|
|
146
372
|
const k = KIND[kind];
|
|
147
373
|
return html`
|
|
148
374
|
<div class="qe-option">
|
|
@@ -155,17 +381,22 @@ export const row = ({ kind, index, canDelete, min, answer }) => {
|
|
|
155
381
|
>
|
|
156
382
|
${t.handle}
|
|
157
383
|
</button>
|
|
158
|
-
${answer && answer.type !==
|
|
159
|
-
|
|
160
|
-
<input
|
|
161
|
-
|
|
384
|
+
${answer && answer.type !== "select" && answerControl(answer, index)}
|
|
385
|
+
${numbered && html`<span class="qe-option-no">${k.marker(index)}</span>`}
|
|
386
|
+
<input
|
|
387
|
+
class="qe-inline-input qe-option-text"
|
|
388
|
+
data-role="input"
|
|
389
|
+
aria-label="${k.input(index)}"
|
|
390
|
+
placeholder="${k.input(index)}"
|
|
391
|
+
/>
|
|
392
|
+
${answer && answer.type === "select" && answerControl(answer, index)}
|
|
162
393
|
<button
|
|
163
394
|
type="button"
|
|
164
395
|
class="ec-icon-button ec-danger"
|
|
165
396
|
data-role="delete"
|
|
166
397
|
aria-label="${k.remove(index)}"
|
|
167
|
-
title="${canDelete ?
|
|
168
|
-
${!canDelete &&
|
|
398
|
+
title="${canDelete ? "" : k.min(min)}"
|
|
399
|
+
${!canDelete && "disabled"}
|
|
169
400
|
>
|
|
170
401
|
${icons.xmark()}
|
|
171
402
|
</button>
|
|
@@ -178,8 +409,8 @@ export const addButton = ({ kind, full, max }) => html`
|
|
|
178
409
|
<button
|
|
179
410
|
type="button"
|
|
180
411
|
class="qe-add"
|
|
181
|
-
title="${full ? KIND[kind].max(max) :
|
|
182
|
-
${full &&
|
|
412
|
+
title="${full ? KIND[kind].max(max) : ""}"
|
|
413
|
+
${full && "disabled"}
|
|
183
414
|
>
|
|
184
415
|
${KIND[kind].add}
|
|
185
416
|
</button>
|
|
@@ -194,10 +425,16 @@ export const card = ({ q, index, count, types, body }) => html`
|
|
|
194
425
|
<section class="qe-card">
|
|
195
426
|
<header class="qe-card-head">
|
|
196
427
|
<strong>${t.question(index + 1)}</strong>
|
|
197
|
-
<select
|
|
428
|
+
<select
|
|
429
|
+
class="qe-input qe-type"
|
|
430
|
+
data-role="type"
|
|
431
|
+
aria-label="${t.questionType(index + 1)}"
|
|
432
|
+
>
|
|
198
433
|
${types.map(
|
|
199
434
|
([value, name]) =>
|
|
200
|
-
html`<option value="${value}" ${q.type === value &&
|
|
435
|
+
html`<option value="${value}" ${q.type === value && "selected"}>
|
|
436
|
+
${name}
|
|
437
|
+
</option>`,
|
|
201
438
|
)}
|
|
202
439
|
</select>
|
|
203
440
|
<button
|
|
@@ -205,8 +442,8 @@ export const card = ({ q, index, count, types, body }) => html`
|
|
|
205
442
|
class="ec-icon-button"
|
|
206
443
|
data-role="up"
|
|
207
444
|
aria-label="${t.questionUp(index + 1)}"
|
|
208
|
-
${index === 0 &&
|
|
209
|
-
${count === 1 &&
|
|
445
|
+
${index === 0 && "disabled"}
|
|
446
|
+
${count === 1 && "hidden"}
|
|
210
447
|
>
|
|
211
448
|
${t.up}
|
|
212
449
|
</button>
|
|
@@ -215,8 +452,8 @@ export const card = ({ q, index, count, types, body }) => html`
|
|
|
215
452
|
class="ec-icon-button"
|
|
216
453
|
data-role="down"
|
|
217
454
|
aria-label="${t.questionDown(index + 1)}"
|
|
218
|
-
${index === count - 1 &&
|
|
219
|
-
${count === 1 &&
|
|
455
|
+
${index === count - 1 && "disabled"}
|
|
456
|
+
${count === 1 && "hidden"}
|
|
220
457
|
>
|
|
221
458
|
${t.down}
|
|
222
459
|
</button>
|
|
@@ -233,40 +470,144 @@ export const card = ({ q, index, count, types, body }) => html`
|
|
|
233
470
|
</section>
|
|
234
471
|
`;
|
|
235
472
|
|
|
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
473
|
/** 저장하지 못한 정답 문제 (정답 자리 위). data-role="answer-error" */
|
|
241
474
|
export const answerError = ({ text }) =>
|
|
242
|
-
html`<p class="qe-answer-error" data-role="answer-error" role="alert"
|
|
475
|
+
html`<p class="qe-answer-error" data-role="answer-error" role="alert">
|
|
476
|
+
${text}
|
|
477
|
+
</p>`;
|
|
243
478
|
|
|
244
|
-
/**
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
479
|
+
/**
|
|
480
|
+
* 스낵바 (EDS Snackbar · info): 짧은 알림 + 되돌리기. 화면 아래에 떠 있다. data-role="undo" (되돌리기 버튼)
|
|
481
|
+
* 상태 알림이라 role="status" (초점을 가져가지 않고 낭독기가 읽음)
|
|
482
|
+
*/
|
|
483
|
+
export const snackbar = ({ text, action }) => html`
|
|
484
|
+
<div class="qe-snackbar" role="status">
|
|
485
|
+
<span class="qe-snackbar-icon">${icons.info()}</span>
|
|
486
|
+
<span class="qe-snackbar-text">${text}</span>
|
|
487
|
+
<button type="button" class="qe-snackbar-action" data-role="undo">
|
|
488
|
+
${action}
|
|
489
|
+
</button>
|
|
249
490
|
</div>
|
|
250
491
|
`;
|
|
251
492
|
|
|
252
|
-
/**
|
|
253
|
-
export const
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
493
|
+
/** 편집 화면 맨 위 안내 (정답을 어디서 고르는지) */
|
|
494
|
+
export const answersIntro = ({ text }) =>
|
|
495
|
+
html`<p class="qe-hint qe-answers-intro">${text}</p>`;
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* 주관식 정답 목록: 줄마다 밑줄 칸 하나 + ✕, 아래에 "+ 유사 정답 추가" (보기 목록과 같은 모양). 그중 하나만 맞아도 정답
|
|
499
|
+
* textAnswerRow: data-role="input" · "delete" / textAnswerAdd: data-role="add"
|
|
500
|
+
*/
|
|
501
|
+
export const textAnswerRow = ({ index, canDelete }) => html`
|
|
502
|
+
<div class="qe-option qe-text-answer">
|
|
503
|
+
<input
|
|
504
|
+
class="qe-inline-input qe-option-text"
|
|
505
|
+
data-role="input"
|
|
506
|
+
aria-label="${ta.textInput(index)}"
|
|
507
|
+
placeholder="${ta.textInput(index)}"
|
|
508
|
+
/>
|
|
509
|
+
<button
|
|
510
|
+
type="button"
|
|
511
|
+
class="ec-icon-button ec-danger"
|
|
512
|
+
data-role="delete"
|
|
513
|
+
aria-label="${ta.textDelete(index)}"
|
|
514
|
+
title="${canDelete ? '' : ta.textMin}"
|
|
515
|
+
${!canDelete && 'disabled'}
|
|
516
|
+
>
|
|
517
|
+
${icons.xmark()}
|
|
518
|
+
</button>
|
|
257
519
|
</div>
|
|
258
520
|
`;
|
|
259
521
|
|
|
260
|
-
|
|
261
|
-
|
|
522
|
+
export const textAnswerAdd = () =>
|
|
523
|
+
html`<button type="button" class="qe-add" data-role="add">${ta.addText}</button>`;
|
|
262
524
|
|
|
263
|
-
|
|
264
|
-
export const textAnswers = ({ placeholder }) =>
|
|
265
|
-
html`<textarea class="qe-input" data-role="input" placeholder="${placeholder}"></textarea>`;
|
|
525
|
+
export const textAnswers = ({ rows, add }) => html`<div class="qe-options qe-text-answers">${rows}${add}</div>`;
|
|
266
526
|
|
|
267
527
|
/** 문항 추가 버튼 */
|
|
268
528
|
export const addQuestion = () =>
|
|
269
|
-
html`<button type="button" class="qe-add qe-add-question"
|
|
529
|
+
html`<button type="button" class="qe-add qe-add-question">
|
|
530
|
+
${t.addQuestion}
|
|
531
|
+
</button>`;
|
|
532
|
+
|
|
533
|
+
/** 문항이 최대 개수(LIMITS.questionsMax)라 "문항 추가" 대신 보이는 안내 */
|
|
534
|
+
export const questionLimit = ({ text }) =>
|
|
535
|
+
html`<p class="qe-hint qe-question-limit">${text}</p>`;
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* 그룹 분류 편집판 (그룹별 상자). 보기는 어느 상자에 넣느냐로 정답이 정해진다.
|
|
539
|
+
* groupBox: 그룹 하나의 상자 (번호표 · 이름 · 지우기 + 이 그룹의 보기들). data-role="group-name" · "group-delete"
|
|
540
|
+
* noneBox: 오답 보기 상자 (어느 그룹에도 속하지 않는 보기, 점선. 머리줄의 ✕(data-role="none-close")로 닫음). noneAdd: 오답 보기가 없을 때 상자 대신 보이는 버튼 (data-role="none-add")
|
|
541
|
+
* 상자는 data-group-box와 data-group(그룹 id, 오답은 빈 값)을 가진다 (끌어 놓을 곳)
|
|
542
|
+
*/
|
|
543
|
+
export const groupBox = ({ letter, canDelete, rows, add, nameLabel, namePlaceholder, deleteLabel, deleteTitle }) => html`
|
|
544
|
+
<div class="qe-group" data-group-box>
|
|
545
|
+
<div class="qe-group-head">
|
|
546
|
+
<span class="qe-group-badge">${letter}</span>
|
|
547
|
+
<input
|
|
548
|
+
class="qe-inline-input qe-group-name"
|
|
549
|
+
data-role="group-name"
|
|
550
|
+
aria-label="${nameLabel}"
|
|
551
|
+
placeholder="${namePlaceholder}"
|
|
552
|
+
/>
|
|
553
|
+
<button
|
|
554
|
+
type="button"
|
|
555
|
+
class="ec-icon-button ec-danger"
|
|
556
|
+
data-role="group-delete"
|
|
557
|
+
aria-label="${deleteLabel}"
|
|
558
|
+
title="${canDelete ? '' : deleteTitle}"
|
|
559
|
+
${!canDelete && 'disabled'}
|
|
560
|
+
>
|
|
561
|
+
${icons.xmark()}
|
|
562
|
+
</button>
|
|
563
|
+
</div>
|
|
564
|
+
<div class="qe-options">${rows}${add}</div>
|
|
565
|
+
</div>
|
|
566
|
+
`;
|
|
567
|
+
|
|
568
|
+
export const noneBox = ({ rows, add, canClose, closeTitle, hint = t.noneHint }) => html`
|
|
569
|
+
<div class="qe-group qe-group-none" data-group-box>
|
|
570
|
+
<div class="qe-group-head">
|
|
571
|
+
<strong>${t.noneTitle}</strong>
|
|
572
|
+
<span class="qe-hint-inline" title="${hint}">${hint}</span>
|
|
573
|
+
<button
|
|
574
|
+
type="button"
|
|
575
|
+
class="ec-icon-button ec-danger"
|
|
576
|
+
data-role="none-close"
|
|
577
|
+
aria-label="${t.noneClose}"
|
|
578
|
+
title="${canClose ? t.noneClose : closeTitle}"
|
|
579
|
+
${!canClose && 'disabled'}
|
|
580
|
+
>
|
|
581
|
+
${icons.xmark()}
|
|
582
|
+
</button>
|
|
583
|
+
</div>
|
|
584
|
+
<div class="qe-options">${rows}${add}</div>
|
|
585
|
+
</div>
|
|
586
|
+
`;
|
|
587
|
+
|
|
588
|
+
export const noneAdd = () => html`
|
|
589
|
+
<div class="qe-reveal qe-reveal-card">
|
|
590
|
+
<button type="button" class="qe-reveal-button" data-role="none-add">
|
|
591
|
+
<span>${t.addNone}</span><span aria-hidden="true">+</span>
|
|
592
|
+
</button>
|
|
593
|
+
</div>
|
|
594
|
+
`;
|
|
595
|
+
|
|
596
|
+
/** 그룹 상자들 + "그룹 추가" + 오답 보기 (상자 또는 추가 버튼) */
|
|
597
|
+
export const groupBoard = ({ boxes, add, none }) => html`
|
|
598
|
+
<div class="qe-groups">
|
|
599
|
+
${boxes}
|
|
600
|
+
<div class="qe-options">${add}</div>
|
|
601
|
+
${none}
|
|
602
|
+
</div>
|
|
603
|
+
`;
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* 순서 맞추기 편집판: 번호 목록(번호가 곧 정답 순서) + 오답 보기(순서에 넣지 않는 보기).
|
|
607
|
+
* orderList는 끌어 놓을 곳이라 data-group-box와 data-group="order"를 가진다
|
|
608
|
+
*/
|
|
609
|
+
export const orderList = ({ rows, add }) => html`
|
|
610
|
+
<div class="qe-options" data-group-box data-group="order">${rows}${add}</div>
|
|
611
|
+
`;
|
|
270
612
|
|
|
271
|
-
|
|
272
|
-
export const singleQuestion = ({ text }) => html`<p class="qe-hint qe-single-question">${text}</p>`;
|
|
613
|
+
export const orderBoard = ({ list, none }) => html`<div class="qe-groups">${list}${none}</div>`;
|