@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
@@ -60,8 +60,8 @@ const icons = {
60
60
  textbox: () => html`
61
61
  <svg
62
62
  viewBox="0 0 24 24"
63
- width="16"
64
- height="16"
63
+ width="18"
64
+ height="18"
65
65
  fill="none"
66
66
  stroke="currentColor"
67
67
  stroke-width="2"
@@ -73,13 +73,45 @@ const icons = {
73
73
  <path d="M8 10v4" />
74
74
  </svg>
75
75
  `,
76
- align: () => html`
76
+ // 설명 추가 (말풍선 줄)
77
+ comment: () => html`
78
+ <svg
79
+ viewBox="0 0 24 24"
80
+ width="18"
81
+ height="18"
82
+ fill="none"
83
+ stroke="currentColor"
84
+ stroke-width="2"
85
+ stroke-linecap="round"
86
+ stroke-linejoin="round"
87
+ aria-hidden="true"
88
+ >
89
+ <path d="M5 3.5h14a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-8.2L6 20.5v-4H5a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2z" />
90
+ <path d="M7.5 8.5h9M7.5 12h6" />
91
+ </svg>
92
+ `,
93
+ chevronDown: () => html`
77
94
  <svg
78
95
  viewBox="0 0 24 24"
79
96
  width="16"
80
97
  height="16"
81
98
  fill="none"
82
99
  stroke="currentColor"
100
+ stroke-width="2.5"
101
+ stroke-linecap="round"
102
+ stroke-linejoin="round"
103
+ aria-hidden="true"
104
+ >
105
+ <path d="M6 9l6 6 6-6" />
106
+ </svg>
107
+ `,
108
+ align: () => html`
109
+ <svg
110
+ viewBox="0 0 24 24"
111
+ width="18"
112
+ height="18"
113
+ fill="none"
114
+ stroke="currentColor"
83
115
  stroke-width="2"
84
116
  stroke-linecap="round"
85
117
  stroke-linejoin="round"
@@ -91,8 +123,8 @@ const icons = {
91
123
  bulb: () => html`
92
124
  <svg
93
125
  viewBox="0 0 24 24"
94
- width="16"
95
- height="16"
126
+ width="18"
127
+ height="18"
96
128
  fill="none"
97
129
  stroke="currentColor"
98
130
  stroke-width="2"
@@ -191,6 +223,9 @@ export const field = ({
191
223
  * 화면 낭독기에는 aria-label로 이름을 준다. size: 'title'(퀴즈 제목) · 'question'(질문) · 'body'(안내 · 설명)
192
224
  * data-role="input" (input · textarea) · max가 있고 showCount가 false가 아니면 data-role="count" (글자 수, 칸에 초점이 있을 때만 보임)
193
225
  * showCount: false면 max(입력 제한)는 지키되 글자 수 표시는 뺀다
226
+ * singleLine: 한 줄 값(줄바꿈 없음)이지만 길면 칸 안에서 다음 줄로 넘겨 다 보이는 칸 (textarea data-single-line, Enter · 붙여 넣은 줄바꿈은 동작이 막음)
227
+ * softWrap: 길면 칸 안에서 다음 줄로 넘기고 Shift+Enter로 줄을 바꾸는 칸 (textarea data-soft-wrap, Enter만 동작이 막음. 질문 칸)
228
+ * (보기 · 주관식 정답 · 그룹 이름 칸도 같은 textarea[data-soft-wrap])
194
229
  * 필수 칸은 data-required: 비운 채 저장하면 동작이 aria-invalid를 붙인다 (빨간 밑줄)
195
230
  */
196
231
  export const inlineField = ({
@@ -201,33 +236,127 @@ export const inlineField = ({
201
236
  max,
202
237
  showCount = true,
203
238
  multiline = false,
239
+ singleLine = false,
240
+ softWrap = false,
204
241
  }) => html`
205
- <div class="qe-inline qe-inline-${size}">
242
+ <div class="qe-inline qe-inline-${size} ec-field ec-field-${size}">
206
243
  ${
207
- multiline
244
+ multiline || singleLine || softWrap
208
245
  ? html`<textarea
209
- class="qe-inline-input"
246
+ class="qe-inline-input ec-field-input"
210
247
  data-role="input"
211
248
  rows="1"
212
249
  aria-label="${label}"
213
250
  placeholder="${placeholder}"
251
+ ${singleLine && "data-single-line"}
252
+ ${softWrap && "data-soft-wrap"}
214
253
  ${required && "data-required aria-required=true"}
215
254
  ></textarea>`
216
255
  : html`<input
217
- class="qe-inline-input"
256
+ class="qe-inline-input ec-field-input"
218
257
  data-role="input"
219
258
  aria-label="${label}"
220
259
  placeholder="${placeholder}"
221
260
  ${required && "data-required aria-required=true"}
222
261
  />`
223
262
  }
224
- ${max && showCount && html`<span class="qe-count" data-role="count"></span>`}
263
+ ${max && showCount && html`<span class="qe-count ec-field-count" data-role="count"></span>`}
264
+ </div>
265
+ `;
266
+
267
+ /**
268
+ * 지문 · 해설 칸 (보이는 그대로 고치는 글 칸과 올린 그림 칸이 차례로). 동작(core/editor.js richField)이 칸을 채운다.
269
+ * data-role="input" (값을 든 숨은 textarea) · "blocks" (글 칸 blockText · 그림 칸 blockImage가 들어가는 자리)
270
+ */
271
+ export const richField = ({ label }) => html`
272
+ <div class="qe-inline qe-inline-body qe-blocks ec-field ec-field-body" role="group" aria-label="${label}">
273
+ <textarea data-role="input" hidden tabindex="-1" aria-hidden="true"></textarea>
274
+ <div class="qe-blocks-list" data-role="blocks"></div>
225
275
  </div>
226
276
  `;
227
277
 
228
- /** 퀴즈 제목 · 안내 묶음. 카드 모양 없이 배경 위에 바로 둔다 */
229
- export const quizInfo = ({ body }) =>
230
- html`<section class="qe-card qe-quiz-info">${body}</section>`;
278
+ /** 글 칸 (contenteditable). 비어 있으면 data-empty가 붙어 placeholder 글을 보인다 */
279
+ export const blockText = ({ label, placeholder }) => html`
280
+ <div
281
+ class="qe-inline-input qe-wys qz-markdown"
282
+ data-role="block-text"
283
+ contenteditable="true"
284
+ role="textbox"
285
+ aria-multiline="true"
286
+ aria-label="${label}"
287
+ data-placeholder="${placeholder}"
288
+ ></div>
289
+ `;
290
+
291
+ /** 올린 그림 칸. data-role="block-remove" (그림 지우기) */
292
+ export const blockImage = ({ alt, src, removeLabel }) => html`
293
+ <figure class="qe-block-image">
294
+ ${src && html`<img src="${src}" alt="${alt}" />`}
295
+ <button
296
+ type="button"
297
+ class="qe-block-remove"
298
+ data-role="block-remove"
299
+ aria-label="${removeLabel}"
300
+ title="${removeLabel}"
301
+ >
302
+ ${icons.xmark()}
303
+ </button>
304
+ </figure>
305
+ `;
306
+
307
+ const toolIcon = {
308
+ ul: () => html`
309
+ <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">
310
+ <line x1="8" y1="6" x2="21" y2="6" /><line x1="8" y1="12" x2="21" y2="12" /><line x1="8" y1="18" x2="21" y2="18" />
311
+ <line x1="3" y1="6" x2="3.01" y2="6" /><line x1="3" y1="12" x2="3.01" y2="12" /><line x1="3" y1="18" x2="3.01" y2="18" />
312
+ </svg>
313
+ `,
314
+ ol: () => html`
315
+ <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">
316
+ <line x1="10" x2="21" y1="6" y2="6" /><line x1="10" x2="21" y1="12" y2="12" /><line x1="10" x2="21" y1="18" y2="18" />
317
+ <path d="M4 6h1v4" /><path d="M4 10h2" /><path d="M6 18H4c0-1 2-2 2-3s-1-1.5-2-1" />
318
+ </svg>
319
+ `,
320
+ code: () => html`
321
+ <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">
322
+ <polyline points="16 18 22 12 16 6" /><polyline points="8 6 2 12 8 18" />
323
+ </svg>
324
+ `,
325
+ image: () => html`
326
+ <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">
327
+ <rect width="18" height="18" x="3" y="3" rx="2" ry="2" /><circle cx="9" cy="9" r="2" />
328
+ <path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" />
329
+ </svg>
330
+ `,
331
+ };
332
+
333
+ /**
334
+ * 지문 · 해설 서식 도구 (칸에 초점이 있을 때 칸 아래에 뜸). 버튼마다 data-role:
335
+ * "md-bold" · "md-italic" · "md-strike" · "md-ul" · "md-ol" · "md-code" · "md-image" (그림 올리기, 못 쓰면 동작이 숨김) ·
336
+ * "md-progress" (그림을 올리는 동안 진행률)
337
+ */
338
+ export const mdTools = () => {
339
+ const m = t.md;
340
+ const tool = (role, name, glyph) => html`
341
+ <button type="button" class="qe-md-btn" data-role="${role}" aria-label="${name}" title="${name}" aria-pressed="false">
342
+ ${glyph}
343
+ </button>
344
+ `;
345
+ return html`
346
+ <div class="qe-md" role="toolbar" aria-label="${m.toolbar}">
347
+ ${tool("md-bold", m.bold, html`<b>B</b>`)} ${tool("md-italic", m.italic, html`<i>I</i>`)}
348
+ ${tool("md-strike", m.strike, html`<s>S</s>`)}
349
+ <span class="qe-md-sep" aria-hidden="true"></span>
350
+ ${tool("md-ul", m.ul, toolIcon.ul())} ${tool("md-ol", m.ol, toolIcon.ol())}
351
+ <span class="qe-md-sep" aria-hidden="true"></span>
352
+ ${tool("md-code", m.code, toolIcon.code())}
353
+ <button type="button" class="qe-md-btn" data-role="md-image" aria-label="${m.image}" title="${m.image}">
354
+ ${toolIcon.image()}
355
+ </button>
356
+ <span class="qe-md-progress" data-role="md-progress" aria-live="polite" hidden></span>
357
+ </div>
358
+ `;
359
+ };
231
360
 
232
361
  /** 숫자 칸 (순서 맞추기 답안 칸 수). data-role="input" */
233
362
  export const numberField = ({ label, hint, max }) => html`
@@ -249,10 +378,10 @@ export const numberField = ({ label, hint, max }) => html`
249
378
  * icon: icons의 이름 (예: 'shuffle')
250
379
  */
251
380
  export const toggle = ({ label, title = "", icon }) => html`
252
- <label class="qe-switch" title="${title}">
381
+ <label class="qe-switch ec-toggle" title="${title}">
253
382
  <input type="checkbox" data-role="input" />
254
- ${icon && html`<span class="qe-chip-icon qe-chip-off">${icons[icon]?.()}</span>`}
255
- ${icon && html`<span class="qe-chip-icon qe-chip-on">${icons.check()}</span>`}
383
+ ${icon && html`<span class="qe-chip-icon qe-chip-off ec-toggle-off">${icons[icon]?.()}</span>`}
384
+ ${icon && html`<span class="qe-chip-icon qe-chip-on ec-toggle-on">${icons.check()}</span>`}
256
385
  <span>${label}</span>
257
386
  </label>
258
387
  `;
@@ -262,10 +391,10 @@ export const toggle = ({ label, title = "", icon }) => html`
262
391
  * hintInline: true면 안내를 제목 바로 옆(같은 줄, 길면 말줄임)에 둔다. 아니면 제목 아래 줄
263
392
  */
264
393
  export const section = ({ label, hint, body, action, hintInline = false }) => html`
265
- <div class="qe-section">
266
- <div class="qe-section-head">
267
- <span class="qe-label">${label}</span>
268
- ${hint && hintInline && html`<span class="qe-hint-inline" title="${hint}">${hint}</span>`}
394
+ <div class="qe-section ec-section">
395
+ <div class="qe-section-head ec-section-head">
396
+ <span class="qe-label ec-label">${label}</span>
397
+ ${hint && hintInline && html`<span class="qe-hint-inline ec-hint-inline" title="${hint}">${hint}</span>`}
269
398
  ${action}
270
399
  </div>
271
400
  ${hint && !hintInline && html`<span class="qe-hint">${hint}</span>`} ${body}
@@ -293,15 +422,15 @@ const revealClose = (name, glyph) => html`
293
422
  export const reveal = ({ label, field, title, icon, hint }) =>
294
423
  title
295
424
  ? html`
296
- <div class="qe-reveal qe-reveal-card">
297
- <button type="button" class="qe-reveal-button" data-role="reveal">
425
+ <div class="qe-reveal qe-reveal-card ec-reveal">
426
+ <button type="button" class="qe-reveal-button ec-reveal-button" data-role="reveal">
298
427
  ${icon && icons[icon]?.()}<span>${label}</span
299
428
  ><span aria-hidden="true">+</span>
300
429
  </button>
301
- <div class="qe-reveal-body" data-role="reveal-body">
302
- <div class="qe-reveal-head">
430
+ <div class="qe-reveal-body ec-reveal-body" data-role="reveal-body">
431
+ <div class="qe-reveal-head ec-reveal-head">
303
432
  ${icon && icons[icon]?.()}<strong>${title}</strong>
304
- ${hint && html`<span class="qe-reveal-hint" title="${hint}">${hint}</span>`}
433
+ ${hint && html`<span class="qe-reveal-hint ec-hint-inline" title="${hint}">${hint}</span>`}
305
434
  ${revealClose(title, icons.trash())}
306
435
  </div>
307
436
  <div class="qe-reveal-field">${field}</div>
@@ -309,11 +438,11 @@ export const reveal = ({ label, field, title, icon, hint }) =>
309
438
  </div>
310
439
  `
311
440
  : html`
312
- <div class="qe-reveal">
313
- <button type="button" class="qe-reveal-button" data-role="reveal">
441
+ <div class="qe-reveal ec-reveal">
442
+ <button type="button" class="qe-reveal-button ec-reveal-button" data-role="reveal">
314
443
  ${label}
315
444
  </button>
316
- <div class="qe-reveal-body" data-role="reveal-body">
445
+ <div class="qe-reveal-body ec-reveal-body" data-role="reveal-body">
317
446
  ${field} ${revealClose(label, icons.xmark())}
318
447
  </div>
319
448
  </div>
@@ -325,7 +454,7 @@ export const reveal = ({ label, field, title, icon, hint }) =>
325
454
  * atMin: 최소 개수라 지울 수 없음 (줄의 ✕ 버튼이 비활성이 되고 마우스를 올리면 이유가 보임)
326
455
  */
327
456
  export const list = ({ kind, rows, add, answer, atMin, min }) => html`
328
- <div class="qe-options">${rows}${add}</div>
457
+ <div class="qe-options ec-list">${rows}${add}</div>
329
458
  `;
330
459
 
331
460
  /**
@@ -346,7 +475,7 @@ const answerControl = ({ type, name, choices = [] }, index) =>
346
475
  </select>
347
476
  `
348
477
  : html`
349
- <label class="qe-answer qe-answer-col" title="${t.answerTitle}">
478
+ <label class="qe-answer qe-answer-col ec-answer-mark" title="${t.answerTitle}">
350
479
  <input
351
480
  type="${type}"
352
481
  data-role="answer"
@@ -371,10 +500,10 @@ export const row = ({
371
500
  }) => {
372
501
  const k = KIND[kind];
373
502
  return html`
374
- <div class="qe-option">
503
+ <div class="qe-option ec-list-row">
375
504
  <button
376
505
  type="button"
377
- class="qe-handle"
506
+ class="qe-handle ec-handle"
378
507
  data-role="handle"
379
508
  aria-label="${t.sortLabel(k.name(index))}"
380
509
  title="${t.sortTitle}"
@@ -382,13 +511,20 @@ export const row = ({
382
511
  ${t.handle}
383
512
  </button>
384
513
  ${answer && answer.type !== "select" && answerControl(answer, index)}
385
- ${numbered && html`<span class="qe-option-no">${k.marker(index)}</span>`}
386
- <input
387
- class="qe-inline-input qe-option-text"
388
- data-role="input"
389
- aria-label="${k.input(index)}"
390
- placeholder="${k.input(index)}"
391
- />
514
+ ${numbered && html`<span class="qe-option-no ec-list-no">${k.marker(index)}</span>`}
515
+ <span class="qe-option-field">
516
+ <textarea
517
+ class="qe-inline-input qe-option-text ec-field-input"
518
+ data-role="input"
519
+ data-soft-wrap
520
+ rows="1"
521
+ aria-label="${k.input(index)}"
522
+ placeholder="${k.input(index)}"
523
+ ></textarea>
524
+ ${answer &&
525
+ answer.type !== "select" &&
526
+ html`<span class="qe-correct-tag" aria-hidden="true">${t.correctTag}</span>`}
527
+ </span>
392
528
  ${answer && answer.type === "select" && answerControl(answer, index)}
393
529
  <button
394
530
  type="button"
@@ -408,7 +544,7 @@ export const row = ({
408
544
  export const addButton = ({ kind, full, max }) => html`
409
545
  <button
410
546
  type="button"
411
- class="qe-add"
547
+ class="qe-add ec-list-add"
412
548
  title="${full ? KIND[kind].max(max) : ""}"
413
549
  ${full && "disabled"}
414
550
  >
@@ -416,27 +552,155 @@ export const addButton = ({ kind, full, max }) => html`
416
552
  </button>
417
553
  `;
418
554
 
555
+ /** 문항 유형 아이콘 (유형 고르기 앞) */
556
+ const typeIcons = {
557
+ select_one: () => html`
558
+ <svg
559
+ viewBox="0 0 24 24"
560
+ width="16"
561
+ height="16"
562
+ fill="none"
563
+ stroke="currentColor"
564
+ stroke-width="2"
565
+ stroke-linecap="round"
566
+ stroke-linejoin="round"
567
+ aria-hidden="true"
568
+ >
569
+ <circle cx="12" cy="12" r="9" />
570
+ <circle cx="12" cy="12" r="3.5" fill="currentColor" stroke="none" />
571
+ </svg>
572
+ `,
573
+ select_multiple: () => html`
574
+ <svg
575
+ viewBox="0 0 24 24"
576
+ width="16"
577
+ height="16"
578
+ fill="none"
579
+ stroke="currentColor"
580
+ stroke-width="2"
581
+ stroke-linecap="round"
582
+ stroke-linejoin="round"
583
+ aria-hidden="true"
584
+ >
585
+ <rect x="4" y="4" width="16" height="16" rx="3" />
586
+ <path d="M8.5 12.5l2.5 2.5 4.5-5" />
587
+ </svg>
588
+ `,
589
+ order: () => html`
590
+ <svg
591
+ viewBox="0 0 24 24"
592
+ width="16"
593
+ height="16"
594
+ fill="none"
595
+ stroke="currentColor"
596
+ stroke-width="2"
597
+ stroke-linecap="round"
598
+ stroke-linejoin="round"
599
+ aria-hidden="true"
600
+ >
601
+ <path d="M10 6h10M10 12h10M10 18h10M4.5 6h.01M4.5 12h.01M4.5 18h.01" />
602
+ </svg>
603
+ `,
604
+ text: () => html`
605
+ <svg
606
+ viewBox="0 0 24 24"
607
+ width="16"
608
+ height="16"
609
+ fill="none"
610
+ stroke="currentColor"
611
+ stroke-width="2"
612
+ stroke-linecap="round"
613
+ stroke-linejoin="round"
614
+ aria-hidden="true"
615
+ >
616
+ <rect x="3" y="6" width="18" height="12" rx="2" />
617
+ <path d="M8 10v4" />
618
+ </svg>
619
+ `,
620
+ group: () => html`
621
+ <svg
622
+ viewBox="0 0 24 24"
623
+ width="16"
624
+ height="16"
625
+ fill="none"
626
+ stroke="currentColor"
627
+ stroke-width="2"
628
+ stroke-linecap="round"
629
+ stroke-linejoin="round"
630
+ aria-hidden="true"
631
+ >
632
+ <rect x="3" y="3" width="8" height="8" rx="2" />
633
+ <rect x="13" y="3" width="8" height="8" rx="2" />
634
+ <rect x="3" y="13" width="8" height="8" rx="2" />
635
+ <rect x="13" y="13" width="8" height="8" rx="2" />
636
+ </svg>
637
+ `,
638
+ };
639
+
640
+ const typeName = (types, value) => types.find(([v]) => v === value)?.[1] ?? "";
641
+
642
+ /**
643
+ * 유형 고르기 목록 (문제 카드의 유형 버튼을 누르면 버튼 아래에 뜬다). 열고 닫기 · 키보드는 core/editor.js가 붙인다.
644
+ * 꼭 남길 것: role="listbox", 항목마다 role="option" · data-value · aria-selected (고른 항목에는 체크)
645
+ */
646
+ export const typeMenu = ({ label, types, value }) => html`
647
+ <div class="qe-menu" role="listbox" aria-label="${label}">
648
+ ${types.map(
649
+ ([v, name]) => html`
650
+ <div
651
+ class="qe-menu-item"
652
+ role="option"
653
+ tabindex="-1"
654
+ data-value="${v}"
655
+ aria-selected="${v === value ? "true" : "false"}"
656
+ >
657
+ ${typeIcons[v]?.()}
658
+ <span class="qe-menu-label">${name}</span>
659
+ ${v === value && html`<span class="qe-menu-check" aria-hidden="true">${icons.check()}</span>`}
660
+ </div>
661
+ `,
662
+ )}
663
+ </div>
664
+ `;
665
+
419
666
  /**
420
667
  * 문항 카드. body: 문항 칸들 · types: [[값, 이름], …]
421
- * data-role="type" (유형 select) · data-role="up" · data-role="down" · data-role="delete"
668
+ * data-role="type" (유형 버튼: 누르면 typeMenu, 브라우저 select를 둬도 됨) · data-role="up" · data-role="down" · data-role="delete"
422
669
  * 문항이 하나뿐이면 ↑ · ↓는 숨긴다 (옮길 곳이 없음)
423
670
  */
424
- export const card = ({ q, index, count, types, body }) => html`
425
- <section class="qe-card">
426
- <header class="qe-card-head">
671
+ export const card = ({ q, index, count, types, body, points }) => html`
672
+ <section class="qe-card ec-edit-card">
673
+ <header class="qe-card-head ec-edit-card-head">
427
674
  <strong>${t.question(index + 1)}</strong>
428
- <select
429
- class="qe-input qe-type"
675
+ <button
676
+ type="button"
677
+ class="qe-type"
430
678
  data-role="type"
431
- aria-label="${t.questionType(index + 1)}"
679
+ data-value="${q.type}"
680
+ aria-haspopup="listbox"
681
+ aria-expanded="false"
682
+ aria-label="${t.questionTypeNow(index + 1, typeName(types, q.type))}"
432
683
  >
433
- ${types.map(
434
- ([value, name]) =>
435
- html`<option value="${value}" ${q.type === value && "selected"}>
436
- ${name}
437
- </option>`,
438
- )}
439
- </select>
684
+ ${typeIcons[q.type]?.()}
685
+ <span class="qe-type-label">${typeName(types, q.type)}</span>
686
+ ${icons.chevronDown()}
687
+ </button>
688
+ ${points !== undefined &&
689
+ html`<label class="qe-points">
690
+ <span class="qe-points-label">${t.scoring.points(index + 1)}</span>
691
+ <input
692
+ type="number"
693
+ inputmode="numeric"
694
+ min="0"
695
+ max="100"
696
+ step="1"
697
+ class="qe-points-input"
698
+ data-role="points"
699
+ aria-label="${t.scoring.points(index + 1)}"
700
+ />
701
+ <span class="qe-points-unit" aria-hidden="true">${t.scoring.unit}</span>
702
+ </label>
703
+ <span class="qe-head-sep" aria-hidden="true"></span>`}
440
704
  <button
441
705
  type="button"
442
706
  class="ec-icon-button"
@@ -470,6 +734,31 @@ export const card = ({ q, index, count, types, body }) => html`
470
734
  </section>
471
735
  `;
472
736
 
737
+ /**
738
+ * 부분 채점 설정 (문제가 2개 이상일 때 편집 화면 맨 위, 연주님 부분 채점 UI): 스위치 · 안내, 켜면 배점 방식 · 합계 · 동일 점수 버튼.
739
+ * data-role="partial"(스위치) · "sum"(합계 줄, data-mode="equal|custom") · "mode" · "total" · "equal" · "note"
740
+ */
741
+ export const scoreSettings = ({ partial }) => html`
742
+ <section class="qe-score" data-role="score-settings">
743
+ <label class="qe-score-switch">
744
+ <span class="qe-sw">
745
+ <input type="checkbox" role="switch" data-role="partial" ${partial && "checked"} />
746
+ <span class="qe-sw-track" aria-hidden="true"></span>
747
+ </span>
748
+ <span class="qe-score-title">${t.scoring.toggle}</span>
749
+ <span class="qe-score-hint">${partial ? t.scoring.hintOn : t.scoring.hintOff}</span>
750
+ </label>
751
+ <div class="qe-score-sum" data-role="sum" ${!partial && "hidden"}>
752
+ <div class="qe-score-row">
753
+ <span class="qe-score-mode" data-role="mode"></span>
754
+ <span class="qe-score-total" data-role="total" role="status"></span>
755
+ <button type="button" class="qe-score-equal" data-role="equal">${t.scoring.equal}</button>
756
+ </div>
757
+ <p class="qe-score-note" data-role="note"></p>
758
+ </div>
759
+ </section>
760
+ `;
761
+
473
762
  /** 저장하지 못한 정답 문제 (정답 자리 위). data-role="answer-error" */
474
763
  export const answerError = ({ text }) =>
475
764
  html`<p class="qe-answer-error" data-role="answer-error" role="alert">
@@ -477,16 +766,17 @@ export const answerError = ({ text }) =>
477
766
  </p>`;
478
767
 
479
768
  /**
480
- * 스낵바 (EDS Snackbar · info): 짧은 알림 + 되돌리기. 화면 아래에 떠 있다. data-role="undo" (되돌리기 버튼)
769
+ * 스낵바 (EDS Snackbar · info): 짧은 알림 + 되돌리기(action이 없으면 알림만). 화면 아래에 떠 있다. data-role="undo" (되돌리기 버튼)
481
770
  * 상태 알림이라 role="status" (초점을 가져가지 않고 낭독기가 읽음)
482
771
  */
483
772
  export const snackbar = ({ text, action }) => html`
484
- <div class="qe-snackbar" role="status">
485
- <span class="qe-snackbar-icon">${icons.info()}</span>
486
- <span class="qe-snackbar-text">${text}</span>
487
- <button type="button" class="qe-snackbar-action" data-role="undo">
773
+ <div class="qe-snackbar ec-snackbar" role="status">
774
+ <span class="qe-snackbar-icon ec-snackbar-icon">${icons.info()}</span>
775
+ <span class="qe-snackbar-text ec-snackbar-text">${text}</span>
776
+ ${action &&
777
+ html`<button type="button" class="qe-snackbar-action ec-snackbar-action" data-role="undo">
488
778
  ${action}
489
- </button>
779
+ </button>`}
490
780
  </div>
491
781
  `;
492
782
 
@@ -499,13 +789,15 @@ export const answersIntro = ({ text }) =>
499
789
  * textAnswerRow: data-role="input" · "delete" / textAnswerAdd: data-role="add"
500
790
  */
501
791
  export const textAnswerRow = ({ index, canDelete }) => html`
502
- <div class="qe-option qe-text-answer">
503
- <input
504
- class="qe-inline-input qe-option-text"
792
+ <div class="qe-option qe-text-answer ec-list-row">
793
+ <textarea
794
+ class="qe-inline-input qe-option-text ec-field-input"
505
795
  data-role="input"
796
+ data-soft-wrap
797
+ rows="1"
506
798
  aria-label="${ta.textInput(index)}"
507
799
  placeholder="${ta.textInput(index)}"
508
- />
800
+ ></textarea>
509
801
  <button
510
802
  type="button"
511
803
  class="ec-icon-button ec-danger"
@@ -520,13 +812,13 @@ export const textAnswerRow = ({ index, canDelete }) => html`
520
812
  `;
521
813
 
522
814
  export const textAnswerAdd = () =>
523
- html`<button type="button" class="qe-add" data-role="add">${ta.addText}</button>`;
815
+ html`<button type="button" class="qe-add ec-list-add" data-role="add">${ta.addText}</button>`;
524
816
 
525
- export const textAnswers = ({ rows, add }) => html`<div class="qe-options qe-text-answers">${rows}${add}</div>`;
817
+ export const textAnswers = ({ rows, add }) => html`<div class="qe-options qe-text-answers ec-list">${rows}${add}</div>`;
526
818
 
527
819
  /** 문항 추가 버튼 */
528
820
  export const addQuestion = () =>
529
- html`<button type="button" class="qe-add qe-add-question">
821
+ html`<button type="button" class="qe-add qe-add-question ec-add">
530
822
  ${t.addQuestion}
531
823
  </button>`;
532
824
 
@@ -544,12 +836,14 @@ export const groupBox = ({ letter, canDelete, rows, add, nameLabel, namePlacehol
544
836
  <div class="qe-group" data-group-box>
545
837
  <div class="qe-group-head">
546
838
  <span class="qe-group-badge">${letter}</span>
547
- <input
548
- class="qe-inline-input qe-group-name"
839
+ <textarea
840
+ class="qe-inline-input qe-group-name ec-field-input"
549
841
  data-role="group-name"
842
+ data-soft-wrap
843
+ rows="1"
550
844
  aria-label="${nameLabel}"
551
845
  placeholder="${namePlaceholder}"
552
- />
846
+ ></textarea>
553
847
  <button
554
848
  type="button"
555
849
  class="ec-icon-button ec-danger"
@@ -561,7 +855,7 @@ export const groupBox = ({ letter, canDelete, rows, add, nameLabel, namePlacehol
561
855
  ${icons.xmark()}
562
856
  </button>
563
857
  </div>
564
- <div class="qe-options">${rows}${add}</div>
858
+ <div class="qe-options ec-list">${rows}${add}</div>
565
859
  </div>
566
860
  `;
567
861
 
@@ -569,7 +863,7 @@ export const noneBox = ({ rows, add, canClose, closeTitle, hint = t.noneHint })
569
863
  <div class="qe-group qe-group-none" data-group-box>
570
864
  <div class="qe-group-head">
571
865
  <strong>${t.noneTitle}</strong>
572
- <span class="qe-hint-inline" title="${hint}">${hint}</span>
866
+ <span class="qe-hint-inline ec-hint-inline" title="${hint}">${hint}</span>
573
867
  <button
574
868
  type="button"
575
869
  class="ec-icon-button ec-danger"
@@ -581,13 +875,13 @@ export const noneBox = ({ rows, add, canClose, closeTitle, hint = t.noneHint })
581
875
  ${icons.xmark()}
582
876
  </button>
583
877
  </div>
584
- <div class="qe-options">${rows}${add}</div>
878
+ <div class="qe-options ec-list">${rows}${add}</div>
585
879
  </div>
586
880
  `;
587
881
 
588
882
  export const noneAdd = () => html`
589
- <div class="qe-reveal qe-reveal-card">
590
- <button type="button" class="qe-reveal-button" data-role="none-add">
883
+ <div class="qe-reveal qe-reveal-card ec-reveal">
884
+ <button type="button" class="qe-reveal-button ec-reveal-button" data-role="none-add">
591
885
  <span>${t.addNone}</span><span aria-hidden="true">+</span>
592
886
  </button>
593
887
  </div>
@@ -597,7 +891,7 @@ export const noneAdd = () => html`
597
891
  export const groupBoard = ({ boxes, add, none }) => html`
598
892
  <div class="qe-groups">
599
893
  ${boxes}
600
- <div class="qe-options">${add}</div>
894
+ <div class="qe-options ec-list">${add}</div>
601
895
  ${none}
602
896
  </div>
603
897
  `;
@@ -607,7 +901,7 @@ export const groupBoard = ({ boxes, add, none }) => html`
607
901
  * orderList는 끌어 놓을 곳이라 data-group-box와 data-group="order"를 가진다
608
902
  */
609
903
  export const orderList = ({ rows, add }) => html`
610
- <div class="qe-options" data-group-box data-group="order">${rows}${add}</div>
904
+ <div class="qe-options ec-list" data-group-box data-group="order">${rows}${add}</div>
611
905
  `;
612
906
 
613
907
  export const orderBoard = ({ list, none }) => html`<div class="qe-groups">${list}${none}</div>`;