@eliceio/cdk-cli 1.2.1 → 1.3.0-contenttypes.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/README.md +59 -50
- package/es/cli.js +11 -2
- package/es/commands/build/index.js +12 -0
- package/es/commands/create/index.js +1 -0
- package/es/commands/create/scaffold.d.ts +2 -2
- package/es/commands/create/scaffold.js +3 -3
- package/es/commands/dev/index.d.ts +10 -1
- package/es/commands/dev/index.js +47 -7
- package/es/core/config.d.ts +20 -9
- package/es/core/config.js +53 -12
- package/es/core/project-check.d.ts +3 -2
- package/es/core/project-check.js +14 -3
- package/es/core/regex.d.ts +11 -0
- package/es/core/regex.js +41 -0
- package/es/core/sandbox.d.ts +26 -0
- package/es/core/sandbox.js +240 -30
- package/es/dev/check.d.ts +30 -0
- package/es/dev/check.js +224 -34
- package/es/dev/grading.d.ts +20 -1
- package/es/dev/grading.js +38 -7
- package/es/dev/host-page.js +1 -1
- package/es/dev/mock-api.d.ts +3 -1
- package/es/dev/mock-api.js +20 -11
- package/es/engines/vite/index.js +1 -1
- package/es/engines/vite/plugin.d.ts +2 -0
- package/es/engines/vite/plugin.js +33 -5
- package/es/rules/answers.d.ts +13 -0
- package/es/rules/answers.js +94 -0
- package/es/rules/check.js +70 -1
- package/es/rules/index.d.ts +1 -0
- package/es/rules/index.js +1 -0
- package/es/rules/size.d.ts +31 -0
- package/es/rules/size.js +58 -0
- package/es/rules/types.d.ts +12 -0
- package/es/rules.json.js +2 -2
- package/package.json +2 -2
- package/rules.json +32 -3
- package/skills/_shared/always.md +3 -3
- package/skills/_shared/references/00-what-the-person-decides.md +1 -1
- package/skills/_shared/references/02-design-the-material.md +10 -7
- package/skills/_shared/references/03-create-the-project.md +2 -1
- package/skills/_shared/references/05-screen-code.md +49 -22
- package/skills/_shared/references/06-using-the-quiz-template.md +7 -6
- package/skills/_shared/references/08-fix-check-errors.md +23 -22
- package/skills/_shared/references/09-check.md +7 -6
- package/skills/_shared/references/12-upload-with-the-material-mcp.md +13 -13
- package/skills/_shared/references/13-edit-screen-design.md +122 -0
- package/skills/_shared/references/14-layouts.md +96 -0
- package/skills/elice-content-check/SKILL.md +2 -2
- package/skills/elice-content-create/SKILL.md +1 -1
- package/skills/elice-content-migrate/SKILL.md +1 -1
- package/templates/_shared/lib/cdk-mock.d.ts +30 -3
- package/templates/_shared/lib/cdk-mock.js +88 -15
- package/templates/_shared/lib/elice-content-editor.js +89 -58
- package/templates/_shared/lib/elice-content.css +1313 -126
- package/templates/_shared/lib/elice-content.d.ts +162 -23
- package/templates/_shared/lib/elice-content.js +863 -82
- package/templates/_shared/lib/icons/empty-content.d.ts +2 -0
- package/templates/_shared/lib/icons/empty-content.js +11 -0
- package/templates/_shared/lib/icons/file-video.d.ts +2 -0
- package/templates/_shared/lib/icons/file-video.js +11 -0
- package/templates/_shared/lib/icons/file.d.ts +2 -0
- package/templates/_shared/lib/icons/file.js +11 -0
- package/templates/blank/README.md +5 -3
- package/templates/blank/edit.html +8 -2
- package/templates/blank/index.html +6 -1
- package/templates/blank/instructor.html +6 -1
- package/templates/blank/template.json +1 -1
- package/templates/quiz/README.md +28 -12
- package/templates/quiz/core/behaviors.d.ts +13 -7
- package/templates/quiz/core/behaviors.js +36 -51
- package/templates/quiz/core/editor.d.ts +10 -0
- package/templates/quiz/core/editor.js +334 -8
- package/templates/quiz/core/markdown.d.ts +4 -0
- package/templates/quiz/core/markdown.js +65 -11
- package/templates/quiz/core/model.d.ts +34 -1
- package/templates/quiz/core/model.js +86 -5
- package/templates/quiz/core/rich-text.d.ts +19 -0
- package/templates/quiz/core/rich-text.js +521 -0
- package/templates/quiz/edit.html +12 -3
- package/templates/quiz/index.html +12 -3
- package/templates/quiz/screens/edit.js +217 -48
- package/templates/quiz/screens/learn.js +90 -14
- package/templates/quiz/styles.css +840 -678
- package/templates/quiz/template.json +9 -2
- package/templates/quiz/ui/templates/edit.d.ts +18 -5
- package/templates/quiz/ui/templates/edit.js +309 -71
- package/templates/quiz/ui/templates/group.js +19 -8
- package/templates/quiz/ui/templates/order.js +25 -24
- package/templates/quiz/ui/templates/page.js +19 -8
- package/templates/quiz/ui/templates/question.js +2 -2
- package/templates/quiz/ui/texts.js +72 -25
- package/templates/quiz/ui/theme.css +8 -9
- package/templates/steps/README.md +77 -0
- package/templates/steps/commentary.txt +7 -0
- package/templates/steps/edit.html +21 -0
- package/templates/steps/gitignore +4 -0
- package/templates/steps/index.html +69 -0
- package/templates/steps/metadata.json +9 -0
- package/templates/steps/package.json +13 -0
- package/templates/steps/screens/edit.js +32 -0
- package/templates/steps/screens/learn.js +108 -0
- package/templates/steps/styles.css +54 -0
- package/templates/steps/template.json +6 -0
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quiz",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"title": "퀴즈",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "문항을 만들고 답안 형식을 고릅니다",
|
|
6
|
+
"catalog": {
|
|
7
|
+
"category": "practice",
|
|
8
|
+
"icon": "quiz",
|
|
9
|
+
"sortOrder": 10,
|
|
10
|
+
"thumbnailUrl": "https://static.elice.io/elice-material/custom/templates/quiz/thumbnail.png",
|
|
11
|
+
"previewUrl": "https://static.elice.io/elice-material/custom/templates/quiz/preview.png"
|
|
12
|
+
}
|
|
6
13
|
}
|
|
@@ -3,18 +3,31 @@
|
|
|
3
3
|
type Template = (props?: any) => any;
|
|
4
4
|
|
|
5
5
|
export declare const field: Template;
|
|
6
|
+
export declare const inlineField: Template;
|
|
7
|
+
export declare const richField: Template;
|
|
8
|
+
export declare const blockText: Template;
|
|
9
|
+
export declare const blockImage: Template;
|
|
10
|
+
export declare const mdTools: Template;
|
|
6
11
|
export declare const numberField: Template;
|
|
7
12
|
export declare const toggle: Template;
|
|
8
13
|
export declare const section: Template;
|
|
14
|
+
export declare const reveal: Template;
|
|
9
15
|
export declare const list: Template;
|
|
10
16
|
export declare const row: Template;
|
|
11
17
|
export declare const addButton: Template;
|
|
12
18
|
export declare const card: Template;
|
|
13
|
-
export declare const
|
|
19
|
+
export declare const typeMenu: Template;
|
|
20
|
+
export declare const answerError: Template;
|
|
21
|
+
export declare const snackbar: Template;
|
|
14
22
|
export declare const answersIntro: Template;
|
|
23
|
+
export declare const textAnswerRow: Template;
|
|
24
|
+
export declare const textAnswerAdd: Template;
|
|
15
25
|
export declare const textAnswers: Template;
|
|
26
|
+
export declare const addQuestion: Template;
|
|
16
27
|
export declare const questionLimit: Template;
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
28
|
+
export declare const groupBox: Template;
|
|
29
|
+
export declare const noneBox: Template;
|
|
30
|
+
export declare const noneAdd: Template;
|
|
31
|
+
export declare const groupBoard: Template;
|
|
32
|
+
export declare const orderList: Template;
|
|
33
|
+
export declare const orderBoard: Template;
|
|
@@ -60,8 +60,8 @@ const icons = {
|
|
|
60
60
|
textbox: () => html`
|
|
61
61
|
<svg
|
|
62
62
|
viewBox="0 0 24 24"
|
|
63
|
-
width="
|
|
64
|
-
height="
|
|
63
|
+
width="18"
|
|
64
|
+
height="18"
|
|
65
65
|
fill="none"
|
|
66
66
|
stroke="currentColor"
|
|
67
67
|
stroke-width="2"
|
|
@@ -73,13 +73,45 @@ const icons = {
|
|
|
73
73
|
<path d="M8 10v4" />
|
|
74
74
|
</svg>
|
|
75
75
|
`,
|
|
76
|
-
|
|
76
|
+
// 설명 추가 (말풍선 줄)
|
|
77
|
+
comment: () => html`
|
|
78
|
+
<svg
|
|
79
|
+
viewBox="0 0 24 24"
|
|
80
|
+
width="18"
|
|
81
|
+
height="18"
|
|
82
|
+
fill="none"
|
|
83
|
+
stroke="currentColor"
|
|
84
|
+
stroke-width="2"
|
|
85
|
+
stroke-linecap="round"
|
|
86
|
+
stroke-linejoin="round"
|
|
87
|
+
aria-hidden="true"
|
|
88
|
+
>
|
|
89
|
+
<path d="M5 3.5h14a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-8.2L6 20.5v-4H5a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2z" />
|
|
90
|
+
<path d="M7.5 8.5h9M7.5 12h6" />
|
|
91
|
+
</svg>
|
|
92
|
+
`,
|
|
93
|
+
chevronDown: () => html`
|
|
77
94
|
<svg
|
|
78
95
|
viewBox="0 0 24 24"
|
|
79
96
|
width="16"
|
|
80
97
|
height="16"
|
|
81
98
|
fill="none"
|
|
82
99
|
stroke="currentColor"
|
|
100
|
+
stroke-width="2.5"
|
|
101
|
+
stroke-linecap="round"
|
|
102
|
+
stroke-linejoin="round"
|
|
103
|
+
aria-hidden="true"
|
|
104
|
+
>
|
|
105
|
+
<path d="M6 9l6 6 6-6" />
|
|
106
|
+
</svg>
|
|
107
|
+
`,
|
|
108
|
+
align: () => html`
|
|
109
|
+
<svg
|
|
110
|
+
viewBox="0 0 24 24"
|
|
111
|
+
width="18"
|
|
112
|
+
height="18"
|
|
113
|
+
fill="none"
|
|
114
|
+
stroke="currentColor"
|
|
83
115
|
stroke-width="2"
|
|
84
116
|
stroke-linecap="round"
|
|
85
117
|
stroke-linejoin="round"
|
|
@@ -91,8 +123,8 @@ const icons = {
|
|
|
91
123
|
bulb: () => html`
|
|
92
124
|
<svg
|
|
93
125
|
viewBox="0 0 24 24"
|
|
94
|
-
width="
|
|
95
|
-
height="
|
|
126
|
+
width="18"
|
|
127
|
+
height="18"
|
|
96
128
|
fill="none"
|
|
97
129
|
stroke="currentColor"
|
|
98
130
|
stroke-width="2"
|
|
@@ -202,11 +234,11 @@ export const inlineField = ({
|
|
|
202
234
|
showCount = true,
|
|
203
235
|
multiline = false,
|
|
204
236
|
}) => html`
|
|
205
|
-
<div class="qe-inline qe-inline-${size}">
|
|
237
|
+
<div class="qe-inline qe-inline-${size} ec-field ec-field-${size}">
|
|
206
238
|
${
|
|
207
239
|
multiline
|
|
208
240
|
? html`<textarea
|
|
209
|
-
class="qe-inline-input"
|
|
241
|
+
class="qe-inline-input ec-field-input"
|
|
210
242
|
data-role="input"
|
|
211
243
|
rows="1"
|
|
212
244
|
aria-label="${label}"
|
|
@@ -214,20 +246,108 @@ export const inlineField = ({
|
|
|
214
246
|
${required && "data-required aria-required=true"}
|
|
215
247
|
></textarea>`
|
|
216
248
|
: html`<input
|
|
217
|
-
class="qe-inline-input"
|
|
249
|
+
class="qe-inline-input ec-field-input"
|
|
218
250
|
data-role="input"
|
|
219
251
|
aria-label="${label}"
|
|
220
252
|
placeholder="${placeholder}"
|
|
221
253
|
${required && "data-required aria-required=true"}
|
|
222
254
|
/>`
|
|
223
255
|
}
|
|
224
|
-
${max && showCount && html`<span class="qe-count" data-role="count"></span>`}
|
|
256
|
+
${max && showCount && html`<span class="qe-count ec-field-count" data-role="count"></span>`}
|
|
225
257
|
</div>
|
|
226
258
|
`;
|
|
227
259
|
|
|
228
|
-
/**
|
|
229
|
-
|
|
230
|
-
|
|
260
|
+
/**
|
|
261
|
+
* 지문 · 해설 칸 (보이는 그대로 고치는 글 칸과 올린 그림 칸이 차례로). 동작(core/editor.js richField)이 칸을 채운다.
|
|
262
|
+
* data-role="input" (값을 든 숨은 textarea) · "blocks" (글 칸 blockText · 그림 칸 blockImage가 들어가는 자리)
|
|
263
|
+
*/
|
|
264
|
+
export const richField = ({ label }) => html`
|
|
265
|
+
<div class="qe-inline qe-inline-body qe-blocks ec-field ec-field-body" role="group" aria-label="${label}">
|
|
266
|
+
<textarea data-role="input" hidden tabindex="-1" aria-hidden="true"></textarea>
|
|
267
|
+
<div class="qe-blocks-list" data-role="blocks"></div>
|
|
268
|
+
</div>
|
|
269
|
+
`;
|
|
270
|
+
|
|
271
|
+
/** 글 칸 (contenteditable). 비어 있으면 data-empty가 붙어 placeholder 글을 보인다 */
|
|
272
|
+
export const blockText = ({ label, placeholder }) => html`
|
|
273
|
+
<div
|
|
274
|
+
class="qe-inline-input qe-wys qz-markdown"
|
|
275
|
+
data-role="block-text"
|
|
276
|
+
contenteditable="true"
|
|
277
|
+
role="textbox"
|
|
278
|
+
aria-multiline="true"
|
|
279
|
+
aria-label="${label}"
|
|
280
|
+
data-placeholder="${placeholder}"
|
|
281
|
+
></div>
|
|
282
|
+
`;
|
|
283
|
+
|
|
284
|
+
/** 올린 그림 칸. data-role="block-remove" (그림 지우기) */
|
|
285
|
+
export const blockImage = ({ alt, src, removeLabel }) => html`
|
|
286
|
+
<figure class="qe-block-image">
|
|
287
|
+
${src && html`<img src="${src}" alt="${alt}" />`}
|
|
288
|
+
<button
|
|
289
|
+
type="button"
|
|
290
|
+
class="qe-block-remove"
|
|
291
|
+
data-role="block-remove"
|
|
292
|
+
aria-label="${removeLabel}"
|
|
293
|
+
title="${removeLabel}"
|
|
294
|
+
>
|
|
295
|
+
${icons.xmark()}
|
|
296
|
+
</button>
|
|
297
|
+
</figure>
|
|
298
|
+
`;
|
|
299
|
+
|
|
300
|
+
const toolIcon = {
|
|
301
|
+
ul: () => html`
|
|
302
|
+
<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">
|
|
303
|
+
<line x1="8" y1="6" x2="21" y2="6" /><line x1="8" y1="12" x2="21" y2="12" /><line x1="8" y1="18" x2="21" y2="18" />
|
|
304
|
+
<line x1="3" y1="6" x2="3.01" y2="6" /><line x1="3" y1="12" x2="3.01" y2="12" /><line x1="3" y1="18" x2="3.01" y2="18" />
|
|
305
|
+
</svg>
|
|
306
|
+
`,
|
|
307
|
+
ol: () => html`
|
|
308
|
+
<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">
|
|
309
|
+
<line x1="10" x2="21" y1="6" y2="6" /><line x1="10" x2="21" y1="12" y2="12" /><line x1="10" x2="21" y1="18" y2="18" />
|
|
310
|
+
<path d="M4 6h1v4" /><path d="M4 10h2" /><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1" />
|
|
311
|
+
</svg>
|
|
312
|
+
`,
|
|
313
|
+
code: () => html`
|
|
314
|
+
<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">
|
|
315
|
+
<polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" />
|
|
316
|
+
</svg>
|
|
317
|
+
`,
|
|
318
|
+
image: () => html`
|
|
319
|
+
<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">
|
|
320
|
+
<rect width="18" height="18" x="3" y="3" rx="2" ry="2" /><circle cx="9" cy="9" r="2" />
|
|
321
|
+
<path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" />
|
|
322
|
+
</svg>
|
|
323
|
+
`,
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* 지문 · 해설 서식 도구 (칸에 초점이 있을 때 칸 아래에 뜸). 버튼마다 data-role:
|
|
328
|
+
* "md-bold" · "md-italic" · "md-strike" · "md-ul" · "md-ol" · "md-code" · "md-image" (그림 올리기, 못 쓰면 동작이 숨김)
|
|
329
|
+
*/
|
|
330
|
+
export const mdTools = () => {
|
|
331
|
+
const m = t.md;
|
|
332
|
+
const tool = (role, name, glyph) => html`
|
|
333
|
+
<button type="button" class="qe-md-btn" data-role="${role}" aria-label="${name}" title="${name}" aria-pressed="false">
|
|
334
|
+
${glyph}
|
|
335
|
+
</button>
|
|
336
|
+
`;
|
|
337
|
+
return html`
|
|
338
|
+
<div class="qe-md" role="toolbar" aria-label="${m.toolbar}">
|
|
339
|
+
${tool("md-bold", m.bold, html`<b>B</b>`)} ${tool("md-italic", m.italic, html`<i>I</i>`)}
|
|
340
|
+
${tool("md-strike", m.strike, html`<s>S</s>`)}
|
|
341
|
+
<span class="qe-md-sep" aria-hidden="true"></span>
|
|
342
|
+
${tool("md-ul", m.ul, toolIcon.ul())} ${tool("md-ol", m.ol, toolIcon.ol())}
|
|
343
|
+
<span class="qe-md-sep" aria-hidden="true"></span>
|
|
344
|
+
${tool("md-code", m.code, toolIcon.code())}
|
|
345
|
+
<button type="button" class="qe-md-btn" data-role="md-image" aria-label="${m.image}" title="${m.image}">
|
|
346
|
+
${toolIcon.image()}
|
|
347
|
+
</button>
|
|
348
|
+
</div>
|
|
349
|
+
`;
|
|
350
|
+
};
|
|
231
351
|
|
|
232
352
|
/** 숫자 칸 (순서 맞추기 답안 칸 수). data-role="input" */
|
|
233
353
|
export const numberField = ({ label, hint, max }) => html`
|
|
@@ -249,10 +369,10 @@ export const numberField = ({ label, hint, max }) => html`
|
|
|
249
369
|
* icon: icons의 이름 (예: 'shuffle')
|
|
250
370
|
*/
|
|
251
371
|
export const toggle = ({ label, title = "", icon }) => html`
|
|
252
|
-
<label class="qe-switch" title="${title}">
|
|
372
|
+
<label class="qe-switch ec-toggle" title="${title}">
|
|
253
373
|
<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>`}
|
|
374
|
+
${icon && html`<span class="qe-chip-icon qe-chip-off ec-toggle-off">${icons[icon]?.()}</span>`}
|
|
375
|
+
${icon && html`<span class="qe-chip-icon qe-chip-on ec-toggle-on">${icons.check()}</span>`}
|
|
256
376
|
<span>${label}</span>
|
|
257
377
|
</label>
|
|
258
378
|
`;
|
|
@@ -262,10 +382,10 @@ export const toggle = ({ label, title = "", icon }) => html`
|
|
|
262
382
|
* hintInline: true면 안내를 제목 바로 옆(같은 줄, 길면 말줄임)에 둔다. 아니면 제목 아래 줄
|
|
263
383
|
*/
|
|
264
384
|
export const section = ({ label, hint, body, action, hintInline = false }) => html`
|
|
265
|
-
<div class="qe-section">
|
|
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>`}
|
|
385
|
+
<div class="qe-section ec-section">
|
|
386
|
+
<div class="qe-section-head ec-section-head">
|
|
387
|
+
<span class="qe-label ec-label">${label}</span>
|
|
388
|
+
${hint && hintInline && html`<span class="qe-hint-inline ec-hint-inline" title="${hint}">${hint}</span>`}
|
|
269
389
|
${action}
|
|
270
390
|
</div>
|
|
271
391
|
${hint && !hintInline && html`<span class="qe-hint">${hint}</span>`} ${body}
|
|
@@ -293,15 +413,15 @@ const revealClose = (name, glyph) => html`
|
|
|
293
413
|
export const reveal = ({ label, field, title, icon, hint }) =>
|
|
294
414
|
title
|
|
295
415
|
? html`
|
|
296
|
-
<div class="qe-reveal qe-reveal-card">
|
|
297
|
-
<button type="button" class="qe-reveal-button" data-role="reveal">
|
|
416
|
+
<div class="qe-reveal qe-reveal-card ec-reveal">
|
|
417
|
+
<button type="button" class="qe-reveal-button ec-reveal-button" data-role="reveal">
|
|
298
418
|
${icon && icons[icon]?.()}<span>${label}</span
|
|
299
419
|
><span aria-hidden="true">+</span>
|
|
300
420
|
</button>
|
|
301
|
-
<div class="qe-reveal-body" data-role="reveal-body">
|
|
302
|
-
<div class="qe-reveal-head">
|
|
421
|
+
<div class="qe-reveal-body ec-reveal-body" data-role="reveal-body">
|
|
422
|
+
<div class="qe-reveal-head ec-reveal-head">
|
|
303
423
|
${icon && icons[icon]?.()}<strong>${title}</strong>
|
|
304
|
-
${hint && html`<span class="qe-reveal-hint" title="${hint}">${hint}</span>`}
|
|
424
|
+
${hint && html`<span class="qe-reveal-hint ec-hint-inline" title="${hint}">${hint}</span>`}
|
|
305
425
|
${revealClose(title, icons.trash())}
|
|
306
426
|
</div>
|
|
307
427
|
<div class="qe-reveal-field">${field}</div>
|
|
@@ -309,11 +429,11 @@ export const reveal = ({ label, field, title, icon, hint }) =>
|
|
|
309
429
|
</div>
|
|
310
430
|
`
|
|
311
431
|
: html`
|
|
312
|
-
<div class="qe-reveal">
|
|
313
|
-
<button type="button" class="qe-reveal-button" data-role="reveal">
|
|
432
|
+
<div class="qe-reveal ec-reveal">
|
|
433
|
+
<button type="button" class="qe-reveal-button ec-reveal-button" data-role="reveal">
|
|
314
434
|
${label}
|
|
315
435
|
</button>
|
|
316
|
-
<div class="qe-reveal-body" data-role="reveal-body">
|
|
436
|
+
<div class="qe-reveal-body ec-reveal-body" data-role="reveal-body">
|
|
317
437
|
${field} ${revealClose(label, icons.xmark())}
|
|
318
438
|
</div>
|
|
319
439
|
</div>
|
|
@@ -325,7 +445,7 @@ export const reveal = ({ label, field, title, icon, hint }) =>
|
|
|
325
445
|
* atMin: 최소 개수라 지울 수 없음 (줄의 ✕ 버튼이 비활성이 되고 마우스를 올리면 이유가 보임)
|
|
326
446
|
*/
|
|
327
447
|
export const list = ({ kind, rows, add, answer, atMin, min }) => html`
|
|
328
|
-
<div class="qe-options">${rows}${add}</div>
|
|
448
|
+
<div class="qe-options ec-list">${rows}${add}</div>
|
|
329
449
|
`;
|
|
330
450
|
|
|
331
451
|
/**
|
|
@@ -346,7 +466,7 @@ const answerControl = ({ type, name, choices = [] }, index) =>
|
|
|
346
466
|
</select>
|
|
347
467
|
`
|
|
348
468
|
: html`
|
|
349
|
-
<label class="qe-answer qe-answer-col" title="${t.answerTitle}">
|
|
469
|
+
<label class="qe-answer qe-answer-col ec-answer-mark" title="${t.answerTitle}">
|
|
350
470
|
<input
|
|
351
471
|
type="${type}"
|
|
352
472
|
data-role="answer"
|
|
@@ -371,10 +491,10 @@ export const row = ({
|
|
|
371
491
|
}) => {
|
|
372
492
|
const k = KIND[kind];
|
|
373
493
|
return html`
|
|
374
|
-
<div class="qe-option">
|
|
494
|
+
<div class="qe-option ec-list-row">
|
|
375
495
|
<button
|
|
376
496
|
type="button"
|
|
377
|
-
class="qe-handle"
|
|
497
|
+
class="qe-handle ec-handle"
|
|
378
498
|
data-role="handle"
|
|
379
499
|
aria-label="${t.sortLabel(k.name(index))}"
|
|
380
500
|
title="${t.sortTitle}"
|
|
@@ -382,13 +502,18 @@ export const row = ({
|
|
|
382
502
|
${t.handle}
|
|
383
503
|
</button>
|
|
384
504
|
${answer && answer.type !== "select" && answerControl(answer, index)}
|
|
385
|
-
${numbered && html`<span class="qe-option-no">${k.marker(index)}</span>`}
|
|
386
|
-
<
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
505
|
+
${numbered && html`<span class="qe-option-no ec-list-no">${k.marker(index)}</span>`}
|
|
506
|
+
<span class="qe-option-field">
|
|
507
|
+
<input
|
|
508
|
+
class="qe-inline-input qe-option-text ec-field-input"
|
|
509
|
+
data-role="input"
|
|
510
|
+
aria-label="${k.input(index)}"
|
|
511
|
+
placeholder="${k.input(index)}"
|
|
512
|
+
/>
|
|
513
|
+
${answer &&
|
|
514
|
+
answer.type !== "select" &&
|
|
515
|
+
html`<span class="qe-correct-tag" aria-hidden="true">${t.correctTag}</span>`}
|
|
516
|
+
</span>
|
|
392
517
|
${answer && answer.type === "select" && answerControl(answer, index)}
|
|
393
518
|
<button
|
|
394
519
|
type="button"
|
|
@@ -408,7 +533,7 @@ export const row = ({
|
|
|
408
533
|
export const addButton = ({ kind, full, max }) => html`
|
|
409
534
|
<button
|
|
410
535
|
type="button"
|
|
411
|
-
class="qe-add"
|
|
536
|
+
class="qe-add ec-list-add"
|
|
412
537
|
title="${full ? KIND[kind].max(max) : ""}"
|
|
413
538
|
${full && "disabled"}
|
|
414
539
|
>
|
|
@@ -416,27 +541,139 @@ export const addButton = ({ kind, full, max }) => html`
|
|
|
416
541
|
</button>
|
|
417
542
|
`;
|
|
418
543
|
|
|
544
|
+
/** 문항 유형 아이콘 (유형 고르기 앞) */
|
|
545
|
+
const typeIcons = {
|
|
546
|
+
select_one: () => html`
|
|
547
|
+
<svg
|
|
548
|
+
viewBox="0 0 24 24"
|
|
549
|
+
width="16"
|
|
550
|
+
height="16"
|
|
551
|
+
fill="none"
|
|
552
|
+
stroke="currentColor"
|
|
553
|
+
stroke-width="2"
|
|
554
|
+
stroke-linecap="round"
|
|
555
|
+
stroke-linejoin="round"
|
|
556
|
+
aria-hidden="true"
|
|
557
|
+
>
|
|
558
|
+
<circle cx="12" cy="12" r="9" />
|
|
559
|
+
<circle cx="12" cy="12" r="3.5" fill="currentColor" stroke="none" />
|
|
560
|
+
</svg>
|
|
561
|
+
`,
|
|
562
|
+
select_multiple: () => html`
|
|
563
|
+
<svg
|
|
564
|
+
viewBox="0 0 24 24"
|
|
565
|
+
width="16"
|
|
566
|
+
height="16"
|
|
567
|
+
fill="none"
|
|
568
|
+
stroke="currentColor"
|
|
569
|
+
stroke-width="2"
|
|
570
|
+
stroke-linecap="round"
|
|
571
|
+
stroke-linejoin="round"
|
|
572
|
+
aria-hidden="true"
|
|
573
|
+
>
|
|
574
|
+
<rect x="4" y="4" width="16" height="16" rx="3" />
|
|
575
|
+
<path d="M8.5 12.5l2.5 2.5 4.5-5" />
|
|
576
|
+
</svg>
|
|
577
|
+
`,
|
|
578
|
+
order: () => html`
|
|
579
|
+
<svg
|
|
580
|
+
viewBox="0 0 24 24"
|
|
581
|
+
width="16"
|
|
582
|
+
height="16"
|
|
583
|
+
fill="none"
|
|
584
|
+
stroke="currentColor"
|
|
585
|
+
stroke-width="2"
|
|
586
|
+
stroke-linecap="round"
|
|
587
|
+
stroke-linejoin="round"
|
|
588
|
+
aria-hidden="true"
|
|
589
|
+
>
|
|
590
|
+
<path d="M10 6h10M10 12h10M10 18h10M4.5 6h.01M4.5 12h.01M4.5 18h.01" />
|
|
591
|
+
</svg>
|
|
592
|
+
`,
|
|
593
|
+
text: () => html`
|
|
594
|
+
<svg
|
|
595
|
+
viewBox="0 0 24 24"
|
|
596
|
+
width="16"
|
|
597
|
+
height="16"
|
|
598
|
+
fill="none"
|
|
599
|
+
stroke="currentColor"
|
|
600
|
+
stroke-width="2"
|
|
601
|
+
stroke-linecap="round"
|
|
602
|
+
stroke-linejoin="round"
|
|
603
|
+
aria-hidden="true"
|
|
604
|
+
>
|
|
605
|
+
<rect x="3" y="6" width="18" height="12" rx="2" />
|
|
606
|
+
<path d="M8 10v4" />
|
|
607
|
+
</svg>
|
|
608
|
+
`,
|
|
609
|
+
group: () => html`
|
|
610
|
+
<svg
|
|
611
|
+
viewBox="0 0 24 24"
|
|
612
|
+
width="16"
|
|
613
|
+
height="16"
|
|
614
|
+
fill="none"
|
|
615
|
+
stroke="currentColor"
|
|
616
|
+
stroke-width="2"
|
|
617
|
+
stroke-linecap="round"
|
|
618
|
+
stroke-linejoin="round"
|
|
619
|
+
aria-hidden="true"
|
|
620
|
+
>
|
|
621
|
+
<rect x="3" y="3" width="8" height="8" rx="2" />
|
|
622
|
+
<rect x="13" y="3" width="8" height="8" rx="2" />
|
|
623
|
+
<rect x="3" y="13" width="8" height="8" rx="2" />
|
|
624
|
+
<rect x="13" y="13" width="8" height="8" rx="2" />
|
|
625
|
+
</svg>
|
|
626
|
+
`,
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
const typeName = (types, value) => types.find(([v]) => v === value)?.[1] ?? "";
|
|
630
|
+
|
|
631
|
+
/**
|
|
632
|
+
* 유형 고르기 목록 (문제 카드의 유형 버튼을 누르면 버튼 아래에 뜬다). 열고 닫기 · 키보드는 core/editor.js가 붙인다.
|
|
633
|
+
* 꼭 남길 것: role="listbox", 항목마다 role="option" · data-value · aria-selected (고른 항목에는 체크)
|
|
634
|
+
*/
|
|
635
|
+
export const typeMenu = ({ label, types, value }) => html`
|
|
636
|
+
<div class="qe-menu" role="listbox" aria-label="${label}">
|
|
637
|
+
${types.map(
|
|
638
|
+
([v, name]) => html`
|
|
639
|
+
<div
|
|
640
|
+
class="qe-menu-item"
|
|
641
|
+
role="option"
|
|
642
|
+
tabindex="-1"
|
|
643
|
+
data-value="${v}"
|
|
644
|
+
aria-selected="${v === value ? "true" : "false"}"
|
|
645
|
+
>
|
|
646
|
+
${typeIcons[v]?.()}
|
|
647
|
+
<span class="qe-menu-label">${name}</span>
|
|
648
|
+
${v === value && html`<span class="qe-menu-check" aria-hidden="true">${icons.check()}</span>`}
|
|
649
|
+
</div>
|
|
650
|
+
`,
|
|
651
|
+
)}
|
|
652
|
+
</div>
|
|
653
|
+
`;
|
|
654
|
+
|
|
419
655
|
/**
|
|
420
656
|
* 문항 카드. body: 문항 칸들 · types: [[값, 이름], …]
|
|
421
|
-
* data-role="type" (유형 select) · data-role="up" · data-role="down" · data-role="delete"
|
|
657
|
+
* data-role="type" (유형 버튼: 누르면 typeMenu, 브라우저 select를 둬도 됨) · data-role="up" · data-role="down" · data-role="delete"
|
|
422
658
|
* 문항이 하나뿐이면 ↑ · ↓는 숨긴다 (옮길 곳이 없음)
|
|
423
659
|
*/
|
|
424
660
|
export const card = ({ q, index, count, types, body }) => html`
|
|
425
|
-
<section class="qe-card">
|
|
426
|
-
<header class="qe-card-head">
|
|
661
|
+
<section class="qe-card ec-edit-card">
|
|
662
|
+
<header class="qe-card-head ec-edit-card-head">
|
|
427
663
|
<strong>${t.question(index + 1)}</strong>
|
|
428
|
-
<
|
|
429
|
-
|
|
664
|
+
<button
|
|
665
|
+
type="button"
|
|
666
|
+
class="qe-type"
|
|
430
667
|
data-role="type"
|
|
431
|
-
|
|
668
|
+
data-value="${q.type}"
|
|
669
|
+
aria-haspopup="listbox"
|
|
670
|
+
aria-expanded="false"
|
|
671
|
+
aria-label="${t.questionTypeNow(index + 1, typeName(types, q.type))}"
|
|
432
672
|
>
|
|
433
|
-
${
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
</option>`,
|
|
438
|
-
)}
|
|
439
|
-
</select>
|
|
673
|
+
${typeIcons[q.type]?.()}
|
|
674
|
+
<span class="qe-type-label">${typeName(types, q.type)}</span>
|
|
675
|
+
${icons.chevronDown()}
|
|
676
|
+
</button>
|
|
440
677
|
<button
|
|
441
678
|
type="button"
|
|
442
679
|
class="ec-icon-button"
|
|
@@ -477,16 +714,17 @@ export const answerError = ({ text }) =>
|
|
|
477
714
|
</p>`;
|
|
478
715
|
|
|
479
716
|
/**
|
|
480
|
-
* 스낵바 (EDS Snackbar · info): 짧은 알림 +
|
|
717
|
+
* 스낵바 (EDS Snackbar · info): 짧은 알림 + 되돌리기(action이 없으면 알림만). 화면 아래에 떠 있다. data-role="undo" (되돌리기 버튼)
|
|
481
718
|
* 상태 알림이라 role="status" (초점을 가져가지 않고 낭독기가 읽음)
|
|
482
719
|
*/
|
|
483
720
|
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
|
-
|
|
721
|
+
<div class="qe-snackbar ec-snackbar" role="status">
|
|
722
|
+
<span class="qe-snackbar-icon ec-snackbar-icon">${icons.info()}</span>
|
|
723
|
+
<span class="qe-snackbar-text ec-snackbar-text">${text}</span>
|
|
724
|
+
${action &&
|
|
725
|
+
html`<button type="button" class="qe-snackbar-action ec-snackbar-action" data-role="undo">
|
|
488
726
|
${action}
|
|
489
|
-
</button
|
|
727
|
+
</button>`}
|
|
490
728
|
</div>
|
|
491
729
|
`;
|
|
492
730
|
|
|
@@ -499,9 +737,9 @@ export const answersIntro = ({ text }) =>
|
|
|
499
737
|
* textAnswerRow: data-role="input" · "delete" / textAnswerAdd: data-role="add"
|
|
500
738
|
*/
|
|
501
739
|
export const textAnswerRow = ({ index, canDelete }) => html`
|
|
502
|
-
<div class="qe-option qe-text-answer">
|
|
740
|
+
<div class="qe-option qe-text-answer ec-list-row">
|
|
503
741
|
<input
|
|
504
|
-
class="qe-inline-input qe-option-text"
|
|
742
|
+
class="qe-inline-input qe-option-text ec-field-input"
|
|
505
743
|
data-role="input"
|
|
506
744
|
aria-label="${ta.textInput(index)}"
|
|
507
745
|
placeholder="${ta.textInput(index)}"
|
|
@@ -520,13 +758,13 @@ export const textAnswerRow = ({ index, canDelete }) => html`
|
|
|
520
758
|
`;
|
|
521
759
|
|
|
522
760
|
export const textAnswerAdd = () =>
|
|
523
|
-
html`<button type="button" class="qe-add" data-role="add">${ta.addText}</button>`;
|
|
761
|
+
html`<button type="button" class="qe-add ec-list-add" data-role="add">${ta.addText}</button>`;
|
|
524
762
|
|
|
525
|
-
export const textAnswers = ({ rows, add }) => html`<div class="qe-options qe-text-answers">${rows}${add}</div>`;
|
|
763
|
+
export const textAnswers = ({ rows, add }) => html`<div class="qe-options qe-text-answers ec-list">${rows}${add}</div>`;
|
|
526
764
|
|
|
527
765
|
/** 문항 추가 버튼 */
|
|
528
766
|
export const addQuestion = () =>
|
|
529
|
-
html`<button type="button" class="qe-add qe-add-question">
|
|
767
|
+
html`<button type="button" class="qe-add qe-add-question ec-add">
|
|
530
768
|
${t.addQuestion}
|
|
531
769
|
</button>`;
|
|
532
770
|
|
|
@@ -545,7 +783,7 @@ export const groupBox = ({ letter, canDelete, rows, add, nameLabel, namePlacehol
|
|
|
545
783
|
<div class="qe-group-head">
|
|
546
784
|
<span class="qe-group-badge">${letter}</span>
|
|
547
785
|
<input
|
|
548
|
-
class="qe-inline-input qe-group-name"
|
|
786
|
+
class="qe-inline-input qe-group-name ec-field-input"
|
|
549
787
|
data-role="group-name"
|
|
550
788
|
aria-label="${nameLabel}"
|
|
551
789
|
placeholder="${namePlaceholder}"
|
|
@@ -561,7 +799,7 @@ export const groupBox = ({ letter, canDelete, rows, add, nameLabel, namePlacehol
|
|
|
561
799
|
${icons.xmark()}
|
|
562
800
|
</button>
|
|
563
801
|
</div>
|
|
564
|
-
<div class="qe-options">${rows}${add}</div>
|
|
802
|
+
<div class="qe-options ec-list">${rows}${add}</div>
|
|
565
803
|
</div>
|
|
566
804
|
`;
|
|
567
805
|
|
|
@@ -569,7 +807,7 @@ export const noneBox = ({ rows, add, canClose, closeTitle, hint = t.noneHint })
|
|
|
569
807
|
<div class="qe-group qe-group-none" data-group-box>
|
|
570
808
|
<div class="qe-group-head">
|
|
571
809
|
<strong>${t.noneTitle}</strong>
|
|
572
|
-
<span class="qe-hint-inline" title="${hint}">${hint}</span>
|
|
810
|
+
<span class="qe-hint-inline ec-hint-inline" title="${hint}">${hint}</span>
|
|
573
811
|
<button
|
|
574
812
|
type="button"
|
|
575
813
|
class="ec-icon-button ec-danger"
|
|
@@ -581,13 +819,13 @@ export const noneBox = ({ rows, add, canClose, closeTitle, hint = t.noneHint })
|
|
|
581
819
|
${icons.xmark()}
|
|
582
820
|
</button>
|
|
583
821
|
</div>
|
|
584
|
-
<div class="qe-options">${rows}${add}</div>
|
|
822
|
+
<div class="qe-options ec-list">${rows}${add}</div>
|
|
585
823
|
</div>
|
|
586
824
|
`;
|
|
587
825
|
|
|
588
826
|
export const noneAdd = () => html`
|
|
589
|
-
<div class="qe-reveal qe-reveal-card">
|
|
590
|
-
<button type="button" class="qe-reveal-button" data-role="none-add">
|
|
827
|
+
<div class="qe-reveal qe-reveal-card ec-reveal">
|
|
828
|
+
<button type="button" class="qe-reveal-button ec-reveal-button" data-role="none-add">
|
|
591
829
|
<span>${t.addNone}</span><span aria-hidden="true">+</span>
|
|
592
830
|
</button>
|
|
593
831
|
</div>
|
|
@@ -597,7 +835,7 @@ export const noneAdd = () => html`
|
|
|
597
835
|
export const groupBoard = ({ boxes, add, none }) => html`
|
|
598
836
|
<div class="qe-groups">
|
|
599
837
|
${boxes}
|
|
600
|
-
<div class="qe-options">${add}</div>
|
|
838
|
+
<div class="qe-options ec-list">${add}</div>
|
|
601
839
|
${none}
|
|
602
840
|
</div>
|
|
603
841
|
`;
|
|
@@ -607,7 +845,7 @@ export const groupBoard = ({ boxes, add, none }) => html`
|
|
|
607
845
|
* orderList는 끌어 놓을 곳이라 data-group-box와 data-group="order"를 가진다
|
|
608
846
|
*/
|
|
609
847
|
export const orderList = ({ rows, add }) => html`
|
|
610
|
-
<div class="qe-options" data-group-box data-group="order">${rows}${add}</div>
|
|
848
|
+
<div class="qe-options ec-list" data-group-box data-group="order">${rows}${add}</div>
|
|
611
849
|
`;
|
|
612
850
|
|
|
613
851
|
export const orderBoard = ({ list, none }) => html`<div class="qe-groups">${list}${none}</div>`;
|