@eliceio/cdk-cli 1.6.0-entryqa.0 → 1.6.0-entryqa.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/package.json +2 -2
- package/skills/_shared/references/02-design-the-material.md +1 -1
- package/skills/_shared/references/12-upload-with-the-material-mcp.md +1 -1
- package/templates/document/template.json +3 -2
- package/templates/entry/README.md +6 -7
- package/templates/entry/core/grading.d.ts +1 -0
- package/templates/entry/core/grading.js +14 -0
- package/templates/entry/docs/storage.md +2 -2
- package/templates/entry/screens/edit/panels/grading.js +155 -44
- package/templates/entry/screens/edit/panels/preference.js +19 -1
- package/templates/entry/screens/edit/panels/project-panel.js +24 -28
- package/templates/entry/screens/edit.js +33 -3
- package/templates/entry/screens/learn.js +29 -16
- package/templates/entry/styles.css +230 -65
- package/templates/entry/ui/templates/page.js +31 -6
- package/templates/entry/ui/texts.js +48 -52
- package/templates/quiz/README.md +1 -1
- package/templates/quiz/template.json +3 -2
- package/templates/survey/README.md +1 -0
- package/templates/survey/template.json +3 -2
- package/templates/video/template.json +3 -2
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
// 작품 패널 만들기: 워크스페이스(?mode=skeleton) 하나 +
|
|
1
|
+
// 작품 패널 만들기: 워크스페이스(?mode=skeleton) 하나 + 아래 줄(왼쪽 안내 목록 · 오른쪽 용량 칩). 시작 화면 · 정답 작품 패널이 씁니다.
|
|
2
2
|
// 저장 직전 워크스페이스에서 작품을 꺼내 core/pack.js 모양({ enc: 'gzip+base64', data })으로 줄입니다.
|
|
3
|
-
//
|
|
3
|
+
// 용량: 블록이 바뀌면 2초 뒤 작품을 꺼내 settings 전체 크기를 다시 재고(칩은 screens/edit.js가 두 탭 모두 같이 바꿈),
|
|
4
|
+
// 저장할 때 다시 잽니다. settings 전체가 서버 한도(64KB)를 넘으면 칩 위에 빨간 글을 띄우고 저장을 막습니다.
|
|
4
5
|
import { infoList } from '../../../lib/elice-content.js';
|
|
5
6
|
import { html } from '../../../core/dom.js';
|
|
6
7
|
import { packedProject } from '../../../core/grading.js';
|
|
7
|
-
import { formatBytes,
|
|
8
|
+
import { formatBytes, pack } from '../../../core/pack.js';
|
|
8
9
|
import { LIMITS } from '../../../core/settings.js';
|
|
10
|
+
import { texts } from '../../../ui/texts.js';
|
|
9
11
|
|
|
10
12
|
const MEASURE_DELAY_MS = 2000;
|
|
11
13
|
|
|
@@ -13,7 +15,7 @@ const MEASURE_DELAY_MS = 2000;
|
|
|
13
15
|
* @param {{
|
|
14
16
|
* id: string,
|
|
15
17
|
* tab: string,
|
|
16
|
-
* t: { title: string, info: string[],
|
|
18
|
+
* t: { title: string, info: string[], noProject: string },
|
|
17
19
|
* lazy?: boolean, // 탭을 처음 열 때 워크스페이스를 띄움 (그 전에는 저장된 값을 그대로 저장)
|
|
18
20
|
* secret?: boolean, // settings.entry가 아니라 settings.grading에 저장 (학생에게 안 감). normalize는 app.grading을 받음
|
|
19
21
|
* fromGrading?: (grading: unknown) => unknown,
|
|
@@ -27,22 +29,10 @@ export function projectPanel({ id, tab, t, lazy = false, secret = false, fromGra
|
|
|
27
29
|
secret,
|
|
28
30
|
normalize: raw => packedProject(secret ? fromGrading(raw) : raw),
|
|
29
31
|
render(el, ctx) {
|
|
30
|
-
const size = html`<p class="en-size" data-ec-quiet role="status">${t.sizeUnknown}</p>`;
|
|
31
32
|
const info = infoList(t.info);
|
|
32
33
|
info.setAttribute('data-ec-quiet', '');
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/** 크기 줄: 줄인 작품 크기와 settings 전체 크기 */
|
|
36
|
-
const paint = packed => {
|
|
37
|
-
const total = ctx.settingsBytes(packed);
|
|
38
|
-
size.textContent = t.size(
|
|
39
|
-
formatBytes(jsonBytes(packed)),
|
|
40
|
-
formatBytes(total),
|
|
41
|
-
formatBytes(LIMITS.settingsBytes)
|
|
42
|
-
);
|
|
43
|
-
size.dataset.over = String(total > LIMITS.settingsBytes);
|
|
44
|
-
};
|
|
45
|
-
if (ctx.value) paint(ctx.value);
|
|
34
|
+
const footer = html`<div class="en-panel-footer">${info}${ctx.sizeBox()}</div>`;
|
|
35
|
+
el.append(footer);
|
|
46
36
|
|
|
47
37
|
let timer = null;
|
|
48
38
|
const open = () => {
|
|
@@ -52,28 +42,31 @@ export function projectPanel({ id, tab, t, lazy = false, secret = false, fromGra
|
|
|
52
42
|
el.prepend(ws.element);
|
|
53
43
|
const measure = () => {
|
|
54
44
|
clearTimeout(timer);
|
|
55
|
-
timer = setTimeout(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
45
|
+
timer = setTimeout(
|
|
46
|
+
async () => {
|
|
47
|
+
try {
|
|
48
|
+
ctx.measured(await pack(await ws.getProject()));
|
|
49
|
+
} catch {
|
|
50
|
+
// 꺼내지 못하면(파이썬 문법 오류 등) 칩은 그대로, 저장할 때 다시 시도
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
MEASURE_DELAY_MS
|
|
54
|
+
);
|
|
62
55
|
};
|
|
63
56
|
// 워크스페이스 안에서 바뀐 것은 이 화면의 입력 이벤트가 아니므로 직접 '저장하지 않은 변경'으로 표시한다
|
|
64
57
|
ws.onChange(() => {
|
|
65
58
|
ctx.markDirty();
|
|
66
59
|
measure();
|
|
67
60
|
});
|
|
61
|
+
// 워크스페이스 '저장하기'로 받은 작품도 저장 바의 '저장하지 않은 변경'으로 (아래 저장을 눌러야 저장됨)
|
|
68
62
|
ctx.onHeld(() => {
|
|
69
63
|
ctx.markDirty();
|
|
70
|
-
size.textContent = t.heldFromMenu;
|
|
71
64
|
measure();
|
|
72
65
|
});
|
|
73
66
|
};
|
|
74
67
|
if (lazy) ctx.onShow(() => ctx.opened || open());
|
|
75
68
|
else open();
|
|
76
|
-
ctx.onCollected(
|
|
69
|
+
ctx.onCollected(packed => ctx.measured(packed));
|
|
77
70
|
},
|
|
78
71
|
/** 저장 직전: 워크스페이스에서 지금 작품을 꺼내 줄인다 (워크스페이스 '저장하기'로 받은 작품이 있으면 그것). 열지 않았으면 저장된 값 */
|
|
79
72
|
async collect(ctx) {
|
|
@@ -90,7 +83,10 @@ export function projectPanel({ id, tab, t, lazy = false, secret = false, fromGra
|
|
|
90
83
|
},
|
|
91
84
|
validate(value, { settingsBytes }) {
|
|
92
85
|
if (settingsBytes > LIMITS.settingsBytes)
|
|
93
|
-
return
|
|
86
|
+
return texts.edit.size.tooLarge(
|
|
87
|
+
formatBytes(settingsBytes),
|
|
88
|
+
formatBytes(LIMITS.settingsBytes)
|
|
89
|
+
);
|
|
94
90
|
return true;
|
|
95
91
|
},
|
|
96
92
|
};
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
import { start } from '../lib/elice-content.js';
|
|
12
12
|
import { part } from '../core/dom.js';
|
|
13
13
|
import { buildGrading, hasGradable, hasUnknownObject, projectObjects } from '../core/grading.js';
|
|
14
|
-
import { jsonBytes, unpack } from '../core/pack.js';
|
|
15
|
-
import { joinSettings, splitSettings } from '../core/settings.js';
|
|
14
|
+
import { formatBytes, jsonBytes, unpack } from '../core/pack.js';
|
|
15
|
+
import { joinSettings, LIMITS, splitSettings } from '../core/settings.js';
|
|
16
16
|
import { connectWorkspace } from '../core/workspace.js';
|
|
17
|
-
import { loading, panelSection, tabCard, unavailable } from '../ui/templates/page.js';
|
|
17
|
+
import { loading, panelSection, sizeBox, tabCard, unavailable } from '../ui/templates/page.js';
|
|
18
18
|
import { texts } from '../ui/texts.js';
|
|
19
19
|
import panels from './edit/panels/index.js';
|
|
20
20
|
|
|
@@ -107,6 +107,22 @@ async function reloadWorkspaces() {
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
+
// 용량 칩 (작품 패널 아래 오른쪽, 탭마다 하나): settings 전체 크기 / 서버 한도. 넘으면 칩 위에 빨간 글
|
|
111
|
+
const sizeBoxes = [];
|
|
112
|
+
let lastTotal = null;
|
|
113
|
+
function showTotal(total) {
|
|
114
|
+
lastTotal = total;
|
|
115
|
+
const over = total > LIMITS.settingsBytes;
|
|
116
|
+
for (const { chip, message } of sizeBoxes) {
|
|
117
|
+
chip.textContent = texts.edit.size.chip(formatBytes(total), formatBytes(LIMITS.settingsBytes));
|
|
118
|
+
chip.dataset.over = String(over);
|
|
119
|
+
message.textContent = over
|
|
120
|
+
? texts.edit.size.tooLarge(formatBytes(total), formatBytes(LIMITS.settingsBytes))
|
|
121
|
+
: '';
|
|
122
|
+
message.hidden = !over;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
110
126
|
/** 탭을 보일 때 부를 것 (패널마다) */
|
|
111
127
|
const showListeners = new Map(panels.map(p => [p, new Set()]));
|
|
112
128
|
|
|
@@ -126,6 +142,7 @@ const contexts = new Map(
|
|
|
126
142
|
save.markDirty();
|
|
127
143
|
if (panel.toPreference) void reloadWorkspaces();
|
|
128
144
|
if (panel.id === 'grading') paintStartWarning();
|
|
145
|
+
showTotal(totalBytes({}));
|
|
129
146
|
},
|
|
130
147
|
markDirty: () => save.markDirty(),
|
|
131
148
|
/** 이 패널 탭의 워크스페이스 (처음 부르면 띄움) */
|
|
@@ -148,6 +165,17 @@ const contexts = new Map(
|
|
|
148
165
|
onShow: cb => showListeners.get(panel).add(cb),
|
|
149
166
|
/** 이 패널 값이 v일 때 settings 전체 크기 (바이트, grading 포함) */
|
|
150
167
|
settingsBytes: v => totalBytes({ [panel.id]: v }),
|
|
168
|
+
/** 용량 칩 하나 (작품 패널 아래). 칩은 모든 탭이 같은 값 */
|
|
169
|
+
sizeBox() {
|
|
170
|
+
const box = sizeBox();
|
|
171
|
+
sizeBoxes.push({ chip: part(box, 'size-chip'), message: part(box, 'size-message') });
|
|
172
|
+
showTotal(lastTotal ?? totalBytes({}));
|
|
173
|
+
return box;
|
|
174
|
+
},
|
|
175
|
+
/** 워크스페이스에서 잰 이 패널의 작품(줄인 것)으로 용량 칩을 다시 그림 */
|
|
176
|
+
measured: v => showTotal(totalBytes({ [panel.id]: v })),
|
|
177
|
+
/** 이 패널의 탭을 보임 (저장 전 검사가 문제 칸으로 옮길 때) */
|
|
178
|
+
showTab: () => selectTab?.(panel.tab),
|
|
151
179
|
/** 워크스페이스 '저장하기'로 작품을 받았을 때 */
|
|
152
180
|
onHeld: cb => heldListeners[wsName].add(cb),
|
|
153
181
|
/** 받은 작품을 가져가고 비운다 (없으면 null) */
|
|
@@ -172,6 +200,7 @@ const sections = panels.map(panel => {
|
|
|
172
200
|
root.replaceChildren(...sections);
|
|
173
201
|
|
|
174
202
|
// 탭 카드: 탭이 있는 패널을 모아 첫 탭 패널 자리에 둔다
|
|
203
|
+
let selectTab = null;
|
|
175
204
|
const tabbed = panels.map((panel, i) => ({ panel, section: sections[i] })).filter(x => x.panel.tab);
|
|
176
205
|
const tabNames = [...new Set(tabbed.map(x => x.panel.tab))];
|
|
177
206
|
if (tabbed.length) {
|
|
@@ -203,6 +232,7 @@ if (tabbed.length) {
|
|
|
203
232
|
select(tabs[(i + step + tabs.length) % tabs.length].dataset.tab, true);
|
|
204
233
|
});
|
|
205
234
|
}
|
|
235
|
+
selectTab = select;
|
|
206
236
|
select(tabNames[0]);
|
|
207
237
|
}
|
|
208
238
|
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
// 학생 화면. 엔트리 워크스페이스(?mode=user)를 화면 가득 띄우고, 작품을 자동 저장하고, 제출 버튼으로 작품을 냅니다.
|
|
2
|
-
// 채점: 편집 화면이 저장한 settings.grading(일반 · AI 채점, 학생에게는 내려오지 않음)으로 서버가 채점합니다. 아래 줄에 최종 제출
|
|
2
|
+
// 채점: 편집 화면이 저장한 settings.grading(일반 · AI 채점, 학생에게는 내려오지 않음)으로 서버가 채점합니다. 아래 줄에 '최종 제출 : N점 (11월 25일 오후 02:05)',
|
|
3
3
|
// 일반 채점이면 '올바르게 작성했어요' · '틀렸어요. 다시 해보세요.'(LXP 문구), AI 채점이면 'AI 채점' 표시 · 기다림 문구와
|
|
4
|
-
// 기준별 피드백(서버 grading_feedback)을 'AI 피드백 보기'로 보여 줍니다. 채점 설정이 없으면 점수는 '--'.
|
|
5
|
-
// 채점 방식은 app.gradingMode(SDK material.gradingMode, 서버 /me grading_mode)로 압니다.
|
|
6
|
-
//
|
|
4
|
+
// 기준별 피드백(서버 grading_feedback)을 'AI 피드백 보기'로 보여 줍니다. 제출 전에는 비우고, 채점 설정이 없으면 점수는 '--'.
|
|
5
|
+
// 채점 방식은 app.gradingMode(SDK material.gradingMode, 서버 /me grading_mode)로 압니다. gradingMode · 제출 결과의
|
|
6
|
+
// gradingFeedback은 SDK 1.6.0부터 옵니다. 그 전 SDK는 gradingMode가 null이라 'AI 채점' 표시를 하지 않고, submit()이
|
|
7
|
+
// gradingFeedback을 버려서 제출 직후에는 결과 문구 · 피드백이 안 나오고 다시 열 때(history) 나옵니다.
|
|
7
8
|
//
|
|
8
9
|
// 여는 작품: kvstore 'entry'에 저장한 작품 → 없으면 편집 화면의 시작 작품(settings.entry.startProject) → 없으면 엔트리 기본 작품
|
|
9
10
|
// 자동 저장: 워크스페이스가 블록이 바뀔 때마다 보내는 UPDATED_PROJECT를 2초 모아 → TO_GET_PROJECT로 작품을 꺼내 → kvstore 'entry'.
|
|
10
11
|
// 워크스페이스 안 '저장하기'(SAVE_PROJECT)도 같은 칸에 바로 저장합니다.
|
|
11
12
|
// 제출: TO_GET_PROJECT → 줄인 작품 { v, project } → app.submit. 64KB를 넘으면 막고 안내합니다.
|
|
12
|
-
// 화면 배치:
|
|
13
|
+
// 화면 배치: 워크스페이스 · 아래 파란 줄(저장 표시 · 오류 · 최종 제출 · 제출하기) — ui/templates/page.js
|
|
13
14
|
// 튜터링(보기 전용) · 편집기 미리보기는 저장 · 제출하지 않습니다 (튜터는 학생이 저장한 작품을 봄).
|
|
14
15
|
// 저장 칸 · 모양 표: docs/storage.md
|
|
15
16
|
import { start } from '../lib/elice-content.js';
|
|
@@ -75,7 +76,9 @@ async function show() {
|
|
|
75
76
|
|
|
76
77
|
const time = d => d.toLocaleTimeString('ko-KR', { hour: '2-digit', minute: '2-digit' });
|
|
77
78
|
const pad = n => String(n).padStart(2, '0');
|
|
78
|
-
|
|
79
|
+
/** 최종 제출 시각: 11월 25일 오후 02:05 */
|
|
80
|
+
const dateTime = d =>
|
|
81
|
+
`${d.getMonth() + 1}월 ${d.getDate()}일 ${d.getHours() < 12 ? '오전' : '오후'} ${pad(d.getHours() % 12 || 12)}:${pad(d.getMinutes())}`;
|
|
79
82
|
/** 저장 표시. 저장됨이면 앞에 체크 표시 */
|
|
80
83
|
const setStatus = (text, check = false) => {
|
|
81
84
|
status.replaceChildren();
|
|
@@ -112,7 +115,8 @@ async function show() {
|
|
|
112
115
|
onState: (state, info) => {
|
|
113
116
|
if (state === 'idle') return;
|
|
114
117
|
if (state === 'saved') setStatus(t.save.saved(time(info.at ?? new Date())), true);
|
|
115
|
-
else if (state === 'error')
|
|
118
|
+
else if (state === 'error')
|
|
119
|
+
setStatus(t.save.error(info.error?.message ?? String(info.error)));
|
|
116
120
|
else setStatus(t.save[state]);
|
|
117
121
|
},
|
|
118
122
|
});
|
|
@@ -153,9 +157,11 @@ async function show() {
|
|
|
153
157
|
|
|
154
158
|
if (!submitButton) return;
|
|
155
159
|
|
|
156
|
-
/** 최종 제출 점수 ·
|
|
160
|
+
/** 최종 제출 점수 · 시각 (한 줄, 제출 기록이 없으면 비움) */
|
|
157
161
|
const showFinal = (score, at) => {
|
|
158
|
-
submitted.textContent =
|
|
162
|
+
submitted.textContent = at
|
|
163
|
+
? t.lastSubmission(typeof score === 'number' ? score : null, dateTime(at))
|
|
164
|
+
: '';
|
|
159
165
|
};
|
|
160
166
|
/**
|
|
161
167
|
* 일반 채점 결과 문구. 채점 방식을 모르면(옛 SDK) grading_feedback이 일반 모양({ criteria: [] })일 때만.
|
|
@@ -164,9 +170,15 @@ async function show() {
|
|
|
164
170
|
const showVerdict = (isCorrect, gradingFeedback) => {
|
|
165
171
|
const general =
|
|
166
172
|
gradingMode === 'general' ||
|
|
167
|
-
(gradingMode === null &&
|
|
173
|
+
(gradingMode === null &&
|
|
174
|
+
Array.isArray(gradingFeedback?.criteria) &&
|
|
175
|
+
!gradingFeedback.criteria.length);
|
|
168
176
|
verdict.textContent =
|
|
169
|
-
general && typeof isCorrect === 'boolean'
|
|
177
|
+
general && typeof isCorrect === 'boolean'
|
|
178
|
+
? isCorrect
|
|
179
|
+
? t.verdict.correct
|
|
180
|
+
: t.verdict.wrong
|
|
181
|
+
: '';
|
|
170
182
|
};
|
|
171
183
|
/** AI 채점 피드백 { message, criteria: [{ feedback }] }. 글이 없으면(일반 채점 · 채점 없음) 버튼을 숨김 */
|
|
172
184
|
const showFeedback = value => {
|
|
@@ -181,10 +193,12 @@ async function show() {
|
|
|
181
193
|
if (message) items.push(html`<p class="en-feedback-message">${message}</p>`);
|
|
182
194
|
criteria.forEach((text, i) => {
|
|
183
195
|
if (text)
|
|
184
|
-
items.push(
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
196
|
+
items.push(
|
|
197
|
+
html`<div class="en-feedback-item">
|
|
198
|
+
<p class="en-feedback-label">${t.feedback.criterion(i + 1)}</p>
|
|
199
|
+
<p>${text}</p>
|
|
200
|
+
</div>`
|
|
201
|
+
);
|
|
188
202
|
});
|
|
189
203
|
feedbackBody.replaceChildren(...items);
|
|
190
204
|
};
|
|
@@ -195,7 +209,6 @@ async function show() {
|
|
|
195
209
|
}
|
|
196
210
|
feedbackToggle.addEventListener('click', () => setFeedbackOpen(feedback.hidden));
|
|
197
211
|
|
|
198
|
-
showFinal(null, null);
|
|
199
212
|
// 마지막 제출 (기록에서): 점수 · 시각 · AI 피드백
|
|
200
213
|
app
|
|
201
214
|
.lastSubmission()
|