@eliceio/cdk-cli 1.2.1 → 1.3.0-contenttypes.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.
Files changed (169) hide show
  1. package/README.md +63 -53
  2. package/es/cli.js +11 -2
  3. package/es/commands/build/index.js +12 -0
  4. package/es/commands/create/index.js +2 -0
  5. package/es/commands/create/scaffold.d.ts +2 -2
  6. package/es/commands/create/scaffold.js +3 -3
  7. package/es/commands/dev/index.d.ts +10 -1
  8. package/es/commands/dev/index.js +47 -7
  9. package/es/commands/doctor/index.js +6 -2
  10. package/es/core/config.d.ts +42 -9
  11. package/es/core/config.js +217 -12
  12. package/es/core/project-check.d.ts +3 -2
  13. package/es/core/project-check.js +14 -3
  14. package/es/core/regex.d.ts +11 -0
  15. package/es/core/regex.js +41 -0
  16. package/es/core/sandbox.d.ts +26 -0
  17. package/es/core/sandbox.js +240 -30
  18. package/es/dev/assets.d.ts +80 -0
  19. package/es/dev/assets.js +240 -0
  20. package/es/dev/check.d.ts +30 -0
  21. package/es/dev/check.js +224 -34
  22. package/es/dev/grading.d.ts +49 -14
  23. package/es/dev/grading.js +109 -29
  24. package/es/dev/host-page.js +27 -3
  25. package/es/dev/inject.d.ts +2 -1
  26. package/es/dev/inject.js +10 -2
  27. package/es/dev/mock-api.d.ts +26 -3
  28. package/es/dev/mock-api.js +219 -40
  29. package/es/dev/server.d.ts +12 -1
  30. package/es/dev/server.js +115 -9
  31. package/es/engines/vite/index.js +1 -1
  32. package/es/engines/vite/plugin.d.ts +2 -0
  33. package/es/engines/vite/plugin.js +33 -5
  34. package/es/rules/answers.d.ts +13 -0
  35. package/es/rules/answers.js +94 -0
  36. package/es/rules/check.js +70 -1
  37. package/es/rules/index.d.ts +1 -0
  38. package/es/rules/index.js +1 -0
  39. package/es/rules/size.d.ts +31 -0
  40. package/es/rules/size.js +58 -0
  41. package/es/rules/types.d.ts +12 -0
  42. package/es/rules.json.js +2 -2
  43. package/package.json +2 -2
  44. package/rules.json +34 -5
  45. package/skills/_shared/always.md +3 -3
  46. package/skills/_shared/references/00-what-the-person-decides.md +1 -1
  47. package/skills/_shared/references/02-design-the-material.md +10 -7
  48. package/skills/_shared/references/03-create-the-project.md +10 -8
  49. package/skills/_shared/references/04-rules.md +1 -1
  50. package/skills/_shared/references/05-screen-code.md +52 -23
  51. package/skills/_shared/references/06-using-the-quiz-template.md +7 -6
  52. package/skills/_shared/references/08-fix-check-errors.md +23 -22
  53. package/skills/_shared/references/09-check.md +8 -6
  54. package/skills/_shared/references/12-upload-with-the-material-mcp.md +13 -13
  55. package/skills/_shared/references/13-edit-screen-design.md +122 -0
  56. package/skills/_shared/references/14-layouts.md +96 -0
  57. package/skills/elice-content-check/SKILL.md +2 -2
  58. package/skills/elice-content-create/SKILL.md +1 -1
  59. package/skills/elice-content-migrate/SKILL.md +1 -1
  60. package/skills/elice-content-publish/SKILL.md +1 -1
  61. package/templates/_shared/lib/cdk-mock.d.ts +47 -3
  62. package/templates/_shared/lib/cdk-mock.js +293 -15
  63. package/templates/_shared/lib/elice-content-editor.js +89 -58
  64. package/templates/_shared/lib/elice-content.css +1313 -126
  65. package/templates/_shared/lib/elice-content.d.ts +222 -23
  66. package/templates/_shared/lib/elice-content.js +1176 -88
  67. package/templates/_shared/lib/icons/empty-content.d.ts +2 -0
  68. package/templates/_shared/lib/icons/empty-content.js +11 -0
  69. package/templates/_shared/lib/icons/file-video.d.ts +2 -0
  70. package/templates/_shared/lib/icons/file-video.js +11 -0
  71. package/templates/_shared/lib/icons/file.d.ts +2 -0
  72. package/templates/_shared/lib/icons/file.js +11 -0
  73. package/templates/blank/README.md +6 -4
  74. package/templates/blank/edit.html +8 -2
  75. package/templates/blank/index.html +6 -1
  76. package/templates/blank/instructor.html +6 -1
  77. package/templates/blank/screens/instructor.js +8 -2
  78. package/templates/blank/screens/learn.js +1 -1
  79. package/templates/blank/template.json +1 -1
  80. package/templates/document/README.md +92 -0
  81. package/templates/document/commentary.txt +2 -0
  82. package/templates/document/core/dom.d.ts +13 -0
  83. package/templates/document/core/dom.js +83 -0
  84. package/templates/document/core/file-type.d.ts +21 -0
  85. package/templates/document/core/file-type.js +85 -0
  86. package/templates/document/core/group-3d.d.ts +20 -0
  87. package/templates/document/core/group-3d.js +256 -0
  88. package/templates/document/core/inline-edit.d.ts +15 -0
  89. package/templates/document/core/inline-edit.js +377 -0
  90. package/templates/document/core/load.d.ts +13 -0
  91. package/templates/document/core/load.js +40 -0
  92. package/templates/document/core/pdf-options.d.ts +9 -0
  93. package/templates/document/core/pdf-options.js +36 -0
  94. package/templates/document/core/pdf-worker.d.ts +24 -0
  95. package/templates/document/core/pdf-worker.js +122 -0
  96. package/templates/document/core/pdf.d.ts +12 -0
  97. package/templates/document/core/pdf.js +190 -0
  98. package/templates/document/core/pptx-edit.d.ts +14 -0
  99. package/templates/document/core/pptx-edit.js +137 -0
  100. package/templates/document/core/pptx-fonts.d.ts +5 -0
  101. package/templates/document/core/pptx-fonts.js +115 -0
  102. package/templates/document/core/pptx-media.d.ts +18 -0
  103. package/templates/document/core/pptx-media.js +83 -0
  104. package/templates/document/core/pptx-view.d.ts +5 -0
  105. package/templates/document/core/pptx-view.js +185 -0
  106. package/templates/document/core/settings.d.ts +25 -0
  107. package/templates/document/core/settings.js +86 -0
  108. package/templates/document/core/slide-edges.d.ts +3 -0
  109. package/templates/document/core/slide-edges.js +82 -0
  110. package/templates/document/core/viewer.d.ts +28 -0
  111. package/templates/document/core/viewer.js +159 -0
  112. package/templates/document/edit.html +17 -0
  113. package/templates/document/gitignore +4 -0
  114. package/templates/document/index.html +18 -0
  115. package/templates/document/metadata.json +9 -0
  116. package/templates/document/package.json +17 -0
  117. package/templates/document/public/fonts/OFL-Caladea.txt +93 -0
  118. package/templates/document/public/fonts/OFL-Carlito.txt +93 -0
  119. package/templates/document/public/fonts/caladea-latin-400-normal.woff2 +0 -0
  120. package/templates/document/public/fonts/caladea-latin-700-normal.woff2 +0 -0
  121. package/templates/document/public/fonts/carlito-latin-400-normal.woff2 +0 -0
  122. package/templates/document/public/fonts/carlito-latin-700-normal.woff2 +0 -0
  123. package/templates/document/screens/edit.js +574 -0
  124. package/templates/document/screens/learn.js +61 -0
  125. package/templates/document/styles.css +644 -0
  126. package/templates/document/template.json +6 -0
  127. package/templates/document/ui/templates/edit.js +82 -0
  128. package/templates/document/ui/templates/page.js +11 -0
  129. package/templates/document/ui/templates/viewer.js +41 -0
  130. package/templates/document/ui/texts.d.ts +3 -0
  131. package/templates/document/ui/texts.js +62 -0
  132. package/templates/document/ui/theme.css +69 -0
  133. package/templates/quiz/README.md +32 -14
  134. package/templates/quiz/core/behaviors.d.ts +17 -7
  135. package/templates/quiz/core/behaviors.js +40 -53
  136. package/templates/quiz/core/editor.d.ts +27 -2
  137. package/templates/quiz/core/editor.js +412 -11
  138. package/templates/quiz/core/markdown.d.ts +19 -0
  139. package/templates/quiz/core/markdown.js +225 -11
  140. package/templates/quiz/core/model.d.ts +40 -3
  141. package/templates/quiz/core/model.js +112 -5
  142. package/templates/quiz/core/rich-text.d.ts +18 -0
  143. package/templates/quiz/core/rich-text.js +469 -0
  144. package/templates/quiz/edit.html +12 -3
  145. package/templates/quiz/index.html +12 -3
  146. package/templates/quiz/public/img/mascot-half.webp +0 -0
  147. package/templates/quiz/screens/edit.js +331 -49
  148. package/templates/quiz/screens/learn.js +147 -15
  149. package/templates/quiz/styles.css +1244 -622
  150. package/templates/quiz/template.json +9 -2
  151. package/templates/quiz/ui/templates/edit.d.ts +19 -5
  152. package/templates/quiz/ui/templates/edit.js +371 -77
  153. package/templates/quiz/ui/templates/group.js +19 -8
  154. package/templates/quiz/ui/templates/order.js +25 -24
  155. package/templates/quiz/ui/templates/page.js +33 -8
  156. package/templates/quiz/ui/templates/question.js +6 -4
  157. package/templates/quiz/ui/texts.js +91 -26
  158. package/templates/quiz/ui/theme.css +8 -9
  159. package/templates/steps/README.md +77 -0
  160. package/templates/steps/commentary.txt +7 -0
  161. package/templates/steps/edit.html +21 -0
  162. package/templates/steps/gitignore +4 -0
  163. package/templates/steps/index.html +69 -0
  164. package/templates/steps/metadata.json +9 -0
  165. package/templates/steps/package.json +13 -0
  166. package/templates/steps/screens/edit.js +32 -0
  167. package/templates/steps/screens/learn.js +108 -0
  168. package/templates/steps/styles.css +54 -0
  169. package/templates/steps/template.json +6 -0
@@ -0,0 +1,32 @@
1
+ // 내용 편집 화면(CMS). 내용(JSON)의 모양과 칸 설명만 적으면 키트 편집기가 폼 보기 · 코드 보기를 그립니다.
2
+ // 저장 버튼과 저장 문구는 키트(useSave)가 합니다. 여기서 저장한 값이 학생 화면의 app.content가 됩니다.
3
+ // 정답은 넣지 마세요(학생에게 공개). 이 예제는 채점하지 않습니다.
4
+ import { start } from '../lib/elice-content.js';
5
+ import { useContentEditor } from '../lib/elice-content-editor.js';
6
+
7
+ const app = await start({ screen: 'edit' });
8
+
9
+ // 이 자료에 맞게 바꿀 곳: 내용 모양(학생 화면 screens/learn.js가 읽는 키)과 칸 이름 · 규칙
10
+ const schema = {
11
+ title: { label: '제목', required: true },
12
+ intro: { label: '1단계 도입 글', multiline: true, required: true },
13
+ task: { label: '2단계 실험 안내', multiline: true },
14
+ minLength: { label: '가장 짧은 줄 (m)', type: 'number', min: 0.1, max: 10 },
15
+ maxLength: { label: '가장 긴 줄 (m)', type: 'number', min: 0.2, max: 10 },
16
+ summary: { label: '3단계 정리 글', multiline: true, required: true },
17
+ };
18
+
19
+ // 이 자료에 맞게 바꿀 곳: 아직 저장한 내용이 없을 때 편집기가 보여 줄 견본 (기본 내용 파일은 없음)
20
+ const sample = {
21
+ title: '진자의 주기는 무엇으로 정해질까?',
22
+ intro:
23
+ '그네 줄이 길면 천천히, 짧으면 빠르게 흔들립니다. 진자가 한 번 왕복하는 시간(주기)이 줄 길이에 따라 어떻게 바뀌는지 실험해 봅니다.',
24
+ task: '줄 길이를 바꾸며 주기가 어떻게 달라지는지 보세요. 두 번 이상 바꿔 봐야 다음 단계로 갈 수 있습니다.',
25
+ minLength: 0.2,
26
+ maxLength: 3,
27
+ summary:
28
+ '줄이 길수록 주기가 깁니다. 길이를 4배로 늘리면 주기는 2배가 됩니다 (T = 2π√(L/g)). 추의 무게나 작은 흔들림의 폭은 주기를 거의 바꾸지 않습니다.',
29
+ };
30
+
31
+ const editor = useContentEditor(app, { initial: sample, schema });
32
+ app.useSave({ getContent: editor.getContent, validate: editor.validate });
@@ -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
+ }