@eliceio/cdk-cli 1.4.0 → 1.5.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.
Files changed (79) hide show
  1. package/README.md +17 -16
  2. package/es/cli.js +1 -1
  3. package/es/commands/create/index.js +1 -0
  4. package/es/commands/create/scaffold.d.ts +1 -1
  5. package/es/commands/create/scaffold.js +1 -1
  6. package/es/core/config.d.ts +36 -0
  7. package/es/core/config.js +234 -6
  8. package/es/core/quiz-check.js +123 -4
  9. package/es/dev/grading.d.ts +26 -4
  10. package/es/dev/grading.js +66 -11
  11. package/es/dev/mock-api.d.ts +6 -1
  12. package/es/dev/mock-api.js +45 -6
  13. package/es/rules/answers.d.ts +1 -0
  14. package/es/rules/answers.js +8 -0
  15. package/es/rules.json.js +1 -1
  16. package/package.json +2 -2
  17. package/rules.json +1 -1
  18. package/skills/_shared/always.md +1 -1
  19. package/skills/_shared/references/02-design-the-material.md +8 -7
  20. package/skills/_shared/references/03-create-the-project.md +10 -9
  21. package/skills/_shared/references/12-upload-with-the-material-mcp.md +5 -5
  22. package/skills/_shared/references/16-using-the-survey-template.md +158 -0
  23. package/skills/elice-content-create/SKILL.md +2 -2
  24. package/skills/elice-content-edit/SKILL.md +2 -2
  25. package/skills/elice-content-publish/SKILL.md +1 -1
  26. package/templates/_shared/lib/cdk-mock.d.ts +22 -3
  27. package/templates/_shared/lib/cdk-mock.js +78 -11
  28. package/templates/_shared/lib/elice-content.d.ts +17 -1
  29. package/templates/_shared/lib/elice-content.js +47 -5
  30. package/templates/blank/template.json +1 -1
  31. package/templates/document/template.json +1 -1
  32. package/templates/quiz/README.md +26 -1
  33. package/templates/quiz/core/behaviors.d.ts +5 -0
  34. package/templates/quiz/core/behaviors.js +16 -1
  35. package/templates/quiz/core/model.d.ts +78 -1
  36. package/templates/quiz/core/model.js +219 -4
  37. package/templates/quiz/screens/edit.js +244 -55
  38. package/templates/quiz/screens/learn.js +137 -27
  39. package/templates/quiz/styles.css +258 -5
  40. package/templates/quiz/template.json +1 -1
  41. package/templates/quiz/ui/templates/edit.d.ts +1 -0
  42. package/templates/quiz/ui/templates/edit.js +67 -8
  43. package/templates/quiz/ui/templates/page.js +34 -0
  44. package/templates/quiz/ui/templates/text.js +15 -2
  45. package/templates/quiz/ui/texts.js +61 -0
  46. package/templates/steps/template.json +1 -1
  47. package/templates/survey/README.md +112 -0
  48. package/templates/survey/commentary.txt +2 -0
  49. package/templates/survey/core/behaviors.d.ts +14 -0
  50. package/templates/survey/core/behaviors.js +115 -0
  51. package/templates/survey/core/dom.d.ts +13 -0
  52. package/templates/survey/core/dom.js +83 -0
  53. package/templates/survey/core/editor.d.ts +80 -0
  54. package/templates/survey/core/editor.js +720 -0
  55. package/templates/survey/core/markdown.d.ts +21 -0
  56. package/templates/survey/core/markdown.js +298 -0
  57. package/templates/survey/core/model.d.ts +83 -0
  58. package/templates/survey/core/model.js +209 -0
  59. package/templates/survey/core/rich-text.d.ts +18 -0
  60. package/templates/survey/core/rich-text.js +469 -0
  61. package/templates/survey/edit.html +26 -0
  62. package/templates/survey/gitignore +4 -0
  63. package/templates/survey/index.html +26 -0
  64. package/templates/survey/metadata.json +9 -0
  65. package/templates/survey/package.json +13 -0
  66. package/templates/survey/screens/edit.js +345 -0
  67. package/templates/survey/screens/learn.js +100 -0
  68. package/templates/survey/styles.css +1264 -0
  69. package/templates/survey/template.json +6 -0
  70. package/templates/survey/ui/templates/edit.d.ts +27 -0
  71. package/templates/survey/ui/templates/edit.js +656 -0
  72. package/templates/survey/ui/templates/index.d.ts +3 -0
  73. package/templates/survey/ui/templates/index.js +3 -0
  74. package/templates/survey/ui/templates/learn.js +147 -0
  75. package/templates/survey/ui/templates/page.js +19 -0
  76. package/templates/survey/ui/texts.d.ts +3 -0
  77. package/templates/survey/ui/texts.js +116 -0
  78. package/templates/survey/ui/theme.css +42 -0
  79. package/templates/video/template.json +10 -3
@@ -0,0 +1,3 @@
1
+ // ui/templates/index.js 타입 (테스트용)
2
+ /* eslint-disable @typescript-eslint/no-explicit-any */
3
+ export declare const templates: Record<string, (props?: any) => any>;
@@ -0,0 +1,3 @@
1
+ // 학생 화면이 쓰는 HTML 조각 모음. 화면(screens/learn.js)이 이 모음을 core/behaviors.js에 넘깁니다.
2
+ // 편집 화면 조각은 edit.js에 따로 있습니다.
3
+ export * as templates from './learn.js';
@@ -0,0 +1,147 @@
1
+ // 학생 화면의 HTML 조각. 값 읽기 · 채우기는 core/behaviors.js가 data-role로 찾아 붙입니다.
2
+ // 마크업 · 클래스는 자유롭게 바꿔도 되고, 각 조각에 적힌 data-role만 남기면 동작이 그대로입니다.
3
+ import { html } from '../../core/dom.js';
4
+ import { markdown } from '../../core/markdown.js';
5
+ import { texts } from '../texts.js';
6
+
7
+ const t = texts.learn;
8
+
9
+ /** 설문 머리: 설문 안내(있으면) · 필수 표시 안내(필수 문항이 있으면) */
10
+ export const head = ({ description, hasRequired }) => html`
11
+ <header class="sv-head">
12
+ ${description && markdown(description, 'qz-markdown qz-lead')}
13
+ ${hasRequired &&
14
+ html`<p class="qz-muted"><span class="sv-req sv-req-note">*</span> ${t.requiredNote}</p>`}
15
+ </header>
16
+ `;
17
+
18
+ /**
19
+ * 문항 겉모양: "번호. 질문" · 필수 표시 · 설명 · 본문. 동작이 data-role="question" · data-id를 붙입니다
20
+ * @param {{ q: object, no: number, body: Node }} props
21
+ */
22
+ export const question = ({ q, no, body }) => html`
23
+ <fieldset class="qz-question">
24
+ <legend class="qz-question-head">
25
+ <span class="qz-question-title">${no}. ${q.title}</span>
26
+ ${q.required &&
27
+ html`<span class="sv-req" aria-hidden="true">*</span
28
+ ><span class="ec-visually-hidden">${t.required}</span>`}
29
+ </legend>
30
+ ${q.description && markdown(q.description, 'qz-markdown qz-passage sv-desc')} ${body}
31
+ </fieldset>
32
+ `;
33
+
34
+ /**
35
+ * 단일 · 다중 선택 보기 목록. 꼭 남길 것: 보기마다 <input data-role="choice" value="보기 id"> (radio · checkbox)
36
+ * '기타'가 있으면 동작이 other()를 목록 끝에 붙인다
37
+ */
38
+ export const choice = ({ q, multiple }) => html`
39
+ <div class="qz-options" role="${multiple ? 'group' : 'radiogroup'}">
40
+ ${q.options.map(
41
+ o => html`
42
+ <label class="qz-option">
43
+ <input
44
+ type="${multiple ? 'checkbox' : 'radio'}"
45
+ name="q-${q.id}"
46
+ value="${o.id}"
47
+ data-role="choice"
48
+ />
49
+ <span>${o.text}</span>
50
+ </label>
51
+ `
52
+ )}
53
+ </div>
54
+ `;
55
+
56
+ /**
57
+ * '기타(자유 입력)' 보기: 고르는 칸(data-role="choice", value="other") + 바로 쓰는 글 칸(data-role="other-text")
58
+ * 글 칸을 누르거나 쓰면 동작이 이 보기를 고른다
59
+ */
60
+ export const other = ({ q, no, multiple, value, max }) => html`
61
+ <label class="qz-option sv-other">
62
+ <input
63
+ type="${multiple ? 'checkbox' : 'radio'}"
64
+ name="q-${q.id}"
65
+ value="${value}"
66
+ data-role="choice"
67
+ />
68
+ <input
69
+ class="sv-other-text"
70
+ data-role="other-text"
71
+ aria-label="${t.otherInput(no)}"
72
+ placeholder="${t.otherPlaceholder}"
73
+ maxlength="${max}"
74
+ />
75
+ </label>
76
+ `;
77
+
78
+ /**
79
+ * 척도: 수 칸 한 줄(좁은 화면은 7칸부터 두 줄) + 양 끝 이름. 꼭 남길 것: 칸마다 <input type="radio" data-role="choice" value="수">
80
+ * @param {{ q: object, steps: number[], columns: { wide: number, narrow: number }, minLabel: string, maxLabel: string }} props
81
+ */
82
+ export const scale = ({ q, steps, columns, minLabel, maxLabel }) => html`
83
+ <div class="sv-scale">
84
+ <div
85
+ class="sv-scale-row"
86
+ role="radiogroup"
87
+ style="--sv-cols: ${columns.wide}; --sv-cols-narrow: ${columns.narrow}"
88
+ >
89
+ ${steps.map(
90
+ n => html`
91
+ <label class="sv-scale-step">
92
+ <input
93
+ type="radio"
94
+ name="q-${q.id}"
95
+ value="${n}"
96
+ aria-label="${t.scaleLabel(n)}"
97
+ data-role="choice"
98
+ />
99
+ <span>${n}</span>
100
+ </label>
101
+ `
102
+ )}
103
+ </div>
104
+ ${(minLabel || maxLabel) &&
105
+ html`<div class="sv-scale-ends"><span>${minLabel}</span><span>${maxLabel}</span></div>`}
106
+ </div>
107
+ `;
108
+
109
+ /** 서술형 입력란 (처음 4줄 높이, 넘으면 글에 맞춰 높이가 늚). 꼭 남길 것: data-role="input" */
110
+ export const text = ({ no, max }) => html`
111
+ <textarea
112
+ class="qz-text sv-text sv-grow"
113
+ data-role="input"
114
+ rows="4"
115
+ placeholder="${t.textPlaceholder}"
116
+ aria-label="${t.textLabel(no)}"
117
+ maxlength="${max}"
118
+ ></textarea>
119
+ `;
120
+
121
+ /**
122
+ * 제출한 뒤 보이는 화면 (처음엔 hidden). data-role="done-title" (초점이 감) · "done-edit" (응답 확인하고 수정하기)
123
+ */
124
+ export const done = () => html`
125
+ <section class="sv-done" hidden>
126
+ <span class="sv-done-icon" aria-hidden="true"
127
+ ><svg
128
+ viewBox="0 0 24 24"
129
+ width="28"
130
+ height="28"
131
+ fill="none"
132
+ stroke="currentColor"
133
+ stroke-width="2.5"
134
+ stroke-linecap="round"
135
+ stroke-linejoin="round"
136
+ >
137
+ <path d="M5 12.5l4.5 4.5L19 7.5" /></svg
138
+ ></span>
139
+ <h2 class="sv-done-title" data-role="done-title" tabindex="-1">${t.doneTitle}</h2>
140
+ <p class="sv-done-hint">${t.doneHint}</p>
141
+ <button type="button" class="sv-done-edit" data-role="done-edit">${t.doneEdit}</button>
142
+ </section>
143
+ `;
144
+
145
+ /** 문항 목록 묶음 (머리 + 문항들) */
146
+ export const survey = ({ head: top, questions }) =>
147
+ html`<div class="sv-survey">${top}${questions}</div>`;
@@ -0,0 +1,19 @@
1
+ // 불러오는 동안 보이는 자리. 문항이 없을 때 안내는 키트 app.emptyState() (screens/learn.js)
2
+ import { html } from '../../core/dom.js';
3
+ import { texts } from '../texts.js';
4
+
5
+ /**
6
+ * 내용을 받기 전까지의 자리 (학생 · 편집 공통, 퀴즈와 같은 모양): 질문 막대 하나 + 보기 막대 넷이 천천히 깜빡인다.
7
+ * 0.2초 뒤에야 보여 빨리 열리면 아무것도 보이지 않는다. 문구는 화면 읽기 프로그램에만 (styles.css .qz-skeleton).
8
+ * HTML(index.html · edit.html)의 #app 안 자리도 같은 마크업으로 맞춘다
9
+ */
10
+ export const loading = () => html`
11
+ <div class="qz-skeleton" role="status">
12
+ <span class="ec-visually-hidden">${texts.page.loading}</span>
13
+ <span class="qz-sk qz-sk-title"></span>
14
+ <span class="qz-sk qz-sk-option"></span>
15
+ <span class="qz-sk qz-sk-option"></span>
16
+ <span class="qz-sk qz-sk-option"></span>
17
+ <span class="qz-sk qz-sk-option"></span>
18
+ </div>
19
+ `;
@@ -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,116 @@
1
+ // 설문 화면에 보이는 문구 모음 (학생 · 편집). 문구를 바꾸려면 여기만 고치면 됩니다.
2
+ // 숫자 · 이름이 들어가는 문구는 함수입니다: 모양(인자)은 그대로 두고 돌려주는 글만 바꾸세요.
3
+
4
+ export const texts = {
5
+ /** 문항 유형 이름 (편집 화면 유형 고르기) */
6
+ types: {
7
+ single: '단일 선택',
8
+ multiple: '다중 선택',
9
+ scale: '척도',
10
+ text: '서술형',
11
+ },
12
+
13
+ /** 브라우저 탭 제목 · 불러오는 동안 보이는 문구 (화면이 넣음. HTML의 같은 글은 스크립트가 돌기 전 대비용) */
14
+ page: {
15
+ learn: '학생 화면',
16
+ edit: '내용 편집',
17
+ loading: '불러오는 중…',
18
+ },
19
+
20
+ /** 학생 화면 */
21
+ learn: {
22
+ // 제출 버튼 (다시 낼 때는 키트가 앞에 "다시 "를 붙임: "다시 제출하기")
23
+ submit: '제출하기',
24
+ required: '필수',
25
+ requiredNote: '표시는 꼭 답해야 하는 문항입니다.',
26
+ unanswered: no => `${no}번 문항에 답해 주세요.`,
27
+ otherInput: no => `${no}번 문항 기타 내용`,
28
+ otherPlaceholder: '기타(자유 입력)',
29
+ otherEmpty: no => `${no}번 문항의 '기타' 내용을 적어 주세요.`,
30
+ // 문항이 바뀌어 고른 보기가 없어졌을 때 등 (서버가 받지 않는 답)
31
+ invalid: no => `${no}번 문항 답을 다시 골라 주세요.`,
32
+ textPlaceholder: '자유롭게 입력해 주세요.',
33
+ textLabel: no => `${no}번 문항 답`,
34
+ scaleLabel: n => `${n}점`,
35
+ // 제출한 뒤 보이는 화면
36
+ doneTitle: '응답해 주셔서 감사합니다.',
37
+ doneHint: '제출한 응답은 확인하고 수정해서 다시 제출할 수 있습니다.',
38
+ doneEdit: '응답 확인하고 수정하기',
39
+ // 올린 그림을 받지 못함 (주소 만료 · 10초 넘김)
40
+ imageExpired: '이미지 주소가 만료되었습니다. 새로고침해 주세요.',
41
+ },
42
+
43
+ /** 편집 화면 */
44
+ edit: {
45
+ // 저장 버튼 (LXP 편집 화면 안내와 같게)
46
+ done: '초안으로 저장',
47
+ surveyDescription: '설문 안내 (선택)',
48
+ count: (length, max) => `${length} / ${max}`,
49
+ question: no => `문항 ${no}`,
50
+ questionTypeNow: (no, type) => `문항 ${no} 유형: ${type}`,
51
+ questionUp: no => `문항 ${no} 위로`,
52
+ questionDown: no => `문항 ${no} 아래로`,
53
+ questionDelete: no => `문항 ${no} 삭제`,
54
+ titlePlaceholder: '질문을 입력하세요',
55
+ addDescription: '설명 추가',
56
+ description: '설명',
57
+ descriptionPlaceholder: '설명',
58
+ revealClose: label => `${label} 지우기`,
59
+ undo: '되돌리기',
60
+ md: {
61
+ toolbar: '서식',
62
+ bold: '굵게',
63
+ italic: '기울임',
64
+ code: '코드 (여러 문단을 고르면 코드 블록)',
65
+ strike: '취소선',
66
+ ul: '글머리 목록',
67
+ ol: '번호 목록',
68
+ image: '이미지 올리기',
69
+ imageBusy: '올리는 중…',
70
+ imageRemove: '이미지 지우기',
71
+ imageDeleted: '이미지를 삭제했습니다.',
72
+ imageNotImage: '이미지 파일만 넣을 수 있습니다.',
73
+ imageUnreadable: '이미지를 읽지 못했습니다. 다른 파일로 다시 시도해 주세요.',
74
+ imageTooBig: '이미지가 너무 큽니다. 더 작은 이미지를 올려 주세요.',
75
+ imageTotal: max =>
76
+ `이미지는 설문 전체에 ${max}개까지 넣을 수 있습니다. 안 쓰는 이미지는 글에서 지워 주세요.`,
77
+ codeSample: '코드',
78
+ },
79
+ options: '보기',
80
+ option: no => `보기 ${no}`,
81
+ optionDelete: no => `보기 ${no} 삭제`,
82
+ optionsMin: min => `보기는 ${min}개 이상이어야 합니다.`,
83
+ optionsMax: max => `보기는 최대 ${max}개까지 구성 가능합니다.`,
84
+ addOption: '+ 보기 추가',
85
+ addOther: '기타(자유 입력) 추가',
86
+ other: '기타:',
87
+ otherPreview: '학생이 직접 입력합니다',
88
+ otherDelete: "'기타(자유 입력)' 보기 삭제",
89
+ scale: '척도',
90
+ scaleMinSelect: '척도 시작값',
91
+ scaleMaxSelect: '척도 끝값',
92
+ scaleTo: '~',
93
+ scaleEndLabel: n => `${n}점 쪽 이름`,
94
+ scaleMinPlaceholder: '예: 전혀 그렇지 않다',
95
+ scaleMaxPlaceholder: '예: 매우 그렇다',
96
+ textHint: '학생이 자유롭게 답을 적습니다.',
97
+ required: '필수 응답',
98
+ requiredTitle: '켜면 학생이 이 문항에 답해야 제출할 수 있습니다',
99
+ addQuestion: '+ 문항 추가',
100
+ questionsMax: max => `문항은 최대 ${max}개까지 만들 수 있습니다.`,
101
+ sortLabel: label => `${label} 순서 바꾸기 (끌거나 ↑ · ↓ 키)`,
102
+ sortTitle: '끌어서 순서 바꾸기',
103
+ handle: '⠿',
104
+ up: '↑',
105
+ down: '↓',
106
+ },
107
+
108
+ /** 저장 전 검사 (편집 화면 저장 바에 보임) */
109
+ validation: {
110
+ noQuestions: '문항을 하나 이상 추가해 주세요.',
111
+ at: (no, message) => `문항 ${no}: ${message}`,
112
+ title: '질문을 입력해 주세요.',
113
+ optionText: '보기 내용을 입력해 주세요.',
114
+ optionsMin: min => `보기는 ${min}개 이상이어야 합니다.`,
115
+ },
116
+ };
@@ -0,0 +1,42 @@
1
+ /* 설문 테마 (퀴즈 템플릿과 같은 이름 --qz-*). 색 · 간격 · 모서리 · 보기 카드 모양을 여기서 바꿉니다 (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
+
11
+ /* 면 · 테두리 · 글자 */
12
+ --qz-surface: var(--eds-background-paper);
13
+ --qz-surface-muted: var(--eds-background-neutral);
14
+ --qz-surface-gray: var(--eds-background-gray);
15
+ --qz-border: var(--eds-surface-border);
16
+ --qz-hover: var(--eds-action-hover);
17
+ --qz-text-muted: var(--eds-text-tertiary);
18
+
19
+ /* 모서리 */
20
+ --qz-radius-card: 12px;
21
+ --qz-radius: var(--eds-radius);
22
+
23
+ /* 간격 */
24
+ --qz-card-padding: 20px;
25
+ --qz-card-gap: 12px;
26
+ --qz-list-gap: 8px;
27
+
28
+ /* 문항 카드 */
29
+ --qz-question-border: var(--ec-border);
30
+
31
+ /* 보기 카드 (단일 · 다중 선택 · 척도 칸): 퀴즈 학생 화면과 같은 회색 면 · 테두리 없음(색만 투명, 두께는 그대로라 고를 때 칸이 흔들리지 않음),
32
+ 고르면 연한 강조색 면(primary-opacity03). 고른 보기 카드는 테두리 없이, 고른 척도 칸만 강조색 테두리 (연주님 1.2.1 수정본) */
33
+ --qz-option-padding: 20px;
34
+ --qz-option-gap: 8px;
35
+ --qz-option-radius: var(--qz-radius-card);
36
+ --qz-option-border: transparent;
37
+ --qz-option-bg: var(--qz-surface-muted);
38
+ --qz-option-hover-bg: var(--qz-hover);
39
+ --qz-option-checked-border: var(--qz-accent);
40
+ --qz-option-checked-bg: var(--qz-accent-softer);
41
+ --qz-option-checked-hover-bg: color-mix(in srgb, var(--qz-accent) 16%, transparent);
42
+ }
@@ -1,6 +1,13 @@
1
1
  {
2
2
  "name": "video",
3
- "version": "2.1.2",
4
- "title": "영상",
5
- "description": "영상 한 편 보기. 올리기 · 인코딩 대기 · 재생은 Elice 비디오 플레이어(embed.js의 <elice-video-upload> · <elice-video>)가 맡음. 편집 화면에서 올린 영상 id를 저장(인코딩 중에도 저장 가능), 학생 화면은 끝까지 보면(ended) 한 번 자동 제출 (settings.completion.mode 'open'이면 열 때). 완료 정책은 LXP 자료 편집 화면의 '설정'에서 '제출 시 학습 완료'로 고름"
3
+ "version": "2.1.3",
4
+ "title": "동영상",
5
+ "description": "동영상 파일을 올립니다",
6
+ "catalog": {
7
+ "category": "theory",
8
+ "icon": "video",
9
+ "sortOrder": 20,
10
+ "thumbnailUrl": "https://static.elice.io/elice-material/custom/templates/video/thumbnail.png",
11
+ "previewUrl": "https://static.elice.io/elice-material/custom/templates/video/preview.png"
12
+ }
6
13
  }