@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
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// 학생 화면 예제 "진자의 주기": 단계 3개, 단계마다 다른 콘텐츠 레이아웃 (index.html의 <section data-ec-step data-ec-layout>).
|
|
2
|
+
// 1 도입(single) → 2 실험(stage: 무대 · 실시간 값 · 조작) → 3 정리(split: 정리 글 | 내가 해 본 값)
|
|
3
|
+
// 이전 · 다음 버튼 · n / N · ← → 키 · 단계 제목 초점은 키트 스테퍼(app.useStepper)가 합니다.
|
|
4
|
+
// 내용(app.content)은 편집 화면이 저장한 { title, intro, task, summary, minLength, maxLength }입니다 (screens/edit.js).
|
|
5
|
+
// 이 자료에 맞게 바꿀 곳: index.html의 단계 · 칸, 아래 show()
|
|
6
|
+
import { start } from '../lib/elice-content.js';
|
|
7
|
+
|
|
8
|
+
const G = 9.8;
|
|
9
|
+
const fmt = n => n.toLocaleString('ko-KR', { minimumFractionDigits: 1, maximumFractionDigits: 2 });
|
|
10
|
+
|
|
11
|
+
const app = await start({ screen: 'learn' });
|
|
12
|
+
const root = document.getElementById('app');
|
|
13
|
+
// 편집 화면에서 아직 내용을 저장하지 않았으면 안내만 보인다 (기본 내용은 없음)
|
|
14
|
+
if (app.hasContent) show(app.content);
|
|
15
|
+
else root.replaceChildren(app.emptyState());
|
|
16
|
+
// 불러오는 자리(index.html의 .ec-sk)를 치운다 (빈 안내면 위에서 이미 바뀜)
|
|
17
|
+
root.querySelector(':scope > .ec-sk')?.remove();
|
|
18
|
+
|
|
19
|
+
function show({ title = '', intro = '', task = '', summary = '', minLength = 0.2, maxLength = 3 }) {
|
|
20
|
+
const text = { title, intro, task, summary };
|
|
21
|
+
for (const el of root.querySelectorAll('[data-text]'))
|
|
22
|
+
el.textContent = text[el.dataset.text] ?? '';
|
|
23
|
+
const out = name => root.querySelector(`[data-out="${name}"]`);
|
|
24
|
+
|
|
25
|
+
// 2단계 실험: 줄 길이(m) → 주기 T = 2π√(L/g)
|
|
26
|
+
const min = Math.max(0.1, Number(minLength) || 0.2);
|
|
27
|
+
const max = Math.max(min + 0.1, Number(maxLength) || 3);
|
|
28
|
+
const range = root.querySelector('#length');
|
|
29
|
+
Object.assign(range, { min, max, value: Math.min(max, Math.max(min, 1)) });
|
|
30
|
+
const period = L => 2 * Math.PI * Math.sqrt(L / G);
|
|
31
|
+
/** 학생이 멈춘 길이 (0.1m 단위) → 3단계 표 */
|
|
32
|
+
const tried = new Map();
|
|
33
|
+
|
|
34
|
+
const rod = root.querySelector('.pendulum-rod');
|
|
35
|
+
const bob = root.querySelector('.pendulum-bob');
|
|
36
|
+
const reduced = matchMedia('(prefers-reduced-motion: reduce)').matches;
|
|
37
|
+
let frame = 0;
|
|
38
|
+
let t0 = 0;
|
|
39
|
+
const draw = now => {
|
|
40
|
+
const L = Number(range.value);
|
|
41
|
+
const T = period(L);
|
|
42
|
+
// 화면에서 줄 길이: 가장 긴 줄이 무대 높이의 85%
|
|
43
|
+
const px = 30 + (240 * L) / max;
|
|
44
|
+
const angle = reduced ? 0.35 : 0.35 * Math.cos(((now - t0) / 1000) * ((2 * Math.PI) / T));
|
|
45
|
+
const x = 200 + px * Math.sin(angle);
|
|
46
|
+
const y = 16 + px * Math.cos(angle);
|
|
47
|
+
rod.setAttribute('x2', x.toFixed(1));
|
|
48
|
+
rod.setAttribute('y2', y.toFixed(1));
|
|
49
|
+
bob.setAttribute('cx', x.toFixed(1));
|
|
50
|
+
bob.setAttribute('cy', y.toFixed(1));
|
|
51
|
+
if (!reduced) frame = requestAnimationFrame(draw);
|
|
52
|
+
};
|
|
53
|
+
const play = () => {
|
|
54
|
+
cancelAnimationFrame(frame);
|
|
55
|
+
t0 = performance.now();
|
|
56
|
+
draw(t0);
|
|
57
|
+
};
|
|
58
|
+
const stop = () => cancelAnimationFrame(frame);
|
|
59
|
+
const paint = () => {
|
|
60
|
+
const L = Number(range.value);
|
|
61
|
+
out('length').textContent = `${fmt(L)} m`;
|
|
62
|
+
out('period').textContent = `${fmt(period(L))} 초`;
|
|
63
|
+
range.setAttribute('aria-valuetext', `${fmt(L)} 미터, 주기 ${fmt(period(L))}초`);
|
|
64
|
+
};
|
|
65
|
+
range.addEventListener('input', () => {
|
|
66
|
+
paint();
|
|
67
|
+
play();
|
|
68
|
+
});
|
|
69
|
+
// 손을 뗀 값만 기록: 두 값 이상 해 보면 다음 단계로 (canNext)
|
|
70
|
+
range.addEventListener('change', () => {
|
|
71
|
+
const L = Math.round(Number(range.value) * 10) / 10;
|
|
72
|
+
tried.set(L, period(L));
|
|
73
|
+
stepper.refresh();
|
|
74
|
+
});
|
|
75
|
+
paint();
|
|
76
|
+
|
|
77
|
+
const fillTable = () =>
|
|
78
|
+
out('tried').replaceChildren(
|
|
79
|
+
...[...tried]
|
|
80
|
+
.sort((a, b) => a[0] - b[0])
|
|
81
|
+
.map(([L, T]) => {
|
|
82
|
+
const tr = document.createElement('tr');
|
|
83
|
+
for (const v of [`${fmt(L)} m`, `${fmt(T)} 초`])
|
|
84
|
+
tr.append(Object.assign(document.createElement('td'), { textContent: v }));
|
|
85
|
+
return tr;
|
|
86
|
+
})
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const stepper = app.useStepper({
|
|
90
|
+
// 실험 단계(1)에서는 길이를 두 번 이상 바꿔 봐야 다음으로. 이유는 다음 버튼 툴팁으로 보인다
|
|
91
|
+
canNext: step => step !== 1 || tried.size >= 2 || '줄 길이를 두 번 이상 바꿔 보세요.',
|
|
92
|
+
// 단계를 떠나면 애니메이션을 멈춘다 (타이머 · 소리 · 영상도 같은 곳에서)
|
|
93
|
+
onChange: step => {
|
|
94
|
+
if (step === 1) play();
|
|
95
|
+
else stop();
|
|
96
|
+
if (step === 2) fillTable();
|
|
97
|
+
},
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// 제출을 받으려면 (교육자가 LXP 설정에서 '제출하면 완료'를 고를 수 있게) 주석을 풉니다. 기본은 제출 없음(열면 완료).
|
|
101
|
+
// 제출 바는 root 바로 뒤에 붙는다: 마지막 단계에만 두려면 root를 그 단계 칸 "안"의 요소(여기서는 표)로 준다.
|
|
102
|
+
// 칸(data-ec-region)이나 단계(section)를 주면 바가 칸 밖 · 모든 단계 아래에 붙어 레이아웃이 깨진다 (render.outside-region).
|
|
103
|
+
// 튜터링 때는 root(표)를 잠근다. 스테퍼가 있으면 모바일에서 키트가 바를 아래 버튼 줄 위로 올린다
|
|
104
|
+
// app.useSubmit({
|
|
105
|
+
// root: root.querySelector('.steps-table'),
|
|
106
|
+
// getAnswer: () => ({ tried: [...tried.keys()] }),
|
|
107
|
+
// });
|
|
108
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/* 이 콘텐츠만의 스타일. lib/elice-content.css의 --ec-* 변수(레이아웃은 --ec-layout-* · --ec-panel-width 등)를 덮어써도 됩니다.
|
|
2
|
+
칸 배치는 키트 레이아웃(data-ec-layout · data-ec-region)이 하므로 여기서 grid · position: fixed로 다시 짜지 않습니다 */
|
|
3
|
+
|
|
4
|
+
/* 예제 "진자의 주기" (screens/learn.js). 이 자료에 맞게 바꿀 곳 */
|
|
5
|
+
.steps-lead {
|
|
6
|
+
font-size: var(--eds-fs-body1);
|
|
7
|
+
line-height: var(--eds-lh-body1);
|
|
8
|
+
word-break: keep-all;
|
|
9
|
+
}
|
|
10
|
+
.pendulum {
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 100%;
|
|
13
|
+
}
|
|
14
|
+
.pendulum-ceiling {
|
|
15
|
+
stroke: var(--ec-border);
|
|
16
|
+
stroke-width: 4;
|
|
17
|
+
stroke-linecap: round;
|
|
18
|
+
}
|
|
19
|
+
.pendulum-rod {
|
|
20
|
+
stroke: var(--ec-fg);
|
|
21
|
+
stroke-width: 2;
|
|
22
|
+
}
|
|
23
|
+
.pendulum-bob {
|
|
24
|
+
fill: var(--ec-accent);
|
|
25
|
+
}
|
|
26
|
+
.steps-slider {
|
|
27
|
+
display: flex;
|
|
28
|
+
align-items: center;
|
|
29
|
+
gap: 12px;
|
|
30
|
+
flex: 1;
|
|
31
|
+
font-weight: var(--eds-fw-semibold);
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
}
|
|
34
|
+
.steps-slider input {
|
|
35
|
+
flex: 1;
|
|
36
|
+
padding: 0;
|
|
37
|
+
border: 0;
|
|
38
|
+
background: none;
|
|
39
|
+
accent-color: var(--ec-accent);
|
|
40
|
+
}
|
|
41
|
+
.steps-table {
|
|
42
|
+
border-collapse: collapse;
|
|
43
|
+
font-variant-numeric: tabular-nums;
|
|
44
|
+
}
|
|
45
|
+
.steps-table th,
|
|
46
|
+
.steps-table td {
|
|
47
|
+
padding: 8px 12px;
|
|
48
|
+
border-bottom: 1px solid var(--ec-line);
|
|
49
|
+
text-align: right;
|
|
50
|
+
}
|
|
51
|
+
.steps-table th {
|
|
52
|
+
color: var(--ec-muted);
|
|
53
|
+
font-weight: var(--eds-fw-semibold);
|
|
54
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "steps",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"title": "단계별 자료",
|
|
5
|
+
"description": "여러 단계로 나눈 자료(도입 → 실험 → 정리, 슬라이드 · STEP)를 만들 때. 키트 스테퍼(app.useStepper, 이전 · 다음 · n / N)와 단계마다 다른 콘텐츠 레이아웃(single · stage · split) 예제 \"진자의 주기\"와 내용 JSON 편집기로 시작 (완료 정책은 LXP 자료 편집 화면의 '설정'에서 교육자가 고름)"
|
|
6
|
+
}
|