@eliceio/cdk-cli 0.0.0-stage → 0.1.0-alpha.2

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 (141) hide show
  1. package/README.md +526 -2
  2. package/es/bin/index.d.ts +2 -0
  3. package/es/bin/index.js +10 -0
  4. package/es/cli.d.ts +5 -0
  5. package/es/cli.js +209 -0
  6. package/es/commands/build/index.d.ts +30 -0
  7. package/es/commands/build/index.js +163 -0
  8. package/es/commands/check/index.d.ts +9 -0
  9. package/es/commands/check/index.js +31 -0
  10. package/es/commands/create/index.d.ts +8 -0
  11. package/es/commands/create/index.js +22 -0
  12. package/es/commands/create/scaffold.d.ts +24 -0
  13. package/es/commands/create/scaffold.js +82 -0
  14. package/es/commands/dev/index.d.ts +6 -0
  15. package/es/commands/dev/index.js +40 -0
  16. package/es/commands/doctor/index.d.ts +34 -0
  17. package/es/commands/doctor/index.js +311 -0
  18. package/es/commands/guide/index.d.ts +29 -0
  19. package/es/commands/guide/index.js +120 -0
  20. package/es/commands/skill/index.d.ts +48 -0
  21. package/es/commands/skill/index.js +173 -0
  22. package/es/core/collect.d.ts +21 -0
  23. package/es/core/collect.js +89 -0
  24. package/es/core/config.d.ts +55 -0
  25. package/es/core/config.js +109 -0
  26. package/es/core/manifest.d.ts +15 -0
  27. package/es/core/manifest.js +43 -0
  28. package/es/core/minify.d.ts +18 -0
  29. package/es/core/minify.js +93 -0
  30. package/es/core/prepare.d.ts +12 -0
  31. package/es/core/prepare.js +86 -0
  32. package/es/core/protocol.d.ts +2 -0
  33. package/es/core/protocol.js +4 -0
  34. package/es/core/sandbox.d.ts +17 -0
  35. package/es/core/sandbox.js +182 -0
  36. package/es/core/zip.d.ts +4 -0
  37. package/es/core/zip.js +17 -0
  38. package/es/dev/grading.d.ts +15 -0
  39. package/es/dev/grading.js +37 -0
  40. package/es/dev/host-page.d.ts +7 -0
  41. package/es/dev/host-page.js +240 -0
  42. package/es/dev/inject.d.ts +8 -0
  43. package/es/dev/inject.js +38 -0
  44. package/es/dev/mock-api.d.ts +65 -0
  45. package/es/dev/mock-api.js +269 -0
  46. package/es/dev/server.d.ts +25 -0
  47. package/es/dev/server.js +309 -0
  48. package/es/engines/static/index.d.ts +3 -0
  49. package/es/engines/static/index.js +11 -0
  50. package/es/engines/types.d.ts +12 -0
  51. package/es/engines/vite/index.d.ts +2 -0
  52. package/es/engines/vite/index.js +4 -0
  53. package/es/index.d.ts +2 -0
  54. package/es/index.js +2 -0
  55. package/es/rules/check.d.ts +2 -0
  56. package/es/rules/check.js +282 -0
  57. package/es/rules/index.d.ts +8 -0
  58. package/es/rules/index.js +7 -0
  59. package/es/rules/manifest.d.ts +39 -0
  60. package/es/rules/manifest.js +168 -0
  61. package/es/rules/node.d.ts +11 -0
  62. package/es/rules/node.js +87 -0
  63. package/es/rules/path.d.ts +7 -0
  64. package/es/rules/path.js +35 -0
  65. package/es/rules/refs.d.ts +19 -0
  66. package/es/rules/refs.js +111 -0
  67. package/es/rules/skip.d.ts +12 -0
  68. package/es/rules/skip.js +55 -0
  69. package/es/rules/spec.d.ts +3 -0
  70. package/es/rules/spec.js +6 -0
  71. package/es/rules/types.d.ts +140 -0
  72. package/es/rules/unused.d.ts +7 -0
  73. package/es/rules/unused.js +21 -0
  74. package/es/rules/zip.d.ts +13 -0
  75. package/es/rules/zip.js +45 -0
  76. package/es/rules.json.js +3 -0
  77. package/es/types.d.ts +4 -0
  78. package/es/version.d.ts +2 -0
  79. package/es/version.js +7 -0
  80. package/guides/content-development.md +207 -0
  81. package/package.json +50 -3
  82. package/rules.json +608 -0
  83. package/skills/_shared/always.md +7 -0
  84. package/skills/elice-content-check/SKILL.md +22 -0
  85. package/skills/elice-content-create/SKILL.md +21 -0
  86. package/skills/elice-content-migrate/SKILL.md +21 -0
  87. package/templates/_shared/lib/cdk-mock.d.ts +94 -0
  88. package/templates/_shared/lib/cdk-mock.js +429 -0
  89. package/templates/_shared/lib/cdk.js +3 -0
  90. package/templates/_shared/lib/elice-content.css +262 -0
  91. package/templates/_shared/lib/elice-content.d.ts +123 -0
  92. package/templates/_shared/lib/elice-content.js +534 -0
  93. package/templates/_shared/lib/elice-tokens.css +446 -0
  94. package/templates/blank/README.md +64 -0
  95. package/templates/blank/commentary.txt +2 -0
  96. package/templates/blank/content.json +4 -0
  97. package/templates/blank/edit.html +15 -0
  98. package/templates/blank/elice.config.json +12 -0
  99. package/templates/blank/gitignore +3 -0
  100. package/templates/blank/index.html +15 -0
  101. package/templates/blank/instructor.html +15 -0
  102. package/templates/blank/screens/edit.js +21 -0
  103. package/templates/blank/screens/instructor.js +9 -0
  104. package/templates/blank/screens/learn.js +19 -0
  105. package/templates/blank/styles.css +1 -0
  106. package/templates/quiz/README.md +108 -0
  107. package/templates/quiz/commentary.txt +2 -0
  108. package/templates/quiz/content.json +81 -0
  109. package/templates/quiz/core/behaviors.d.ts +59 -0
  110. package/templates/quiz/core/behaviors.js +310 -0
  111. package/templates/quiz/core/dom.d.ts +13 -0
  112. package/templates/quiz/core/dom.js +83 -0
  113. package/templates/quiz/core/editor.d.ts +48 -0
  114. package/templates/quiz/core/editor.js +206 -0
  115. package/templates/quiz/core/markdown.d.ts +2 -0
  116. package/templates/quiz/core/markdown.js +84 -0
  117. package/templates/quiz/core/model.d.ts +20 -0
  118. package/templates/quiz/core/model.js +203 -0
  119. package/templates/quiz/edit.html +17 -0
  120. package/templates/quiz/elice.config.json +14 -0
  121. package/templates/quiz/gitignore +3 -0
  122. package/templates/quiz/grading.json +13 -0
  123. package/templates/quiz/index.html +17 -0
  124. package/templates/quiz/instructor.html +17 -0
  125. package/templates/quiz/screens/edit.js +139 -0
  126. package/templates/quiz/screens/instructor.js +27 -0
  127. package/templates/quiz/screens/learn.js +55 -0
  128. package/templates/quiz/styles.css +570 -0
  129. package/templates/quiz/ui/templates/choice.js +22 -0
  130. package/templates/quiz/ui/templates/edit.d.ts +13 -0
  131. package/templates/quiz/ui/templates/edit.js +183 -0
  132. package/templates/quiz/ui/templates/group.js +68 -0
  133. package/templates/quiz/ui/templates/index.d.ts +5 -0
  134. package/templates/quiz/ui/templates/index.js +17 -0
  135. package/templates/quiz/ui/templates/order.js +35 -0
  136. package/templates/quiz/ui/templates/page.js +29 -0
  137. package/templates/quiz/ui/templates/question.js +28 -0
  138. package/templates/quiz/ui/templates/text.js +16 -0
  139. package/templates/quiz/ui/texts.d.ts +3 -0
  140. package/templates/quiz/ui/texts.js +127 -0
  141. package/templates/quiz/ui/theme.css +50 -0
@@ -0,0 +1,183 @@
1
+ // 내용 편집 화면(CMS)의 HTML 조각. 값 넣기 · 입력 반영 · 끌어서 순서 바꾸기는 core/editor.js가 붙입니다.
2
+ // 마크업 · 클래스는 자유롭게 바꿔도 되고, 각 조각에 적힌 data-role만 남기면 동작이 그대로입니다.
3
+ // 입력 칸에는 값을 넣지 않습니다 (동작이 value로 넣음).
4
+ import { html } from '../../core/dom.js';
5
+ import { texts } from '../texts.js';
6
+
7
+ const t = texts.edit;
8
+ /** 보기 · 그룹 목록에서 종류마다 다른 문구와 번호 표시 */
9
+ const KIND = {
10
+ option: {
11
+ marker: (i) => String(i + 1),
12
+ name: (i) => t.option(i + 1),
13
+ input: (i) => t.option(i + 1),
14
+ remove: (i) => t.optionDelete(i + 1),
15
+ min: t.optionsMin,
16
+ max: t.optionsMax,
17
+ add: t.addOption,
18
+ },
19
+ group: {
20
+ marker: (i) => String.fromCharCode(65 + i),
21
+ name: (i) => t.group(i + 1),
22
+ input: (i) => t.groupName(i + 1),
23
+ remove: (i) => t.groupDelete(i + 1),
24
+ min: t.groupsMin,
25
+ max: t.groupsMax,
26
+ add: t.addGroup,
27
+ },
28
+ };
29
+
30
+ /**
31
+ * 글 입력 칸. data-role="input" (input · textarea), 있으면 data-role="count" (글자 수)
32
+ * markdown이면 data-role="preview-toggle" (미리보기 버튼) · data-role="preview" (미리보기 자리, hidden)
33
+ */
34
+ export const field = ({
35
+ label,
36
+ required = false,
37
+ hint,
38
+ max,
39
+ multiline = false,
40
+ markdown = false,
41
+ }) => {
42
+ const mark = required
43
+ ? html`<b class="qe-required">${t.required}</b>`
44
+ : html`<span class="qe-optional">${t.optional}</span>`;
45
+ const preview =
46
+ markdown &&
47
+ html`<button type="button" class="qe-link" data-role="preview-toggle">${t.preview}</button>`;
48
+ return html`
49
+ <label class="qe-field">
50
+ <span class="qe-label">${label}${mark}${preview}</span>
51
+ ${hint && html`<span class="qe-hint">${hint}</span>`}
52
+ ${multiline
53
+ ? html`<textarea class="qe-input" data-role="input"></textarea>`
54
+ : html`<input class="qe-input" data-role="input" />`}
55
+ ${max && html`<span class="qe-count" data-role="count"></span>`}
56
+ ${markdown && html`<div class="qe-preview" data-role="preview" hidden></div>`}
57
+ </label>
58
+ `;
59
+ };
60
+
61
+ /** 숫자 칸 (순서 맞추기 답안 칸 수). data-role="input" */
62
+ export const numberField = ({ label, hint, max }) => html`
63
+ <label class="qe-field">
64
+ <span class="qe-label">${label}</span>
65
+ <span class="qe-hint">${hint}</span>
66
+ <input type="number" min="1" max="${max}" class="qe-input qe-number" data-role="input" />
67
+ </label>
68
+ `;
69
+
70
+ /** 켜고 끄기. data-role="input" (checkbox) */
71
+ export const toggle = ({ label }) => html`
72
+ <label class="qe-switch">
73
+ <input type="checkbox" data-role="input" />
74
+ <span>${label}</span>
75
+ </label>
76
+ `;
77
+
78
+ /** 제목이 붙은 묶음 (보기 · 그룹) */
79
+ export const section = ({ label, hint, body }) => html`
80
+ <div class="qe-section">
81
+ <span class="qe-label">${label}</span>
82
+ ${hint && html`<span class="qe-hint">${hint}</span>`} ${body}
83
+ </div>
84
+ `;
85
+
86
+ /** 보기 · 그룹 목록. rows: row()들 (같은 부모 아래 형제로 두어야 끌어서 순서 바꾸기가 됨) */
87
+ export const list = ({ rows, add }) => html`<div class="qe-options">${rows}${add}</div>`;
88
+
89
+ /**
90
+ * 보기 · 그룹 한 줄. kind: 'option' | 'group' · index: 0부터 · canDelete: 최소 개수보다 많음
91
+ * data-role="handle" (끌기 손잡이) · data-role="input" · data-role="delete"
92
+ */
93
+ export const row = ({ kind, index, canDelete, min }) => {
94
+ const k = KIND[kind];
95
+ return html`
96
+ <div class="qe-option">
97
+ <button
98
+ type="button"
99
+ class="qe-handle"
100
+ data-role="handle"
101
+ aria-label="${t.sortLabel(k.name(index))}"
102
+ title="${t.sortTitle}"
103
+ >
104
+ ${t.handle}
105
+ </button>
106
+ <span class="qe-option-no">${k.marker(index)}</span>
107
+ <input class="qe-input" data-role="input" aria-label="${k.input(index)}" />
108
+ <button
109
+ type="button"
110
+ class="qe-icon"
111
+ data-role="delete"
112
+ aria-label="${k.remove(index)}"
113
+ title="${canDelete ? '' : k.min(min)}"
114
+ ${!canDelete && 'disabled'}
115
+ >
116
+ ${t.delete}
117
+ </button>
118
+ </div>
119
+ `;
120
+ };
121
+
122
+ /** 목록 끝의 추가 버튼. full: 최대 개수에 닿음 */
123
+ export const addButton = ({ kind, full, max }) => html`
124
+ <button
125
+ type="button"
126
+ class="qe-add"
127
+ title="${full ? KIND[kind].max(max) : ''}"
128
+ ${full && 'disabled'}
129
+ >
130
+ ${KIND[kind].add}
131
+ </button>
132
+ `;
133
+
134
+ /**
135
+ * 문항 카드. body: 문항 칸들 · types: [[값, 이름], …]
136
+ * data-role="type" (유형 select) · data-role="up" · data-role="down" · data-role="delete"
137
+ */
138
+ export const card = ({ q, index, count, types, body }) => html`
139
+ <section class="qe-card">
140
+ <header class="qe-card-head">
141
+ <strong>${t.question(index + 1)}</strong>
142
+ <select class="qe-input qe-type" data-role="type" aria-label="${t.questionType(index + 1)}">
143
+ ${types.map(
144
+ ([value, name]) =>
145
+ html`<option value="${value}" ${q.type === value && 'selected'}>${name}</option>`,
146
+ )}
147
+ </select>
148
+ <button
149
+ type="button"
150
+ class="qe-icon"
151
+ data-role="up"
152
+ aria-label="${t.questionUp(index + 1)}"
153
+ ${index === 0 && 'disabled'}
154
+ >
155
+ ${t.up}
156
+ </button>
157
+ <button
158
+ type="button"
159
+ class="qe-icon"
160
+ data-role="down"
161
+ aria-label="${t.questionDown(index + 1)}"
162
+ ${index === count - 1 && 'disabled'}
163
+ >
164
+ ${t.down}
165
+ </button>
166
+ <button
167
+ type="button"
168
+ class="qe-icon"
169
+ data-role="delete"
170
+ aria-label="${t.questionDelete(index + 1)}"
171
+ title="${count <= 1 ? t.questionMin : ''}"
172
+ ${count <= 1 && 'disabled'}
173
+ >
174
+ ${t.delete}
175
+ </button>
176
+ </header>
177
+ ${body}
178
+ </section>
179
+ `;
180
+
181
+ /** 문항 추가 버튼 */
182
+ export const addQuestion = () =>
183
+ html`<button type="button" class="qe-add qe-add-question">${t.addQuestion}</button>`;
@@ -0,0 +1,68 @@
1
+ // 그룹 분류: 보기 풀 ↔ 그룹 칸. 끌어 놓기 · 누르기 동작은 core/behaviors.js가 붙입니다.
2
+ // 꼭 남길 것: root 안의 data-role="pool" (남은 보기 자리), 그룹마다 data-role="items" (그 그룹에 놓인 보기 자리)
3
+ // 있으면 씀: data-role="pool-area" (여기에 놓으면 풀로 되돌림, 없으면 pool), data-role="reset" (답안 초기화),
4
+ // 보기 안의 data-role="remove" (그룹에서 빼기, 고르기 버튼과 형제인 버튼)
5
+ // 동작이 그룹에 data-role="group" · data-group="그룹 id", 보기에 data-role="chip" · data-option을 붙입니다.
6
+ import { html } from '../../core/dom.js';
7
+ import { texts } from '../texts.js';
8
+
9
+ const t = texts.question;
10
+
11
+ /** EDS IconButton small의 xmark 아이콘 16px, 글자색을 따름 (Font Awesome Free xmark, CC BY 4.0) */
12
+ const xmark = () => html`
13
+ <svg width="16" height="16" viewBox="0 0 384 512" aria-hidden="true" focusable="false">
14
+ <path
15
+ fill="currentColor"
16
+ d="M342.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L192 210.7 86.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L146.7 256 41.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L192 301.3 297.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L237.3 256 342.6 150.6z"
17
+ />
18
+ </svg>
19
+ `;
20
+
21
+ export const group = {
22
+ /** 전체 틀. boxes: box()로 만든 그룹들 (정의 순서). 가운데 풀, 양옆에 그룹을 번갈아 놓는다 */
23
+ root: ({ boxes }) => html`
24
+ <div class="qz-groups">
25
+ <div class="qz-group-col">${boxes.filter((_, i) => i % 2 === 0)}</div>
26
+ <div class="qz-group-pool" data-role="pool-area">
27
+ <div class="qz-pool-head">
28
+ <span>${t.pool}</span>
29
+ <button type="button" class="qz-link" data-role="reset">${t.groupReset}</button>
30
+ </div>
31
+ <div class="qz-pool" data-role="pool"></div>
32
+ </div>
33
+ <div class="qz-group-col">${boxes.filter((_, i) => i % 2 === 1)}</div>
34
+ </div>
35
+ `,
36
+ /** 그룹 하나 */
37
+ box: ({ group }) => html`
38
+ <section class="qz-group">
39
+ <h4 class="qz-group-name">${group.name}</h4>
40
+ <div class="qz-group-items" data-role="items"></div>
41
+ </section>
42
+ `,
43
+ /**
44
+ * 보기 하나. picked: 눌러서 고른 상태 · removable: 그룹에 놓여 있어 뺄 수 있음
45
+ * 고르기 버튼과 빼기 버튼은 형제로 둔다 (버튼 안에 버튼을 넣으면 키보드 · 화면 읽기 프로그램에서 구분되지 않음)
46
+ */
47
+ chip: ({ option, picked, removable }) => html`
48
+ <span class="qz-chip-option qz-chip-group${picked ? ' is-picked' : ''}">
49
+ <button type="button" class="qz-chip-pick" aria-pressed="${picked ? 'true' : 'false'}">
50
+ ${option.text}
51
+ </button>
52
+ ${removable &&
53
+ html`<button
54
+ type="button"
55
+ class="qz-chip-x"
56
+ data-role="remove"
57
+ aria-label="${t.groupRemoveLabel(option.text)}"
58
+ title="${t.groupRemove}"
59
+ >
60
+ ${xmark()}
61
+ </button>`}
62
+ </span>
63
+ `,
64
+ /** 보기를 모두 그룹에 놓았을 때 풀에 보이는 안내 */
65
+ poolEmpty: () => html`<p class="qz-empty">${t.groupPoolEmpty}</p>`,
66
+ /** 빈 그룹 안내 */
67
+ boxEmpty: () => html`<p class="qz-empty">${t.groupEmpty}</p>`,
68
+ };
@@ -0,0 +1,5 @@
1
+ // ui/templates/index.js 타입 (테스트용). 모양은 core/behaviors.d.ts의 QuizTemplates · QuizLabels
2
+ import type { QuizLabels, QuizTemplates } from '../../core/behaviors.js';
3
+
4
+ export declare const templates: QuizTemplates;
5
+ export declare const labels: QuizLabels;
@@ -0,0 +1,17 @@
1
+ // 퀴즈가 쓰는 HTML 조각 모음. 화면(screens/)이 이 모음과 문구를 core/behaviors.js에 넘깁니다.
2
+ // 마크업 · 클래스는 자유롭게 바꿔도 되고, 각 파일 머리에 적힌 data-role만 남기면 동작이 그대로입니다.
3
+ import { choice } from './choice.js';
4
+ import { group } from './group.js';
5
+ import { order } from './order.js';
6
+ import { question } from './question.js';
7
+ import { text } from './text.js';
8
+ import { texts } from '../texts.js';
9
+
10
+ export const templates = { question, choice, text, order, group };
11
+
12
+ /** 동작이 넣는 문구: 유형 이름 · 결과 문구 (ui/texts.js) */
13
+ export const labels = {
14
+ types: texts.types,
15
+ correct: texts.question.correct,
16
+ wrong: texts.question.wrong,
17
+ };
@@ -0,0 +1,35 @@
1
+ // 순서 맞추기: 보기 풀 → 답안 칸. 끌어 놓기 · 누르기 동작은 core/behaviors.js가 붙입니다.
2
+ // 꼭 남길 것: root 안의 data-role="pool" (남은 보기 자리) · data-role="slots" (답안 칸 자리)
3
+ // 동작이 칸에 data-role="slot" · data-slot="0부터", 보기에 data-role="chip" · data-option="보기 id"를 붙입니다.
4
+ import { html } from '../../core/dom.js';
5
+ import { texts } from '../texts.js';
6
+
7
+ const t = texts.question;
8
+
9
+ export const order = {
10
+ /** 전체 틀. pool · slots는 비워 두면 동작이 채웁니다 */
11
+ root: () => html`
12
+ <div class="qz-order">
13
+ <div class="qz-pool" data-role="pool" aria-label="${t.pool}"></div>
14
+ <div class="qz-order-arrow" aria-hidden="true">⇄</div>
15
+ <ol class="qz-slots" data-role="slots" aria-label="${t.answer}"></ol>
16
+ </div>
17
+ `,
18
+ /** 답안 칸 하나. content: 놓인 보기(chip) 또는 slotEmpty() */
19
+ slot: ({ index, content }) => html`
20
+ <li class="qz-slot">
21
+ <span class="qz-slot-no">${index + 1}</span>
22
+ ${content}
23
+ </li>
24
+ `,
25
+ /** 보기 하나. picked: 눌러서 고른 상태 */
26
+ chip: ({ option, picked }) => html`
27
+ <button type="button" class="qz-chip-option${picked ? ' is-picked' : ''}">
28
+ ${option.text}
29
+ </button>
30
+ `,
31
+ /** 보기를 모두 칸에 놓았을 때 풀에 보이는 안내 */
32
+ poolEmpty: () => html`<p class="qz-empty">${t.orderPoolEmpty}</p>`,
33
+ /** 빈 칸 안내 */
34
+ slotEmpty: () => html`<span class="qz-empty">${t.orderSlotEmpty}</span>`,
35
+ };
@@ -0,0 +1,29 @@
1
+ // 화면 머리 (학생 · 교육자)와 불러오는 동안 보이는 자리. 문항 위에 무엇을 보일지 여기서 고칩니다.
2
+ import { html } from '../../core/dom.js';
3
+ import { markdown } from '../../core/markdown.js';
4
+ import { texts } from '../texts.js';
5
+
6
+ /** 내용을 받기 전까지 보이는 문구 (학생 · 교육자 · 편집 공통) */
7
+ export const loading = () => html`<p class="ec-muted">${texts.page.loading}</p>`;
8
+
9
+ /** 학생 화면 머리: 배지 · 제목 · 안내 */
10
+ export const learnHeader = ({ title, description }) => html`
11
+ <span class="qz-badge">${texts.learn.badge}</span>
12
+ <h1 class="qz-title">${title}</h1>
13
+ ${description ? markdown(description, 'qz-markdown qz-lead') : null}
14
+ `;
15
+
16
+ /** 교육자 화면 머리: 제목 · 요약. byType: [[유형 이름, 문항 수], …] */
17
+ export const instructorHeader = ({ title, count, byType }) => html`
18
+ <h1 class="qz-title">${title}</h1>
19
+ <section class="qz-summary">
20
+ <span class="qz-badge dark">${texts.instructor.badge}</span>
21
+ <p>
22
+ ${texts.instructor.summary(
23
+ count,
24
+ byType.map(([type, n]) => texts.instructor.summaryType(type, n)),
25
+ )}
26
+ </p>
27
+ <p class="qz-muted">${texts.instructor.note}</p>
28
+ </section>
29
+ `;
@@ -0,0 +1,28 @@
1
+ // 문항 겉모양 (학생 · 교육자 공통): 제목 · 유형 표시(교육자 화면만) · 지문 · 본문 · 결과 · 해설
2
+ // 꼭 남길 것: data-role="result" (정답 · 오답 문구 자리), data-role="explanation" (해설, 처음엔 hidden)
3
+ // 동작이 문항 요소에 data-role="question" · data-id · data-result="correct|wrong"를 붙입니다.
4
+ import { html } from '../../core/dom.js';
5
+ import { markdown } from '../../core/markdown.js';
6
+ import { texts } from '../texts.js';
7
+
8
+ const t = texts.question;
9
+
10
+ /**
11
+ * @param {{ q: object, no: number, type: string, body: Node, explanation: string | null }} props
12
+ * no: 1부터 · type: 유형 이름(학생 화면은 null: 그리지 않음) · body: 유형별 본문 · explanation: 해설(없으면 null)
13
+ */
14
+ export const question = ({ q, no, type, body, explanation }) => html`
15
+ <fieldset class="qz-question">
16
+ <legend class="qz-question-head">
17
+ <span class="qz-question-title">${t.title(no, q.title)}</span>
18
+ ${type && html`<span class="qz-chip">${type}</span>`}
19
+ </legend>
20
+ ${q.description ? markdown(q.description, 'qz-markdown qz-passage') : null} ${body}
21
+ <p class="qz-result" data-role="result" role="status" hidden></p>
22
+ ${explanation !== null &&
23
+ html`<details class="qz-explanation" data-role="explanation" hidden open>
24
+ <summary>${t.explanation}</summary>
25
+ ${markdown(explanation)}
26
+ </details>`}
27
+ </fieldset>
28
+ `;
@@ -0,0 +1,16 @@
1
+ // 주관식 입력란.
2
+ // 꼭 남길 것: data-role="input" (textarea 또는 input, 값이 그대로 답이 됩니다)
3
+ import { html } from '../../core/dom.js';
4
+ import { texts } from '../texts.js';
5
+
6
+ const t = texts.question;
7
+
8
+ /** @param {{ q: object }} props */
9
+ export const text = ({ q }) => html`
10
+ <textarea
11
+ class="qz-text"
12
+ data-role="input"
13
+ placeholder="${q.placeholder || t.textPlaceholder}"
14
+ aria-label="${t.textLabel}"
15
+ ></textarea>
16
+ `;
@@ -0,0 +1,3 @@
1
+ // ui/texts.js 타입 (테스트용). 문구는 texts.js에서만 고치면 됩니다.
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ export declare const texts: Record<string, any>;
@@ -0,0 +1,127 @@
1
+ // 퀴즈 화면에 보이는 문구 모음 (학생 · 교육자 · 편집). 문구를 바꾸려면 여기만 고치면 됩니다.
2
+ // 숫자 · 이름이 들어가는 문구는 함수입니다: 모양(인자)은 그대로 두고 돌려주는 글만 바꾸세요.
3
+
4
+ export const texts = {
5
+ /** 문항 유형 이름 (유형 표시 · 편집 화면 유형 고르기) */
6
+ types: {
7
+ select_one: '객관식 (단일 선택)',
8
+ select_multiple: '객관식 (복수 선택)',
9
+ order: '순서 맞추기',
10
+ text: '주관식',
11
+ group: '그룹 분류',
12
+ },
13
+
14
+ /** 브라우저 탭 제목 · 불러오는 동안 보이는 문구 (화면이 넣음. HTML의 같은 글은 스크립트가 돌기 전 대비용) */
15
+ page: {
16
+ learn: '학생 화면',
17
+ instructor: '교육자 화면',
18
+ edit: '내용 편집',
19
+ loading: '불러오는 중…',
20
+ },
21
+
22
+ /** 학생 화면 */
23
+ learn: {
24
+ badge: '확인 문제',
25
+ unanswered: (no) => `${no}번 문항에 답해 주세요.`,
26
+ },
27
+
28
+ /** 교육자 화면 */
29
+ instructor: {
30
+ badge: '교육자 화면',
31
+ summary: (count, byType) => `문항 ${count}개 · ${byType.join(' · ')}`,
32
+ summaryType: (type, n) => `${type} ${n}`,
33
+ note: '정답과 채점 방식은 LXP 편집 화면의 채점 설정에서 확인하세요.',
34
+ },
35
+
36
+ /** 문항 (학생 · 교육자 공통) */
37
+ question: {
38
+ title: (no, title) => `${no}. ${title}`,
39
+ correct: '정답',
40
+ wrong: '다시 한번 풀어보세요.',
41
+ explanation: '퀴즈 해설 보기',
42
+ textPlaceholder: '답안을 작성해 주세요.',
43
+ textLabel: '답안',
44
+ pool: '보기',
45
+ answer: '답안',
46
+ orderPoolEmpty: '항목을 다시 이곳으로 옮길 수 있습니다.',
47
+ orderSlotEmpty: '답안을 드래그 앤 드롭하세요.',
48
+ groupReset: '답안 초기화',
49
+ groupRemove: '빼기',
50
+ groupRemoveLabel: (option) => `${option} 빼기`,
51
+ groupPoolEmpty: '모든 보기를 그룹에 배치하였습니다.',
52
+ groupEmpty: '보기를 영역에 끌어 넣거나, 보기를 누른 뒤 이곳을 눌러 주세요.',
53
+ },
54
+
55
+ /** 내용 편집 화면 */
56
+ edit: {
57
+ done: '편집 완료',
58
+ quizTitle: '퀴즈 제목',
59
+ quizDescription: '안내',
60
+ optional: ' 선택',
61
+ required: ' *',
62
+ count: (length, max) => `${length} / ${max}`,
63
+ preview: '미리보기',
64
+ previewClose: '미리보기 닫기',
65
+ question: (no) => `문항 ${no}`,
66
+ questionType: (no) => `문항 ${no} 유형`,
67
+ questionUp: (no) => `문항 ${no} 위로`,
68
+ questionDown: (no) => `문항 ${no} 아래로`,
69
+ questionDelete: (no) => `문항 ${no} 삭제`,
70
+ questionMin: '문항은 하나 이상이어야 합니다.',
71
+ addQuestion: '+ 문항 추가',
72
+ title: '질문',
73
+ description: '설명',
74
+ options: '보기',
75
+ option: (no) => `보기 ${no}`,
76
+ optionDelete: (no) => `보기 ${no} 삭제`,
77
+ optionsMin: (min) => `보기는 ${min}개 이상이어야 합니다.`,
78
+ optionsMax: (max) => `보기는 최대 ${max}개까지 구성 가능합니다.`,
79
+ addOption: '+ 보기 추가',
80
+ groups: '그룹',
81
+ group: (no) => `그룹 ${no}`,
82
+ groupName: (no) => `그룹 ${no} 이름`,
83
+ groupDelete: (no) => `그룹 ${no} 삭제`,
84
+ groupsMin: (min) => `그룹은 ${min}개 이상이어야 합니다.`,
85
+ groupsMax: (max) => `그룹은 최대 ${max}개까지 구성 가능합니다.`,
86
+ addGroup: '+ 그룹 추가',
87
+ groupOptionsHint:
88
+ '어느 그룹에 속하는지는 채점 설정에서 지정합니다. 어느 그룹에도 속하지 않는 보기는 오답 보기가 됩니다.',
89
+ slots: '답안 칸 수',
90
+ slotsHint: '보기 중 답안 칸에 놓을 개수. 나머지 보기는 오답 보기가 됩니다.',
91
+ placeholder: '입력란 힌트',
92
+ placeholderHint: '비우면 "답안을 작성해 주세요."',
93
+ shuffle: '답안 순서 섞기 (학생마다 보기 순서가 달라집니다)',
94
+ explanationOn: '해설 사용 (학생이 한 번 제출하면 보입니다)',
95
+ explanation: '해설',
96
+ sortLabel: (label) => `${label} 순서 바꾸기 (끌거나 ↑ · ↓ 키)`,
97
+ sortTitle: '끌어서 순서 바꾸기',
98
+ delete: '×',
99
+ up: '↑',
100
+ down: '↓',
101
+ handle: '⠿',
102
+ },
103
+
104
+ /** 새로 만들거나 유형을 바꿀 때 채우는 기본값 (core/model.js) */
105
+ defaults: {
106
+ option: (no) => `보기 ${no}`,
107
+ group: (letter) => `그룹 ${letter}`,
108
+ },
109
+
110
+ /** 편집 화면 저장 전 검증 문구 (core/model.js validateQuiz) */
111
+ validation: {
112
+ quizTitle: '퀴즈 제목을 입력해 주세요.',
113
+ noQuestions: '문항을 하나 이상 추가해 주세요.',
114
+ at: (no, message) => `문항 ${no}: ${message}`,
115
+ title: '질문을 입력해 주세요.',
116
+ titleMax: (max) => `질문은 ${max}자까지 입력할 수 있습니다.`,
117
+ optionsMin: (min) => `보기는 ${min}개 이상이어야 합니다.`,
118
+ optionsMax: (max) => `보기는 최대 ${max}개까지 구성 가능합니다.`,
119
+ optionText: '보기 내용을 입력해 주세요.',
120
+ slots: '답안 칸 수는 1개 이상, 보기 개수 이하여야 합니다.',
121
+ groupsMin: (min) => `그룹은 ${min}개 이상이어야 합니다.`,
122
+ groupsMax: (max) => `그룹은 최대 ${max}개까지 구성 가능합니다.`,
123
+ groupName: '그룹 이름을 입력해 주세요.',
124
+ placeholderMax: (max) => `입력란 힌트는 ${max}자까지 입력할 수 있습니다.`,
125
+ explanation: '해설 내용을 입력해 주세요.',
126
+ },
127
+ };
@@ -0,0 +1,50 @@
1
+ /* 퀴즈 테마. 색 · 간격 · 모서리 · 보기 카드 모양을 여기서 바꿉니다 (styles.css가 이 값을 씁니다).
2
+ 값은 EDS 토큰(lib/elice-tokens.css)을 가리키므로 --theme dark에서도 그대로 어두운 색이 됩니다.
3
+ 예: 강조색을 바꾸려면 --qz-accent, 보기 카드를 더 촘촘하게 하려면 --qz-option-padding */
4
+ :root {
5
+ /* 강조 · 결과 색 */
6
+ --qz-accent: var(--eds-primary-main);
7
+ --qz-accent-contrast: var(--eds-primary-contrast-text);
8
+ --qz-accent-soft: var(--eds-primary-opacity02);
9
+ --qz-accent-softer: var(--eds-primary-opacity03);
10
+ --qz-correct: var(--eds-success-main);
11
+ --qz-correct-bg: var(--eds-success-background);
12
+ --qz-wrong: var(--eds-error-main);
13
+ --qz-wrong-bg: var(--eds-error-background);
14
+
15
+ /* 면 · 테두리 · 글자 */
16
+ --qz-surface: var(--eds-background-paper);
17
+ --qz-surface-muted: var(--eds-background-neutral);
18
+ --qz-surface-gray: var(--eds-background-gray);
19
+ --qz-border: var(--eds-surface-border);
20
+ --qz-hover: var(--eds-action-hover);
21
+ --qz-text-muted: var(--eds-text-tertiary);
22
+
23
+ /* 모서리 */
24
+ --qz-radius-card: 12px;
25
+ --qz-radius: var(--eds-radius);
26
+
27
+ /* 간격 */
28
+ --qz-card-padding: 20px;
29
+ --qz-card-gap: 12px;
30
+ --qz-list-gap: 8px;
31
+
32
+ /* 문항 카드 */
33
+ --qz-question-border: var(--ec-border);
34
+
35
+ /* 보기 카드 (단일 · 복수 선택, EDS RadioCard) */
36
+ --qz-option-padding: 20px;
37
+ --qz-option-gap: 8px;
38
+ --qz-option-radius: var(--qz-radius-card);
39
+ --qz-option-border: var(--qz-border);
40
+ --qz-option-bg: var(--qz-surface);
41
+ --qz-option-hover-bg: var(--qz-hover);
42
+ --qz-option-checked-border: var(--qz-accent);
43
+ --qz-option-checked-bg: var(--qz-accent-soft);
44
+ --qz-option-checked-hover-bg: var(--qz-accent-softer);
45
+
46
+ /* 끌어 놓는 보기 (순서 맞추기 · 그룹 분류) */
47
+ --qz-chip-padding: 8px 12px;
48
+ --qz-chip-radius: var(--qz-radius);
49
+ --qz-slot-min-height: 60px;
50
+ }