@eliceio/cdk-cli 0.1.0-alpha.5 → 0.1.0-alpha.6
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 +45 -18
- package/es/commands/build/index.d.ts +1 -1
- package/es/commands/build/index.js +4 -4
- package/es/commands/dev/index.d.ts +1 -1
- package/es/commands/dev/index.js +1 -1
- package/es/commands/doctor/index.js +1 -1
- package/es/core/collect.js +1 -1
- package/es/core/config.js +1 -1
- package/es/core/prepare.js +1 -1
- package/es/core/sandbox.js +6 -3
- package/es/dev/host-page.js +18 -3
- 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 +69 -6
- package/es/rules/csp.d.ts +26 -0
- package/es/rules/csp.js +42 -0
- package/es/rules/index.d.ts +1 -0
- package/es/rules/index.js +1 -0
- 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.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-guide/SKILL.md +1 -1
- package/skills/elice-content-guide/topics/03-create-the-project.md +1 -1
- package/skills/elice-content-guide/topics/04-rules.md +3 -1
- 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-migrate/SKILL.md +4 -3
- package/templates/_shared/lib/cdk-mock.js +1 -1
- package/templates/_shared/lib/elice-content.css +22 -1
- 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/screens/edit.js +105 -24
- package/templates/quiz/styles.css +75 -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 +12 -8
|
@@ -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;
|
|
@@ -446,6 +451,10 @@
|
|
|
446
451
|
grid-row: 2;
|
|
447
452
|
grid-column: 3;
|
|
448
453
|
}
|
|
454
|
+
/* 좁은 화면의 그룹 고르기는 보기 글 아래 줄이라 열 머리를 두지 않는다 (고르기 안의 이름으로 알 수 있음) */
|
|
455
|
+
.qe-option.qe-answer-head-select {
|
|
456
|
+
display: none;
|
|
457
|
+
}
|
|
449
458
|
}
|
|
450
459
|
|
|
451
460
|
/* ---------- 편집 ---------- */
|
|
@@ -564,17 +573,16 @@
|
|
|
564
573
|
flex: 1 1 0;
|
|
565
574
|
min-width: 0;
|
|
566
575
|
}
|
|
567
|
-
/* 보기 줄의 정답 칸: radio · checkbox
|
|
568
|
-
.qe-answer {
|
|
576
|
+
/* 보기 줄의 정답 칸: radio · checkbox (누르는 영역 40px). 이름표는 목록 위 "정답" 열 머리 하나 */
|
|
577
|
+
.qe-answer-col {
|
|
569
578
|
flex: none;
|
|
579
|
+
width: 40px;
|
|
570
580
|
display: flex;
|
|
571
581
|
align-items: center;
|
|
572
|
-
|
|
582
|
+
justify-content: center;
|
|
583
|
+
}
|
|
584
|
+
.qe-answer {
|
|
573
585
|
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
586
|
cursor: pointer;
|
|
579
587
|
}
|
|
580
588
|
.qe-answer input {
|
|
@@ -585,8 +593,32 @@
|
|
|
585
593
|
accent-color: var(--qz-accent);
|
|
586
594
|
cursor: pointer;
|
|
587
595
|
}
|
|
588
|
-
|
|
589
|
-
|
|
596
|
+
/* 정답으로 고른 줄 (그룹은 그룹에 넣은 보기) */
|
|
597
|
+
.qe-option[data-correct] {
|
|
598
|
+
background: var(--qz-accent-soft);
|
|
599
|
+
}
|
|
600
|
+
/* 목록 위 "정답" 열 머리: 줄의 정답 칸과 같은 자리 */
|
|
601
|
+
.qe-answer-head {
|
|
602
|
+
color: var(--eds-text-secondary);
|
|
603
|
+
font-size: var(--eds-fs-caption);
|
|
604
|
+
font-weight: var(--eds-fw-bold);
|
|
605
|
+
}
|
|
606
|
+
.qe-handle-space {
|
|
607
|
+
flex: none;
|
|
608
|
+
width: 32px;
|
|
609
|
+
}
|
|
610
|
+
/* 그룹 분류: 그룹 고르기는 보기 글 뒤, 삭제 버튼(40px) 앞 */
|
|
611
|
+
.qe-answer-head-select {
|
|
612
|
+
justify-content: flex-end;
|
|
613
|
+
}
|
|
614
|
+
.qe-answer-head-select .qe-handle-space {
|
|
615
|
+
display: none;
|
|
616
|
+
}
|
|
617
|
+
.qe-answer-head-select .qe-answer-col {
|
|
618
|
+
flex: 0 1 160px;
|
|
619
|
+
justify-content: flex-start;
|
|
620
|
+
margin-right: 46px;
|
|
621
|
+
padding-left: 12px;
|
|
590
622
|
}
|
|
591
623
|
/* 그룹 분류 보기 줄의 정답 그룹 고르기 */
|
|
592
624
|
.qe-answer-group {
|
|
@@ -594,12 +626,43 @@
|
|
|
594
626
|
width: auto;
|
|
595
627
|
min-width: 0;
|
|
596
628
|
}
|
|
629
|
+
/* 저장하지 못한 정답 (정답을 고르지 않음 등): 정답 묶음을 오류 색으로 */
|
|
630
|
+
.qe-section[data-role='answers'][data-error] > :last-child {
|
|
631
|
+
outline: 1px solid var(--eds-error-main);
|
|
632
|
+
outline-offset: 4px;
|
|
633
|
+
border-radius: var(--eds-radius);
|
|
634
|
+
background: var(--eds-error-background);
|
|
635
|
+
}
|
|
636
|
+
.qe-answer-error {
|
|
637
|
+
margin: 0;
|
|
638
|
+
color: var(--eds-error-main);
|
|
639
|
+
font-size: var(--eds-fs-caption);
|
|
640
|
+
font-weight: var(--eds-fw-bold);
|
|
641
|
+
}
|
|
642
|
+
/* 유형을 바꿔 정답이 초기화됨 */
|
|
643
|
+
.qe-warning {
|
|
644
|
+
margin: 0;
|
|
645
|
+
padding: 8px 12px;
|
|
646
|
+
border-radius: var(--eds-radius);
|
|
647
|
+
background: var(--ec-warn-bg);
|
|
648
|
+
color: var(--eds-warning-dark);
|
|
649
|
+
font-size: var(--eds-fs-caption);
|
|
650
|
+
font-weight: var(--eds-fw-semibold);
|
|
651
|
+
}
|
|
652
|
+
/* 최소 개수라 지울 수 없을 때 목록 아래 안내 */
|
|
653
|
+
.qe-caption {
|
|
654
|
+
margin: 0;
|
|
655
|
+
color: var(--eds-text-tertiary);
|
|
656
|
+
font-size: var(--eds-fs-caption);
|
|
657
|
+
}
|
|
597
658
|
.qe-add {
|
|
598
|
-
align-self:
|
|
659
|
+
align-self: stretch;
|
|
599
660
|
border-style: dashed;
|
|
600
661
|
}
|
|
601
|
-
|
|
602
|
-
|
|
662
|
+
/* 표시 옵션 (답안 순서 섞기 · 해설): 보기 · 정답과 줄로 나눔 */
|
|
663
|
+
.qe-display {
|
|
664
|
+
padding-top: 16px;
|
|
665
|
+
border-top: 1px solid var(--ec-line);
|
|
603
666
|
}
|
|
604
667
|
.qe-switch {
|
|
605
668
|
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
|
|
|
@@ -62,10 +62,11 @@ export const texts = {
|
|
|
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: '해설',
|