@eliceio/cdk-cli 1.2.0 → 1.3.0-contenttypes.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -60
- package/es/cli.js +11 -2
- package/es/commands/build/index.js +12 -0
- package/es/commands/create/index.js +2 -1
- package/es/commands/create/scaffold.d.ts +2 -2
- package/es/commands/create/scaffold.js +3 -3
- package/es/commands/dev/index.d.ts +10 -1
- package/es/commands/dev/index.js +47 -7
- package/es/core/config.d.ts +20 -9
- package/es/core/config.js +53 -12
- package/es/core/project-check.d.ts +3 -2
- package/es/core/project-check.js +14 -3
- package/es/core/regex.d.ts +11 -0
- package/es/core/regex.js +41 -0
- package/es/core/sandbox.d.ts +26 -0
- package/es/core/sandbox.js +240 -30
- package/es/dev/check.d.ts +30 -0
- package/es/dev/check.js +224 -34
- package/es/dev/grading.d.ts +20 -1
- package/es/dev/grading.js +38 -7
- package/es/dev/host-page.js +1 -1
- package/es/dev/mock-api.d.ts +3 -1
- package/es/dev/mock-api.js +20 -11
- package/es/engines/vite/index.js +1 -1
- package/es/engines/vite/plugin.d.ts +2 -0
- package/es/engines/vite/plugin.js +33 -5
- package/es/rules/answers.d.ts +13 -0
- package/es/rules/answers.js +94 -0
- package/es/rules/check.js +70 -1
- package/es/rules/index.d.ts +1 -0
- package/es/rules/index.js +1 -0
- package/es/rules/size.d.ts +31 -0
- package/es/rules/size.js +58 -0
- package/es/rules/types.d.ts +12 -0
- package/es/rules.json.js +2 -2
- package/package.json +2 -2
- package/rules.json +32 -3
- package/skills/_shared/always.md +3 -3
- package/skills/_shared/references/00-what-the-person-decides.md +1 -1
- package/skills/_shared/references/02-design-the-material.md +10 -7
- package/skills/_shared/references/03-create-the-project.md +2 -1
- package/skills/_shared/references/05-screen-code.md +49 -22
- package/skills/_shared/references/06-using-the-quiz-template.md +7 -6
- package/skills/_shared/references/08-fix-check-errors.md +23 -22
- package/skills/_shared/references/09-check.md +7 -6
- package/skills/_shared/references/12-upload-with-the-material-mcp.md +13 -13
- package/skills/_shared/references/13-edit-screen-design.md +122 -0
- package/skills/_shared/references/14-layouts.md +96 -0
- package/skills/elice-content-check/SKILL.md +2 -2
- package/skills/elice-content-create/SKILL.md +1 -1
- package/skills/elice-content-migrate/SKILL.md +1 -1
- package/templates/_shared/lib/cdk-mock.d.ts +30 -3
- package/templates/_shared/lib/cdk-mock.js +88 -15
- package/templates/_shared/lib/elice-content-editor.js +89 -58
- package/templates/_shared/lib/elice-content.css +1313 -126
- package/templates/_shared/lib/elice-content.d.ts +162 -23
- package/templates/_shared/lib/elice-content.js +865 -84
- package/templates/_shared/lib/icons/empty-content.d.ts +2 -0
- package/templates/_shared/lib/icons/empty-content.js +11 -0
- package/templates/_shared/lib/icons/file-video.d.ts +2 -0
- package/templates/_shared/lib/icons/file-video.js +11 -0
- package/templates/_shared/lib/icons/file.d.ts +2 -0
- package/templates/_shared/lib/icons/file.js +11 -0
- package/templates/blank/README.md +5 -3
- package/templates/blank/edit.html +8 -2
- package/templates/blank/index.html +6 -1
- package/templates/blank/instructor.html +6 -1
- package/templates/blank/template.json +1 -1
- package/templates/quiz/README.md +28 -12
- package/templates/quiz/core/behaviors.d.ts +13 -7
- package/templates/quiz/core/behaviors.js +36 -51
- package/templates/quiz/core/editor.d.ts +10 -0
- package/templates/quiz/core/editor.js +471 -8
- package/templates/quiz/core/markdown.d.ts +4 -0
- package/templates/quiz/core/markdown.js +65 -11
- package/templates/quiz/core/model.d.ts +34 -1
- package/templates/quiz/core/model.js +89 -7
- package/templates/quiz/core/rich-text.d.ts +19 -0
- package/templates/quiz/core/rich-text.js +521 -0
- package/templates/quiz/edit.html +12 -3
- package/templates/quiz/index.html +12 -3
- package/templates/quiz/screens/edit.js +848 -168
- package/templates/quiz/screens/learn.js +90 -14
- package/templates/quiz/styles.css +889 -213
- package/templates/quiz/template.json +9 -2
- package/templates/quiz/ui/templates/edit.d.ts +19 -6
- package/templates/quiz/ui/templates/edit.js +666 -87
- package/templates/quiz/ui/templates/group.js +19 -8
- package/templates/quiz/ui/templates/order.js +25 -24
- package/templates/quiz/ui/templates/page.js +19 -8
- package/templates/quiz/ui/templates/question.js +2 -2
- package/templates/quiz/ui/texts.js +104 -35
- package/templates/quiz/ui/theme.css +8 -9
- package/templates/steps/README.md +77 -0
- package/templates/steps/commentary.txt +7 -0
- package/templates/steps/edit.html +21 -0
- package/templates/steps/gitignore +4 -0
- package/templates/steps/index.html +69 -0
- package/templates/steps/metadata.json +9 -0
- package/templates/steps/package.json +13 -0
- package/templates/steps/screens/edit.js +32 -0
- package/templates/steps/screens/learn.js +108 -0
- package/templates/steps/styles.css +54 -0
- package/templates/steps/template.json +6 -0
|
@@ -29,6 +29,8 @@ export declare function resolveLaunch(
|
|
|
29
29
|
export interface SubmitResult {
|
|
30
30
|
isCorrect: boolean | null;
|
|
31
31
|
score: number | null;
|
|
32
|
+
/** partial_pattern 문항별 맞음 (answer_key 순서, 없는 답은 false). pattern · rubric · 채점 없음은 [] (옛 서버는 없음) */
|
|
33
|
+
answerCorrectness?: boolean[];
|
|
32
34
|
}
|
|
33
35
|
|
|
34
36
|
export interface Navigation {
|
|
@@ -45,6 +47,10 @@ export interface SubmitOptions<A = unknown> {
|
|
|
45
47
|
validate?: (answer: A) => true | string | false;
|
|
46
48
|
/** 채점 결과 (제출 직후 · 다시 열었을 때) */
|
|
47
49
|
onResult?: (result: SubmitResult & { answer?: A }, info: { restored: boolean }) => void;
|
|
50
|
+
/** 결과 줄 문장을 화면이 정할 때. undefined를 돌려주면 키트 기본 문장 */
|
|
51
|
+
resultText?: (result: SubmitResult) => string | undefined;
|
|
52
|
+
/** true면 같은 답도 다시 제출 (기본: 제출한 답 그대로면 버튼을 끄고 "답을 고치면 다시 제출할 수 있어요.") */
|
|
53
|
+
allowUnchanged?: boolean;
|
|
48
54
|
root?: Element;
|
|
49
55
|
label?: string;
|
|
50
56
|
}
|
|
@@ -61,12 +67,17 @@ export interface SaveOptions<C> {
|
|
|
61
67
|
label?: string;
|
|
62
68
|
}
|
|
63
69
|
|
|
64
|
-
/** 채점 방식 (settings.grading.type) */
|
|
70
|
+
/** useGradingBlock이 고를 수 있는 채점 방식 (settings.grading.type 중 화면 블록이 있는 것) */
|
|
65
71
|
export type GraderType = 'pattern' | 'rubric';
|
|
66
72
|
|
|
67
|
-
/**
|
|
73
|
+
/**
|
|
74
|
+
* 채점 설정 (settings.grading, 서버 §5.1). pattern 답은 정규식 문자열 하나, rubric 기준은 문자열 하나.
|
|
75
|
+
* partial_pattern은 문항별 정규식 배열과 점수 배열 (같은 길이 1~50, 0~100 정수, 합 100 이상). 답은 문자열 배열이고
|
|
76
|
+
* 맞은 문항 점수의 합(최대 100)이 점수
|
|
77
|
+
*/
|
|
68
78
|
export type Grading =
|
|
69
79
|
| { type: 'pattern'; answer_key?: string }
|
|
80
|
+
| { type: 'partial_pattern'; answer_key: string[]; scores: number[] }
|
|
70
81
|
| { type: 'rubric'; rubric?: string };
|
|
71
82
|
|
|
72
83
|
/** @deprecated Grading을 쓴다 */
|
|
@@ -92,23 +103,89 @@ export declare const ANSWER_KEY_MAX: number;
|
|
|
92
103
|
* 문제가 없으면 null, 있으면 보여 줄 문장
|
|
93
104
|
*/
|
|
94
105
|
export declare function validateAnswerRegex(regex: string, samples?: string[]): string | null;
|
|
106
|
+
/** partial_pattern 문항 수 상한 */
|
|
107
|
+
export declare const PARTIAL_ITEMS_MAX: number;
|
|
108
|
+
/**
|
|
109
|
+
* partial_pattern 채점 설정 검사 (서버 저장 규칙과 같게): 문항 수 · 개수 일치 · 0~100 정수 · 합 100 이상 ·
|
|
110
|
+
* 문항마다 validateAnswerRegex. 문제가 없으면 null, 있으면 보여 줄 문장
|
|
111
|
+
*/
|
|
112
|
+
export declare function validatePartialGrading(grading: {
|
|
113
|
+
answer_key: string[];
|
|
114
|
+
scores: number[];
|
|
115
|
+
}): string | null;
|
|
116
|
+
/** 문항 n개에 100점을 정수로 똑같이 나눔. 합은 꼭 100, 나머지는 뒤 문항에 (3 → [33, 33, 34]) */
|
|
117
|
+
export declare function splitScores(n: number): number[];
|
|
118
|
+
/** 정답 정규식(Python re) → JS { source, flags }. 맨 앞 (?i) · (?s) · (?m)은 JS 플래그로 */
|
|
119
|
+
export declare function toJsRegex(regex: string): { source: string; flags: string };
|
|
120
|
+
/** 정답 정규식이 답(앞뒤 공백을 자름) 전체와 맞는지 (서버 채점과 같은 판정). 정규식이 틀리면 false */
|
|
121
|
+
export declare function matchesAnswer(regex: string, answer: string): boolean;
|
|
95
122
|
/** 저장된 채점 설정을 서버 모양으로 (SDK가 바꾼 answerKey → answer_key). 채점 방식이 아니면 null */
|
|
96
123
|
export declare function normalizeGrading(grading: unknown): Grading | null;
|
|
97
124
|
|
|
98
|
-
export interface
|
|
99
|
-
/** 단계 수 (1 이상) */
|
|
100
|
-
count
|
|
101
|
-
/**
|
|
102
|
-
|
|
103
|
-
|
|
125
|
+
export interface StepperOptions {
|
|
126
|
+
/** 단계 수 (1 이상). 없으면 내용 영역 안 `<section data-ec-step>` 수: 키트가 hidden으로 하나만 보인다 */
|
|
127
|
+
count?: number;
|
|
128
|
+
/**
|
|
129
|
+
* 단계가 바뀔 때 (0부터). 시작할 때도 한 번. `content`(기본 #app)에만 그린다: replaceChildren으로 다시 그려도 버튼은 남는다.
|
|
130
|
+
* `section`: data-ec-step 단계면 보이는 단계 요소 (count로 만들면 null). 떠나는 단계의 타이머 · 소리 · 영상은 여기서 멈춘다
|
|
131
|
+
*/
|
|
132
|
+
onChange?: (step: number, ctx: { content: Element; section: Element | null }) => void;
|
|
133
|
+
/** 처음 단계 (기본 0, remember면 기억한 단계) */
|
|
104
134
|
start?: number;
|
|
105
|
-
/** 내용 영역 (기본 #app). 키트가 이 영역을 틀로 감싸고
|
|
135
|
+
/** 내용 영역 (기본 #app). 키트가 이 영역을 틀로 감싸고 버튼 · n / N은 틀에 둔다 */
|
|
106
136
|
root?: Element;
|
|
137
|
+
/**
|
|
138
|
+
* 다음으로 가도 되는지 (단계마다, 기본 늘 됨). 문장을 돌려주면 다음 버튼을 막고 그 문장을 툴팁 · 버튼 이름으로 알린다.
|
|
139
|
+
* 단계 안 상태가 바뀌면 refresh()로 다시 묻게 한다
|
|
140
|
+
*/
|
|
141
|
+
canNext?: (step: number) => true | string | false;
|
|
142
|
+
/**
|
|
143
|
+
* 마지막 단계를 이 브라우저에 기억해 다음에 거기서 연다 (기본 false, 문자열이면 저장 이름).
|
|
144
|
+
* 그 브라우저(localStorage)에만 남고 서버에는 저장하지 않는다 (학습 기록 아님). 저장소 오류는 try/catch로 넘긴다
|
|
145
|
+
*/
|
|
146
|
+
remember?: boolean | string;
|
|
107
147
|
}
|
|
108
148
|
|
|
149
|
+
/** @deprecated StepperOptions (usePaging은 useStepper의 옛 이름) */
|
|
150
|
+
export type PagingOptions = StepperOptions;
|
|
151
|
+
|
|
152
|
+
export interface Stepper {
|
|
153
|
+
/** 키트 틀 (.ec-stepper: 내용 영역과 버튼 묶음을 담음) */
|
|
154
|
+
element: Element;
|
|
155
|
+
/** 화면 코드가 그리는 내용 영역 (기본 #app) */
|
|
156
|
+
content: Element;
|
|
157
|
+
/** 이전 · 다음 버튼과 n / N (`<ec-stepper-nav>`, Shadow DOM) */
|
|
158
|
+
nav: HTMLElement;
|
|
159
|
+
/** 이전 · 다음 수업 자료가 있는지 확인을 마쳤을 때 */
|
|
160
|
+
ready: Promise<void>;
|
|
161
|
+
go(step: number): void;
|
|
162
|
+
/** canNext를 다시 묻고 버튼을 다시 그린다 */
|
|
163
|
+
refresh(): void;
|
|
164
|
+
readonly step: number;
|
|
165
|
+
readonly count: number;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/** 콘텐츠 레이아웃 (`data-ec-layout`, lib/elice-content.css "레이아웃" 절) */
|
|
169
|
+
export type ContentLayout = 'single' | 'split' | 'stage' | 'media';
|
|
170
|
+
/** 레이아웃 안 이름 붙은 칸 (`data-ec-region`) */
|
|
171
|
+
export type LayoutRegion = 'main' | 'aside' | 'stage' | 'controls' | 'readout' | 'actions';
|
|
172
|
+
|
|
109
173
|
/** 화면 맨 위 안내 한 줄. mock SDK일 때만 글자가 있고, 플랫폼(real)에서는 늘 '' */
|
|
110
174
|
export declare function statusText(app: ContentApp): string;
|
|
111
175
|
|
|
176
|
+
/** app.emptyState() 옵션. 모두 생략하면 기본 문구 · 화면 테마 색 */
|
|
177
|
+
export interface EmptyStateOptions {
|
|
178
|
+
/** 제목 (기본 "학습 자료를 준비하고 있어요") */
|
|
179
|
+
title?: string;
|
|
180
|
+
/** 설명 (기본 "준비가 완료되면 이곳에서 볼 수 있어요"). ''이면 설명 줄 없음 */
|
|
181
|
+
description?: string;
|
|
182
|
+
/**
|
|
183
|
+
* 'dark': 밝은 테마 화면 안의 어두운 바탕(예: 문서 학생 화면)에 놓을 때 어두운 그림 · 흰 글자.
|
|
184
|
+
* 생략하면 화면 테마를 따른다 (밝은 테마 = 밝은 그림, data-eds-theme="dark" = 어두운 그림)
|
|
185
|
+
*/
|
|
186
|
+
theme?: 'dark';
|
|
187
|
+
}
|
|
188
|
+
|
|
112
189
|
export interface ContentApp<C = Record<string, unknown>> {
|
|
113
190
|
screen: Screen;
|
|
114
191
|
scope: Scope;
|
|
@@ -126,9 +203,9 @@ export interface ContentApp<C = Record<string, unknown>> {
|
|
|
126
203
|
readonly content: C;
|
|
127
204
|
/** 편집 화면이 내용을 저장했는지. false면 학생 · 교육자 화면은 emptyState()를 보여 준다 */
|
|
128
205
|
readonly hasContent: boolean;
|
|
129
|
-
/** "
|
|
130
|
-
emptyState(): Element;
|
|
131
|
-
/** 저장된 채점 설정. edit 범위(편집
|
|
206
|
+
/** 빈 안내 요소: 그림 + "학습 자료를 준비하고 있어요" + 설명 (학생 · 교육자 화면에서 hasContent가 false일 때) */
|
|
207
|
+
emptyState(options?: EmptyStateOptions): Element;
|
|
208
|
+
/** 저장된 채점 설정. edit 범위(편집 화면)에서만, 없으면 null */
|
|
132
209
|
readonly grading: Grading | null;
|
|
133
210
|
submit(answer: unknown): Promise<SubmitResult>;
|
|
134
211
|
lastAnswer(): Promise<unknown>;
|
|
@@ -144,17 +221,13 @@ export interface ContentApp<C = Record<string, unknown>> {
|
|
|
144
221
|
useSubmit<A = unknown>(
|
|
145
222
|
options: SubmitOptions<A>
|
|
146
223
|
): { element: Element; result: Element; restored: Promise<void> };
|
|
147
|
-
/**
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
ready: Promise<void>;
|
|
155
|
-
go(step: number): void;
|
|
156
|
-
readonly step: number;
|
|
157
|
-
};
|
|
224
|
+
/**
|
|
225
|
+
* 자료 안 여러 단계 (스테퍼): 양옆 거터 세로 가운데 이전 · 다음, 왼쪽 아래 n / N (모바일은 화면 아래 둥근 묶음).
|
|
226
|
+
* 첫 · 마지막 단계에서는 LXP 이전 · 다음 수업 자료로 (없으면 숨김). ← → 키, 단계를 넘기면 제목에 초점
|
|
227
|
+
*/
|
|
228
|
+
useStepper(options?: StepperOptions): Stepper;
|
|
229
|
+
/** useStepper의 옛 이름 (같은 동작) */
|
|
230
|
+
usePaging(options: StepperOptions): Stepper;
|
|
158
231
|
/** 편집 화면 저장 영역 */
|
|
159
232
|
useSave(options: SaveOptions<C>): {
|
|
160
233
|
element: Element;
|
|
@@ -199,3 +272,69 @@ export interface StartOptions {
|
|
|
199
272
|
export declare function start<C = Record<string, unknown>>(
|
|
200
273
|
options: StartOptions
|
|
201
274
|
): Promise<ContentApp<C>>;
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* 불러오는 동안 보일 자리 (`.ec-sk`, role="status", 글은 화면 읽기 프로그램에만). start()를 기다리기 전에 #app에 넣는다.
|
|
278
|
+
* 'learn': 화면을 채우는 면 하나. 'edit': parts를 위에서부터 (기본 파일 줄 'bar' + 16:9 미리보기 'media')
|
|
279
|
+
*/
|
|
280
|
+
export declare function skeleton(
|
|
281
|
+
layout?: 'learn' | 'edit',
|
|
282
|
+
opts?: { label?: string; parts?: Array<'bar' | 'media'> }
|
|
283
|
+
): HTMLElement;
|
|
284
|
+
|
|
285
|
+
/** 스낵바가 떠 있는 시간 (ms, 6000) */
|
|
286
|
+
export declare const SNACKBAR_MS: number;
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* 편집 화면 스낵바 (.ec-snackbar): 지우기 · 바꾸기 뒤 "되돌리기"를 화면 아래에 잠깐. 한 번에 하나, body에 붙고
|
|
290
|
+
* 저장 전 표시를 켜지 않는다. focus: true면 되돌리기 버튼에 초점
|
|
291
|
+
*/
|
|
292
|
+
export declare function showSnackbar(opts: {
|
|
293
|
+
text: string;
|
|
294
|
+
/** 버튼 글자 (기본 '되돌리기') */
|
|
295
|
+
action?: string;
|
|
296
|
+
/** 없으면 버튼 없이 알림만 */
|
|
297
|
+
onAction?: () => void;
|
|
298
|
+
/** 닫힐 때 한 번 (지우기 전에 부름): 'action' · 'timeout' · 'replaced' · 'close' */
|
|
299
|
+
onClose?: (reason: 'action' | 'timeout' | 'replaced' | 'close') => void;
|
|
300
|
+
ms?: number;
|
|
301
|
+
focus?: boolean;
|
|
302
|
+
}): { element: HTMLElement; close: (reason?: string) => void };
|
|
303
|
+
|
|
304
|
+
/** 파일 크기 · 길이(초) · 쪽 수를 "1.4MB, 8쪽" · "120MB, 08:30"처럼 */
|
|
305
|
+
export declare function formatFileMeta(info?: { size?: number; duration?: number; pages?: number }): string;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* 올린 파일 한 줄 (`.ec-file-bar`): 아이콘 · 이름 · 크기 등 · "다른 파일로 변경"(data-role="change").
|
|
309
|
+
* icon은 lib/icons/에서 쓰는 것만 import (fileVideoIcon() · fileIcon())
|
|
310
|
+
*/
|
|
311
|
+
export declare function fileBar(opts: {
|
|
312
|
+
icon?: Element;
|
|
313
|
+
name: string;
|
|
314
|
+
meta?: string;
|
|
315
|
+
changeLabel?: string;
|
|
316
|
+
onChange?: () => void;
|
|
317
|
+
disabled?: boolean;
|
|
318
|
+
}): HTMLElement;
|
|
319
|
+
|
|
320
|
+
/** ⓘ 안내 목록 (`.ec-info-list`) */
|
|
321
|
+
export declare function infoList(lines: string[]): HTMLUListElement;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* canvas 그림 버퍼를 보이는 크기 × devicePixelRatio(최대 3)로 맞추고, 크기가 바뀔 때마다(ResizeObserver) 다시 맞춘 뒤
|
|
325
|
+
* onResize를 부른다 (처음 한 번은 fitCanvas 안에서 바로: 인자의 ctx로 그린다). ctx는 dpr만큼 늘려 두어 CSS px 단위로 그린다.
|
|
326
|
+
* stop()으로 지켜보기를 끝낸다
|
|
327
|
+
*/
|
|
328
|
+
export declare function fitCanvas(
|
|
329
|
+
canvas: HTMLCanvasElement,
|
|
330
|
+
onResize?: (size: {
|
|
331
|
+
ctx: CanvasRenderingContext2D | null;
|
|
332
|
+
width: number;
|
|
333
|
+
height: number;
|
|
334
|
+
dpr: number;
|
|
335
|
+
}) => void
|
|
336
|
+
): {
|
|
337
|
+
ctx: CanvasRenderingContext2D | null;
|
|
338
|
+
readonly size: { width: number; height: number; dpr: number };
|
|
339
|
+
stop(): void;
|
|
340
|
+
};
|