@eliceio/cdk-cli 0.1.0-alpha.3 → 0.1.0-alpha.5
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 +288 -200
- package/es/cli.js +70 -66
- package/es/commands/build/index.d.ts +1 -1
- package/es/commands/build/index.js +27 -15
- package/es/commands/create/index.d.ts +5 -1
- package/es/commands/create/index.js +34 -15
- package/es/commands/create/install.d.ts +17 -0
- package/es/commands/create/install.js +53 -0
- package/es/commands/create/scaffold.d.ts +4 -1
- package/es/commands/create/scaffold.js +19 -13
- package/es/commands/dev/index.d.ts +1 -1
- package/es/commands/dev/index.js +5 -5
- package/es/commands/doctor/index.d.ts +29 -2
- package/es/commands/doctor/index.js +253 -55
- package/es/commands/mcp/index.d.ts +0 -12
- package/es/commands/mcp/index.js +6 -57
- package/es/commands/setup/index.d.ts +11 -3
- package/es/commands/setup/index.js +112 -37
- package/es/commands/skill/index.d.ts +46 -8
- package/es/commands/skill/index.js +151 -35
- package/es/commands/uninstall/index.d.ts +54 -0
- package/es/commands/uninstall/index.js +304 -0
- package/es/commands/update/index.d.ts +59 -0
- package/es/commands/update/index.js +251 -0
- package/es/commands/validate/index.d.ts +18 -0
- package/es/commands/{check → validate}/index.js +16 -10
- package/es/core/collect.d.ts +5 -2
- package/es/core/config.d.ts +99 -50
- package/es/core/config.js +244 -91
- package/es/core/latest.d.ts +21 -0
- package/es/core/latest.js +43 -0
- package/es/core/manifest.d.ts +2 -1
- package/es/core/manifest.js +2 -1
- package/es/core/minify.js +2 -2
- package/es/core/prepare.d.ts +18 -2
- package/es/core/prepare.js +48 -16
- package/es/core/project-check.d.ts +19 -8
- package/es/core/project-check.js +36 -9
- package/es/core/sandbox.js +2 -2
- package/es/core/sdk.d.ts +39 -0
- package/es/core/sdk.js +95 -0
- package/es/core/templates.d.ts +2 -4
- package/es/core/templates.js +2 -5
- package/es/dev/grading.d.ts +7 -8
- package/es/dev/grading.js +6 -16
- package/es/dev/host-page.d.ts +1 -1
- package/es/dev/host-page.js +12 -10
- package/es/dev/mock-api.d.ts +13 -18
- package/es/dev/mock-api.js +56 -66
- package/es/dev/server.js +52 -52
- package/es/rules/check.js +43 -31
- package/es/rules/index.d.ts +1 -1
- package/es/rules/index.js +1 -1
- package/es/rules/manifest.d.ts +28 -20
- package/es/rules/manifest.js +58 -55
- package/es/rules/types.d.ts +18 -20
- package/es/rules.json.js +2 -2
- package/es/test-packages.d.ts +7 -0
- package/package.json +3 -4
- package/rules.json +27 -43
- package/skills/_shared/always.md +4 -4
- package/skills/elice-content-check/SKILL.md +11 -8
- package/skills/elice-content-create/SKILL.md +8 -7
- package/skills/elice-content-guide/SKILL.md +42 -0
- package/skills/elice-content-guide/topics/00-what-the-person-decides.md +11 -0
- package/skills/elice-content-guide/topics/01-check-the-environment.md +10 -0
- package/skills/elice-content-guide/topics/02-design-the-material.md +35 -0
- package/skills/elice-content-guide/topics/03-create-the-project.md +22 -0
- package/skills/elice-content-guide/topics/04-rules.md +12 -0
- package/skills/elice-content-guide/topics/05-screen-code.md +101 -0
- package/skills/elice-content-guide/topics/06-using-the-quiz-template.md +22 -0
- package/skills/elice-content-guide/topics/07-move-existing-html.md +10 -0
- package/skills/elice-content-guide/topics/08-fix-check-errors.md +24 -0
- package/skills/elice-content-guide/topics/09-check.md +10 -0
- package/skills/elice-content-guide/topics/10-build.md +8 -0
- package/skills/elice-content-guide/topics/11-more.md +4 -0
- package/skills/elice-content-guide/topics/12-upload-with-the-material-mcp.md +41 -0
- package/skills/elice-content-migrate/SKILL.md +8 -7
- package/skills/elice-content-publish/SKILL.md +8 -7
- package/templates/_shared/lib/cdk-mock.d.ts +5 -13
- package/templates/_shared/lib/cdk-mock.js +49 -144
- package/templates/_shared/lib/elice-content.css +68 -1
- package/templates/_shared/lib/elice-content.d.ts +11 -38
- package/templates/_shared/lib/elice-content.js +43 -248
- package/templates/blank/README.md +12 -10
- package/templates/blank/metadata.json +9 -0
- package/templates/blank/package.json +13 -0
- package/templates/blank/screens/edit.js +1 -1
- package/templates/blank/screens/instructor.js +12 -5
- package/templates/blank/screens/learn.js +16 -11
- package/templates/blank/template.json +2 -2
- package/templates/quiz/README.md +15 -12
- package/templates/quiz/core/behaviors.js +4 -1
- package/templates/quiz/core/editor.d.ts +21 -10
- package/templates/quiz/core/editor.js +44 -31
- package/templates/quiz/core/model.d.ts +14 -0
- package/templates/quiz/core/model.js +76 -4
- package/templates/quiz/metadata.json +9 -0
- package/templates/quiz/package.json +13 -0
- package/templates/quiz/screens/edit.js +101 -34
- package/templates/quiz/screens/instructor.js +18 -12
- package/templates/quiz/screens/learn.js +45 -36
- package/templates/quiz/styles.css +65 -22
- package/templates/quiz/template.json +2 -2
- package/templates/quiz/ui/templates/edit.d.ts +1 -0
- package/templates/quiz/ui/templates/edit.js +65 -19
- package/templates/quiz/ui/templates/group.js +10 -2
- package/templates/quiz/ui/texts.js +11 -11
- package/es/commands/check/index.d.ts +0 -15
- package/es/commands/guide/index.d.ts +0 -29
- package/es/commands/guide/index.js +0 -120
- package/guides/content-development.md +0 -294
- package/templates/_shared/lib/cdk.js +0 -3
- package/templates/blank/completion.html +0 -15
- package/templates/blank/content.json +0 -4
- package/templates/blank/elice.config.json +0 -10
- package/templates/blank/screens/completion.js +0 -7
- package/templates/quiz/content.json +0 -35
- package/templates/quiz/elice.config.json +0 -9
- package/templates/quiz/grading.json +0 -4
|
@@ -5,18 +5,19 @@ description: Upload an Elice Custom HTML learning material to LXP with the elice
|
|
|
5
5
|
|
|
6
6
|
# Upload an Elice learning material
|
|
7
7
|
|
|
8
|
-
Read `
|
|
8
|
+
Read guide topics with the Read tool from the sibling `elice-content-guide` skill folder (same parent folder as this skill), e.g. `../elice-content-guide/topics/05-screen-code.md`; its `SKILL.md` lists every topic. If that folder is missing, ask the person to run `ecdk setup --only skills` (it installs all five skills together; when these skills are in a project's `.claude/skills/`, run `ecdk setup --only skills --project` in that project folder instead), then continue. Read `../elice-content-guide/topics/12-upload-with-the-material-mcp.md` first. It has the tool order, arguments and error handling.
|
|
9
9
|
|
|
10
10
|
{{always}}
|
|
11
11
|
|
|
12
12
|
## Steps
|
|
13
13
|
|
|
14
|
-
1. **MCP ready?** The `elice-material` tools must be available. If not, ask the person to run `ecdk setup` (QA: `ecdk
|
|
14
|
+
1. **MCP ready?** The `elice-material` tools must be available. If not, ask the person to run `ecdk setup --only mcp` (QA: `ecdk setup --only mcp --env qa5`) and log in (Claude Code `/mcp` → elice-material → Authenticate, Helpy Code `⌘ ;`), then stop.
|
|
15
15
|
2. **Build.** `ecdk build --json` must return `ok: true`. Keep `zip` and `zipBytes`.
|
|
16
|
-
3. **Pick the page.**
|
|
17
|
-
4. **Upload.** `get_material` (keep `current_version.id`) → `create_package_upload` with `size_bytes = zipBytes` → run its `curl_command` with `package.zip` replaced by the zip path → `submit_package` → poll `get_draft` until ready or failed. On failure, report the server's reason with `ecdk
|
|
18
|
-
5. **Approve.** Show what changes (page, title,
|
|
19
|
-
6. **Save.** `save_draft` with `expected_current_version_id
|
|
20
|
-
7. **
|
|
16
|
+
3. **Pick the page and confirm it.** Candidates: `.ecdk/link.json`, the LXP edit URL the person gives (`https://{org}.…/lecturepages/{id}/edit`), or the person's choice from `list_my_organizations` → `list_courses` → `list_lectures` → `list_custom_pages`. Never pick a page yourself (not the first in a list, not a guess by title, not a page from another project); if the answer is ambiguous, ask again. Before any upload call (`create_package_upload`, `submit_package`), show the full target, 기관 · 과목 · 수업 · 페이지 with names and ids, and its LXP edit URL, then wait for an explicit yes. Do this every time: also for `.ecdk/link.json` (and compare its `version_id` with `get_material`) and for a URL the person gave (confirm the names it resolves to). `.ecdk/link.json` and an edit URL give only the org's `name_short`: get the 기관 name from `list_my_organizations` and the 과목 · 수업 · 페이지 names from `get_material`. A new page (`create_custom_page`) needs its own yes that names the 수업 it goes into.
|
|
17
|
+
4. **Upload.** `get_material` (keep `current_version.id`) → `create_package_upload` with `size_bytes = zipBytes` → run its `curl_command` with `package.zip` replaced by the zip path → `submit_package` → poll `get_draft` until ready or failed. On failure, report the server's reason with `ecdk validate dist/content.zip` and stop.
|
|
18
|
+
5. **Approve.** Show what changes (page, title, and that the content and answers are entered on the LXP edit screen after saving) and the draft `preview_urls`. Saving is visible to learners at once if the page is open. Wait for an explicit yes.
|
|
19
|
+
6. **Save.** `save_draft` with `material_draft_id` and `expected_current_version_id`. Do not send `completion_policy`: 완료 정책은 LXP에 올린 뒤 설정 탭에서 교육자가 고른다 (after saving, tell the person to pick it there and which one fits). Do not send content or `grading` from `.ecdk/settings.json`: it is sample input for local checks only and is never uploaded. On `MATERIAL_CHANGED`, stop: someone saved in between. A quiz has no answers at its first upload: the person sets them on the edit screen before picking `on_graded`. If it returns `MATERIAL_GRADING_REQUIRED`, stop and tell the person.
|
|
20
|
+
7. **Content and answers.** Tell the person to open the LXP edit screen now, enter the content and answers (a quiz needs its answers right away to be graded), save with the edit screen's own button (the quiz template: "편집 완료"), then press 저장 at the bottom of the LXP edit page. The edit screen saves to the draft; learners see "아직 내용이 없습니다" until that 저장 makes a new version.
|
|
21
|
+
8. **Finish.** Set the title and icon with `update_material` if the page has none (`../elice-content-guide/topics/12-upload-with-the-material-mcp.md`). Write `.ecdk/link.json` as `{ "org": …, "lecture_page_id": …, "version_id": … }` so the next upload goes to the same page. Report 기관 · 과목 · 수업 · 페이지 (names and ids), the LXP URL, the saved version and whether the page is closed to learners (a new page stays closed until the person opens it in LXP).
|
|
21
22
|
|
|
22
23
|
{{version}}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// lib/cdk-mock.js 타입 (편집기 자동완성용)
|
|
2
2
|
export type Scope = 'learn' | 'edit';
|
|
3
3
|
export type Viewer = 'student' | 'instructor' | 'tutor';
|
|
4
|
-
export type Screen = 'learn' | 'instructor' | 'edit'
|
|
4
|
+
export type Screen = 'learn' | 'instructor' | 'edit';
|
|
5
|
+
/** 완료 정책 (LXP 설정 탭에서 교육자가 고름, ADR 0012). mock은 흉내 내지 않아 늘 null */
|
|
5
6
|
export type CompletionPolicy = 'on_access' | 'on_submit' | 'on_graded';
|
|
6
7
|
|
|
7
8
|
export declare const ErrorCode: Readonly<{
|
|
@@ -46,12 +47,8 @@ export interface Submission extends SubmitResult {
|
|
|
46
47
|
export declare function normalizeGradingSettings(
|
|
47
48
|
grading: unknown
|
|
48
49
|
): { type: 'pattern'; answer_key?: string } | { type: 'rubric'; rubric?: string } | null;
|
|
49
|
-
/**
|
|
50
|
-
export declare function gradeLocally(
|
|
51
|
-
grading: unknown,
|
|
52
|
-
answer: unknown,
|
|
53
|
-
policy?: 'on_access' | 'on_submit' | 'on_graded'
|
|
54
|
-
): SubmitResult;
|
|
50
|
+
/** 채점 설정이 있으면 로컬 채점, 없으면 제출만 받음 (점수 null) */
|
|
51
|
+
export declare function gradeLocally(grading: unknown, answer: unknown): SubmitResult;
|
|
55
52
|
|
|
56
53
|
export interface Navigation {
|
|
57
54
|
previous(): void;
|
|
@@ -66,8 +63,6 @@ export declare class MockEliceCDK {
|
|
|
66
63
|
onSessionExpired?: () => void;
|
|
67
64
|
scenario?: string;
|
|
68
65
|
grading?: unknown;
|
|
69
|
-
completionPolicy?: CompletionPolicy;
|
|
70
|
-
completionPolicies?: CompletionPolicy[];
|
|
71
66
|
settings?: Record<string, unknown>;
|
|
72
67
|
loadJson?: (url: string) => Promise<unknown>;
|
|
73
68
|
delayMs?: number;
|
|
@@ -91,8 +86,7 @@ export declare class MockEliceCDK {
|
|
|
91
86
|
description: unknown;
|
|
92
87
|
entries: Partial<Record<Screen, string>>;
|
|
93
88
|
settings: Record<string, unknown>;
|
|
94
|
-
completionPolicy: CompletionPolicy;
|
|
95
|
-
completionPolicies: CompletionPolicy[] | null;
|
|
89
|
+
completionPolicy: CompletionPolicy | null;
|
|
96
90
|
} | null;
|
|
97
91
|
readonly result: {
|
|
98
92
|
score: number | null;
|
|
@@ -105,8 +99,6 @@ export declare class MockEliceCDK {
|
|
|
105
99
|
history(options?: { offset?: number; limit?: number }): Promise<Submission[]>;
|
|
106
100
|
/** 저장하고 부모 창에 settings-saved로 알린다. 토큰 없는 draft(#edit=1)는 draft_not_saved로 거절 */
|
|
107
101
|
saveSettings(settings: Record<string, unknown>): Promise<void>;
|
|
108
|
-
/** 완료 정책 화면에서만. 이 브라우저에 남기고 settings-saved로 알린다. draft는 draft_not_saved, 채점 설정 없는 on_graded는 거절 */
|
|
109
|
-
saveCompletionPolicy(policy: CompletionPolicy): Promise<void>;
|
|
110
102
|
dispose(): void;
|
|
111
103
|
reset(): void;
|
|
112
104
|
}
|
|
@@ -2,22 +2,20 @@
|
|
|
2
2
|
* @eliceio/cdk 1.x(EliceCDK)와 같은 공개 인터페이스를 가진 mock · 템플릿이 제공 (고치지 마세요)
|
|
3
3
|
*
|
|
4
4
|
* 서버 없이 화면을 시험할 때 키트가 대신 씁니다. 실제 SDK와 다른 점:
|
|
5
|
-
* - 채점: 편집 화면이 저장한 채점 설정(settings.grading
|
|
6
|
-
*
|
|
7
|
-
* - 완료 정책:
|
|
8
|
-
* metadata completionPolicies(elice.config.json, 없으면 metadata.json · ecdk dev가 주는 값)이고, 처음 값은
|
|
9
|
-
* .ecdk/completion.json(그 안에 있을 때) · 없으면 첫 값(서버가 업로드 때 정하는 값). 바꾼 값은 이 브라우저에만
|
|
5
|
+
* - 채점: 편집 화면이 저장한 채점 설정(settings.grading { type: pattern | rubric })이 있으면 로컬 채점, 없으면 제출만 받음.
|
|
6
|
+
* pattern 답은 정규식 하나, 답 문자열 전체 일치. 프로젝트 폴더를 그대로 열면 ecdk dev가 저장한 .ecdk/settings.json으로 시작
|
|
7
|
+
* - 완료 정책: 흉내 내지 않는다 (LXP에 올린 뒤 설정 탭에서 교육자가 고름, ADR 0012). material.completionPolicy는 null
|
|
10
8
|
* - 저장: 설정 화면이 저장한 내용과 제출 기록을 브라우저에 남겨 다른 화면에서도 보임
|
|
11
9
|
* (sandbox라 저장소가 막히면 이 페이지 안에서만)
|
|
12
10
|
* - 보는 사람: 주소에 #viewer=student | instructor | tutor (mock 전용, 기본 student)
|
|
13
11
|
* #preview=1 · #edit=1은 실제 SDK처럼 토큰 없는 draft (viewer는 instructor, 편집 저장은 draft_not_saved)
|
|
14
|
-
* - 편집 화면: #scope=edit (mock 전용) =
|
|
12
|
+
* - 편집 화면: #scope=edit (mock 전용) = edit 토큰으로 연 편집 화면. saveSettings가 저장된다 (실제는 자료의 draft에,
|
|
13
|
+
* 학생에게는 LXP 편집 페이지의 저장 뒤. mock은 이 브라우저의 다른 화면에 바로 보임)
|
|
14
|
+
* 실제 SDK처럼 account · result는 null (edit 토큰은 /me를 부르지 않음)
|
|
15
15
|
* 편집 화면이 넣은 settings.grading은 학생 화면의 material.settings에서 서버처럼 빼고 준다
|
|
16
|
-
* - 완료 정책 화면: #scope=edit&screen=completionPolicy (mock 전용). saveCompletionPolicy가 저장된다.
|
|
17
|
-
* #completionPolicy=1은 토큰 없는 draft (저장은 draft_not_saved)
|
|
18
16
|
* - 수업 페이지 이동: 아무 데도 가지 않고, 이전·다음 페이지는 없음(false)
|
|
19
17
|
* - 시나리오: 주소에 ?mock=session_expired | rate_limited | request_failed | external_service_error
|
|
20
|
-
* | slow | content_not_ready | unauthorized |
|
|
18
|
+
* | slow | content_not_ready | unauthorized | draft_not_ready
|
|
21
19
|
*
|
|
22
20
|
* 실제 SDK: @eliceio/cdk 1.x (eliceio-cdk-v2 feat/PLAT-4973-monorepo) 기준
|
|
23
21
|
*/
|
|
@@ -54,12 +52,11 @@ const MAX_ANSWER_BYTES = 64 * 1024;
|
|
|
54
52
|
const STORE_PREFIX = 'elice-content-mock:';
|
|
55
53
|
const MESSAGE_SOURCE = 'eliceio-content-sdk';
|
|
56
54
|
const SETTINGS_SAVED_MESSAGE_TYPE = 'settings-saved';
|
|
57
|
-
/** 템플릿의 metadata.json 진입 파일
|
|
55
|
+
/** 템플릿의 metadata.json 진입 파일 */
|
|
58
56
|
const DEFAULT_ENTRIES = Object.freeze({
|
|
59
57
|
learn: 'index.html',
|
|
60
58
|
instructor: 'instructor.html',
|
|
61
59
|
edit: 'edit.html',
|
|
62
|
-
completionPolicy: 'completion.html',
|
|
63
60
|
});
|
|
64
61
|
/** rubric(AI) 채점 흉내 점수 */
|
|
65
62
|
const RUBRIC_MOCK_SCORE = 80;
|
|
@@ -99,7 +96,6 @@ function parseHash(hash) {
|
|
|
99
96
|
token: params.get('token'),
|
|
100
97
|
preview: params.get('preview'),
|
|
101
98
|
edit: params.get('edit'),
|
|
102
|
-
completionPolicy: params.get('completionPolicy'),
|
|
103
99
|
viewer: params.get('viewer'),
|
|
104
100
|
scope: params.get('scope'),
|
|
105
101
|
screen: params.get('screen'),
|
|
@@ -110,9 +106,6 @@ function parseHash(hash) {
|
|
|
110
106
|
const answerText = answer =>
|
|
111
107
|
typeof answer === 'string' ? answer.trim() : JSON.stringify(answer ?? null);
|
|
112
108
|
|
|
113
|
-
/** 완료 정책 값 (서버 material_version.completion_policy) */
|
|
114
|
-
const POLICIES = Object.freeze(['on_access', 'on_submit', 'on_graded']);
|
|
115
|
-
|
|
116
109
|
/**
|
|
117
110
|
* 채점 설정을 서버 모양(2026-11-11 결정)으로: `{ type: 'pattern', answer_key }` · `{ type: 'rubric', rubric }`.
|
|
118
111
|
* camelCase(answerKey)도 받는다. 채점 방식이 아니면 null
|
|
@@ -129,20 +122,16 @@ export function normalizeGradingSettings(grading) {
|
|
|
129
122
|
}
|
|
130
123
|
|
|
131
124
|
/**
|
|
132
|
-
* elice-material 채점 흉내 (
|
|
133
|
-
*
|
|
134
|
-
* -
|
|
135
|
-
* -
|
|
136
|
-
* -
|
|
125
|
+
* elice-material 채점 흉내 (채점 방식 → 점수). 실제 서버처럼 요청 안에서 바로 채점한 `{ isCorrect, score }`만
|
|
126
|
+
* 돌려준다. 완료 정책은 LXP 설정이라 보지 않는다 (ADR 0012): 채점 설정이 있으면 채점하고, 없으면 제출만 받는다.
|
|
127
|
+
* - pattern: 정답 정규식(문자열 하나)이 답 문자열 전체와 맞으면 100, 아니면 0
|
|
128
|
+
* - rubric: 바로 80점으로 흉내, 통과로 봄 (통과 기준 pass_threshold는 정해지지 않음, G136)
|
|
129
|
+
* - 채점 설정 없음: 점수 없음 `{ isCorrect: null, score: null }`
|
|
137
130
|
* @param {object | null} grading settings.grading
|
|
138
131
|
* @param {unknown} answer
|
|
139
|
-
* @param {string} [policy] 완료 정책. 없으면 채점 설정이 있으면 on_graded, 없으면 on_submit
|
|
140
132
|
*/
|
|
141
|
-
export function gradeLocally(grading, answer
|
|
133
|
+
export function gradeLocally(grading, answer) {
|
|
142
134
|
const g = normalizeGradingSettings(grading);
|
|
143
|
-
const p = policy ?? (g ? 'on_graded' : 'on_submit');
|
|
144
|
-
if (p === 'on_submit') return { isCorrect: true, score: 100 };
|
|
145
|
-
if (p !== 'on_graded') return { isCorrect: null, score: null };
|
|
146
135
|
if (g?.type === 'pattern') {
|
|
147
136
|
let ok = false;
|
|
148
137
|
try {
|
|
@@ -164,9 +153,7 @@ const sleep = ms => new Promise(r => setTimeout(r, ms));
|
|
|
164
153
|
* @typedef {object} MockOptions
|
|
165
154
|
* @property {() => void} [onSessionExpired]
|
|
166
155
|
* @property {string} [scenario] ?mock= 대신 직접 지정
|
|
167
|
-
* @property {object} [grading]
|
|
168
|
-
* @property {'on_access' | 'on_submit' | 'on_graded'} [completionPolicy] 로컬 완료 정책 대신 직접 지정
|
|
169
|
-
* @property {Array<'on_access' | 'on_submit' | 'on_graded'>} [completionPolicies] metadata completionPolicies 대신 직접 지정
|
|
156
|
+
* @property {object} [grading] 채점 설정 직접 지정 (settings.grading 모양, 테스트용)
|
|
170
157
|
* @property {Record<string, unknown>} [settings] 처음 저장된 내용
|
|
171
158
|
* @property {(url: string) => Promise<unknown>} [loadJson] 테스트용
|
|
172
159
|
* @property {number} [delayMs] 응답 지연 (scenario=slow면 1500)
|
|
@@ -183,9 +170,6 @@ export class MockEliceCDK {
|
|
|
183
170
|
#screen = null;
|
|
184
171
|
#entries = DEFAULT_ENTRIES;
|
|
185
172
|
#grading = null;
|
|
186
|
-
#policy = null;
|
|
187
|
-
/** metadata completionPolicies (없으면 null) */
|
|
188
|
-
#policies = null;
|
|
189
173
|
#account = null;
|
|
190
174
|
#metadata = null;
|
|
191
175
|
#isDraft = false;
|
|
@@ -261,12 +245,12 @@ export class MockEliceCDK {
|
|
|
261
245
|
description: { type: 'text', text: '' },
|
|
262
246
|
entries: this.#entries,
|
|
263
247
|
settings: this.#scope === 'edit' && effective ? { ...rest, grading: effective } : rest,
|
|
264
|
-
|
|
265
|
-
|
|
248
|
+
// 완료 정책은 LXP 설정 (로컬에는 없음)
|
|
249
|
+
completionPolicy: null,
|
|
266
250
|
};
|
|
267
251
|
}
|
|
268
252
|
get result() {
|
|
269
|
-
if (!this.initialized || this.#isDraft) return null;
|
|
253
|
+
if (!this.initialized || this.#isDraft || this.#scope === 'edit') return null;
|
|
270
254
|
return this.#store.get('result', null);
|
|
271
255
|
}
|
|
272
256
|
/** mock 전용: 저장소가 브라우저에 남는지 (sandbox면 false) */
|
|
@@ -286,15 +270,9 @@ export class MockEliceCDK {
|
|
|
286
270
|
if (this.#scenario === 'unauthorized')
|
|
287
271
|
throw new EliceCDKError(ErrorCode.Unauthorized, 'Invalid token (mock).');
|
|
288
272
|
|
|
289
|
-
const isDraft =
|
|
290
|
-
params.token == null &&
|
|
291
|
-
(params.preview === '1' || params.edit === '1' || params.completionPolicy === '1');
|
|
273
|
+
const isDraft = params.token == null && (params.preview === '1' || params.edit === '1');
|
|
292
274
|
// 실제 SDK: draft는 instructor가 본다. 토큰이 있는 경우를 흉내 낼 때만 #viewer=로 고른다
|
|
293
|
-
const editScope =
|
|
294
|
-
params.edit === '1' || params.completionPolicy === '1' || params.scope === 'edit';
|
|
295
|
-
const completionScreen =
|
|
296
|
-
params.completionPolicy === '1' ||
|
|
297
|
-
(params.scope === 'edit' && params.screen === 'completionPolicy');
|
|
275
|
+
const editScope = params.edit === '1' || params.scope === 'edit';
|
|
298
276
|
const viewer = isDraft || editScope ? 'instructor' : (params.viewer ?? 'student');
|
|
299
277
|
if (!VIEWERS.includes(viewer))
|
|
300
278
|
throw new EliceCDKError(ErrorCode.InvalidParam, `Unknown viewer: ${viewer}`);
|
|
@@ -302,18 +280,9 @@ export class MockEliceCDK {
|
|
|
302
280
|
if (this.#options.settings && Object.keys(this.#store.get('settings', {})).length === 0)
|
|
303
281
|
this.#store.set('settings', this.#options.settings);
|
|
304
282
|
const local = await this.#loadLocal();
|
|
283
|
+
if (local.settings && Object.keys(this.#store.get('settings', {})).length === 0)
|
|
284
|
+
this.#store.set('settings', local.settings);
|
|
305
285
|
this.#grading = normalizeGradingSettings(this.#options.grading) ?? local.grading;
|
|
306
|
-
const policies = this.#options.completionPolicies ?? local.policies;
|
|
307
|
-
this.#policies = policies;
|
|
308
|
-
// 이 브라우저에 저장한 값은 지원하는 정책 안에 있을 때만. null이면 채점 설정이 있으면 on_graded,
|
|
309
|
-
// 없으면 on_submit (#effectivePolicy)
|
|
310
|
-
const stored = this.#store.get('completionPolicy', null);
|
|
311
|
-
this.#policy =
|
|
312
|
-
this.#options.completionPolicy ??
|
|
313
|
-
(POLICIES.includes(stored) && (!policies || policies.includes(stored)) ? stored : null) ??
|
|
314
|
-
local.policy ??
|
|
315
|
-
policies?.[0] ??
|
|
316
|
-
null;
|
|
317
286
|
this.#entries = DEFAULT_ENTRIES;
|
|
318
287
|
|
|
319
288
|
this.#isDraft = isDraft;
|
|
@@ -325,16 +294,18 @@ export class MockEliceCDK {
|
|
|
325
294
|
// draft는 fragment가 화면을 알려 준다 (#edit=1이면 edit, 아니면 learn)
|
|
326
295
|
this.#screen =
|
|
327
296
|
this.#scope === 'edit'
|
|
328
|
-
?
|
|
329
|
-
? 'completionPolicy'
|
|
330
|
-
: 'edit'
|
|
297
|
+
? 'edit'
|
|
331
298
|
: !isDraft && viewer === 'instructor' && this.#entries.instructor
|
|
332
299
|
? 'instructor'
|
|
333
300
|
: 'learn';
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
301
|
+
// Like the real SDK: an edit token does not call /me, so there is no account.
|
|
302
|
+
this.#account =
|
|
303
|
+
editScope && !isDraft
|
|
304
|
+
? null
|
|
305
|
+
: {
|
|
306
|
+
anonymousId: isDraft ? 'preview' : 'mock-student',
|
|
307
|
+
fullname: viewer === 'tutor' ? '김하늘 (mock)' : null,
|
|
308
|
+
};
|
|
338
309
|
this.#metadata = {
|
|
339
310
|
materialId: '00000000-0000-0000-0000-000000000000',
|
|
340
311
|
lecturePageId: null,
|
|
@@ -342,18 +313,6 @@ export class MockEliceCDK {
|
|
|
342
313
|
};
|
|
343
314
|
|
|
344
315
|
this.initialized = true;
|
|
345
|
-
// "들어오면 완료": 학생이 처음 열면 서버가 100점으로 기록한다
|
|
346
|
-
if (
|
|
347
|
-
this.#effectivePolicy() === 'on_access' &&
|
|
348
|
-
viewer === 'student' &&
|
|
349
|
-
!isDraft &&
|
|
350
|
-
this.#store.get('result', null) === null
|
|
351
|
-
)
|
|
352
|
-
this.#store.set('result', {
|
|
353
|
-
score: 100,
|
|
354
|
-
submitCount: 0,
|
|
355
|
-
completedAt: new Date().toISOString(),
|
|
356
|
-
});
|
|
357
316
|
if (this.#scenario === 'session_expired') {
|
|
358
317
|
setTimeout(
|
|
359
318
|
() => {
|
|
@@ -385,7 +344,7 @@ export class MockEliceCDK {
|
|
|
385
344
|
throw new EliceCDKError(ErrorCode.InvalidInput, 'Answer is over 64KB.');
|
|
386
345
|
await this.#delay();
|
|
387
346
|
|
|
388
|
-
const res = gradeLocally(this.#effectiveGrading(), answer
|
|
347
|
+
const res = gradeLocally(this.#effectiveGrading(), answer);
|
|
389
348
|
if (this.#isDraft) this.#draftSubmissions.unshift(this.#submission(answer, res, 'preview'));
|
|
390
349
|
else if (this.#viewer === 'student') this.#record(res, answer);
|
|
391
350
|
return res;
|
|
@@ -399,46 +358,11 @@ export class MockEliceCDK {
|
|
|
399
358
|
return submissions.slice(offset, offset + limit);
|
|
400
359
|
}
|
|
401
360
|
|
|
402
|
-
/**
|
|
403
|
-
* 완료 정책 화면(screen completionPolicy)에서만. 실제 SDK처럼 지금 버전의 완료 정책을 바꾸고(mock은 이 브라우저에만)
|
|
404
|
-
* 결과를 편집 페이지에 `settings-saved`로 알린다. 토큰 없는 draft(#completionPolicy=1)는 draft_not_saved,
|
|
405
|
-
* 채점 설정 없는 on_graded는 서버처럼 MATERIAL_GRADING_REQUIRED(request_failed의 cause)로 거절
|
|
406
|
-
* @param {'on_access' | 'on_submit' | 'on_graded'} policy
|
|
407
|
-
*/
|
|
408
|
-
async saveCompletionPolicy(policy) {
|
|
409
|
-
this.#assertReady();
|
|
410
|
-
this.#assertScreen('completionPolicy');
|
|
411
|
-
await this.#delay();
|
|
412
|
-
try {
|
|
413
|
-
if (this.#isDraft)
|
|
414
|
-
throw new EliceCDKError(
|
|
415
|
-
ErrorCode.DraftNotSaved,
|
|
416
|
-
'The completion policy of an unsaved upload cannot be saved (mock).'
|
|
417
|
-
);
|
|
418
|
-
if (!POLICIES.includes(policy))
|
|
419
|
-
throw new EliceCDKError(ErrorCode.InvalidInput, `Unknown completion policy: ${policy}`);
|
|
420
|
-
if (policy === 'on_graded' && !this.#effectiveGrading())
|
|
421
|
-
throw new EliceCDKError(ErrorCode.RequestFailed, 'Grading is required (mock).', {
|
|
422
|
-
cause: { code: 'MATERIAL_GRADING_REQUIRED' },
|
|
423
|
-
});
|
|
424
|
-
if (this.#scenario === 'material_changed')
|
|
425
|
-
throw new EliceCDKError(ErrorCode.RequestFailed, 'Material changed (mock).', {
|
|
426
|
-
cause: { code: 'MATERIAL_CHANGED' },
|
|
427
|
-
});
|
|
428
|
-
this.#policy = policy;
|
|
429
|
-
this.#store.set('completionPolicy', policy);
|
|
430
|
-
this.#postSettingsSaved({ status: 'saved' });
|
|
431
|
-
} catch (err) {
|
|
432
|
-
const code = err.cause?.cause?.code ?? err.code;
|
|
433
|
-
this.#postSettingsSaved({ status: 'failed', code });
|
|
434
|
-
throw err;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
361
|
/**
|
|
439
362
|
* 편집 화면(screen edit)에서만. 실제 SDK처럼 저장하고(mock은 브라우저에 남겨 다른 화면의 `material.settings`로 보임)
|
|
440
363
|
* 결과를 편집 페이지(부모 창)에 `settings-saved`로 알린다. 토큰 없는 draft(#edit=1)는 `draft_not_saved`로 거절.
|
|
441
|
-
* 시나리오 ?mock=
|
|
364
|
+
* 시나리오 ?mock=draft_not_ready면 업로드한 draft를 아직 처리 중인 것처럼 실패한다 (실제 SDK: content_not_ready, 서버 코드
|
|
365
|
+
* MATERIAL_DRAFT_NOT_READY는 cause)
|
|
442
366
|
*/
|
|
443
367
|
async saveSettings(settings) {
|
|
444
368
|
this.#assertReady();
|
|
@@ -450,9 +374,9 @@ export class MockEliceCDK {
|
|
|
450
374
|
ErrorCode.DraftNotSaved,
|
|
451
375
|
'Settings of an unsaved upload cannot be saved (mock).'
|
|
452
376
|
);
|
|
453
|
-
if (this.#scenario === '
|
|
454
|
-
throw new EliceCDKError(ErrorCode.
|
|
455
|
-
cause: { code: '
|
|
377
|
+
if (this.#scenario === 'draft_not_ready')
|
|
378
|
+
throw new EliceCDKError(ErrorCode.ContentNotReady, 'Draft is still processing (mock).', {
|
|
379
|
+
cause: { code: 'MATERIAL_DRAFT_NOT_READY' },
|
|
456
380
|
});
|
|
457
381
|
if (this.#scenario === 'request_failed')
|
|
458
382
|
throw new EliceCDKError(ErrorCode.RequestFailed, 'Network error (mock).');
|
|
@@ -489,20 +413,14 @@ export class MockEliceCDK {
|
|
|
489
413
|
this.#store.set('settings', {});
|
|
490
414
|
this.#store.set('submissions', []);
|
|
491
415
|
this.#store.set('result', null);
|
|
492
|
-
this.#store.set('completionPolicy', null);
|
|
493
416
|
this.#draftSubmissions = [];
|
|
494
417
|
}
|
|
495
418
|
|
|
496
|
-
/** 저장된 채점 설정(편집 화면), 없으면
|
|
419
|
+
/** 저장된 채점 설정(편집 화면), 없으면 ecdk dev가 주는 값 · options.grading */
|
|
497
420
|
#effectiveGrading() {
|
|
498
421
|
return normalizeGradingSettings(this.#store.get('settings', {}).grading) ?? this.#grading;
|
|
499
422
|
}
|
|
500
423
|
|
|
501
|
-
/** 정해진 완료 정책, 없으면 채점 설정이 있으면 on_graded · 없으면 on_submit */
|
|
502
|
-
#effectivePolicy() {
|
|
503
|
-
return this.#policy ?? (this.#effectiveGrading() ? 'on_graded' : 'on_submit');
|
|
504
|
-
}
|
|
505
|
-
|
|
506
424
|
#assertReady() {
|
|
507
425
|
if (!this.initialized) throw new EliceCDKError(ErrorCode.NotInitialized, 'Call init() first.');
|
|
508
426
|
if (this.#isSessionExpired)
|
|
@@ -536,8 +454,9 @@ export class MockEliceCDK {
|
|
|
536
454
|
this.#store.set('submissions', submissions);
|
|
537
455
|
const prev = this.#store.get('result', null);
|
|
538
456
|
const score = res.score ?? prev?.score ?? null;
|
|
539
|
-
//
|
|
540
|
-
|
|
457
|
+
// 기록의 완료 시각: 채점 설정이 있으면 통과(pattern 100점 · rubric 흉내 점수)해야, 없으면 제출만으로
|
|
458
|
+
// (운영에서 완료 여부는 LXP 설정 탭의 완료 정책이 정한다)
|
|
459
|
+
const completed = res.isCorrect === true || !this.#effectiveGrading();
|
|
541
460
|
this.#store.set('result', {
|
|
542
461
|
score,
|
|
543
462
|
submitCount: (prev?.submitCount ?? 0) + 1,
|
|
@@ -546,38 +465,24 @@ export class MockEliceCDK {
|
|
|
546
465
|
}
|
|
547
466
|
|
|
548
467
|
/**
|
|
549
|
-
* 로컬 채점
|
|
550
|
-
*
|
|
551
|
-
*
|
|
552
|
-
* @returns {Promise<{ grading: object | null, policy: string | null, policies: string[] | null }>}
|
|
468
|
+
* 로컬 채점 설정. ecdk dev의 콘텐츠 주소를 직접 열면 dev가 주는 값을, 프로젝트 폴더를 그대로 열면
|
|
469
|
+
* .ecdk/settings.json(ecdk dev 편집 화면이 저장한 내용 + 답)을 읽는다 (.ecdk는 zip에서 빠짐, 로컬 채점용으로 일부러 읽음)
|
|
470
|
+
* @returns {Promise<{ grading: object | null, settings?: object | null }>}
|
|
553
471
|
*/
|
|
554
472
|
async #loadLocal() {
|
|
555
473
|
const loadJson =
|
|
556
474
|
this.#options.loadJson ?? (url => fetch(url).then(r => (r.ok ? r.json() : null)));
|
|
557
|
-
const listOf = v => (Array.isArray(v) && v.length > 0 && v.every(p => POLICIES.includes(p)) ? v : null);
|
|
558
475
|
const devGrading = globalThis.__ECDK_DEV__?.grading;
|
|
559
476
|
if (typeof devGrading === 'string') {
|
|
560
477
|
const dev = await loadJson(devGrading).catch(() => null);
|
|
561
|
-
return {
|
|
562
|
-
grading: normalizeGradingSettings(dev?.grading),
|
|
563
|
-
policy: POLICIES.includes(dev?.completion_policy) ? dev.completion_policy : null,
|
|
564
|
-
policies: listOf(dev?.completion_policies),
|
|
565
|
-
};
|
|
478
|
+
return { grading: normalizeGradingSettings(dev?.grading) };
|
|
566
479
|
}
|
|
567
|
-
if (this.#options.grading) return { grading: null
|
|
480
|
+
if (this.#options.grading) return { grading: null };
|
|
568
481
|
// ecdk-ignore-next-line project.answer-import
|
|
569
|
-
const
|
|
570
|
-
const local = await loadJson('.ecdk/completion.json').catch(() => null);
|
|
571
|
-
const manifest =
|
|
572
|
-
// ecdk-ignore-next-line project.answer-import
|
|
573
|
-
(await loadJson('elice.config.json').catch(() => null)) ??
|
|
574
|
-
(await loadJson('metadata.json').catch(() => null));
|
|
575
|
-
const policies = listOf(manifest?.completionPolicies);
|
|
576
|
-
const saved = local?.completion_policy;
|
|
482
|
+
const saved = await loadJson('.ecdk/settings.json').catch(() => null);
|
|
577
483
|
return {
|
|
578
|
-
grading:
|
|
579
|
-
|
|
580
|
-
policies,
|
|
484
|
+
grading: null,
|
|
485
|
+
settings: saved && typeof saved === 'object' && !Array.isArray(saved) ? saved : null,
|
|
581
486
|
};
|
|
582
487
|
}
|
|
583
488
|
|
|
@@ -63,6 +63,14 @@ p {
|
|
|
63
63
|
color: var(--ec-muted);
|
|
64
64
|
font-size: var(--eds-fs-body2);
|
|
65
65
|
}
|
|
66
|
+
/* 편집 화면이 아직 내용을 저장하지 않았을 때 (app.emptyState) */
|
|
67
|
+
.ec-empty {
|
|
68
|
+
color: var(--ec-muted);
|
|
69
|
+
border: 1px dashed var(--ec-border);
|
|
70
|
+
border-radius: var(--ec-radius);
|
|
71
|
+
padding: 32px 16px;
|
|
72
|
+
text-align: center;
|
|
73
|
+
}
|
|
66
74
|
.ec-card {
|
|
67
75
|
border: 1px solid var(--ec-border);
|
|
68
76
|
border-radius: var(--ec-radius);
|
|
@@ -257,7 +265,7 @@ button:disabled {
|
|
|
257
265
|
max-width: 720px;
|
|
258
266
|
margin-inline: auto;
|
|
259
267
|
}
|
|
260
|
-
/*
|
|
268
|
+
/* 편집 화면 채점 방식 블록 (useGradingBlock): LXP 편집 › 설정 탭과 같은 모양.
|
|
261
269
|
제목 h6 · 설명 body2 secondary, 방식마다 EDS 라디오 카드(테두리 1px, 고르면 primary 테두리 · primary-opacity02 바탕) */
|
|
262
270
|
.ec-grading {
|
|
263
271
|
display: flex;
|
|
@@ -343,6 +351,65 @@ button:disabled {
|
|
|
343
351
|
outline: 2px solid var(--ec-accent);
|
|
344
352
|
outline-offset: -1px;
|
|
345
353
|
}
|
|
354
|
+
/* 아이콘 버튼 (EDS IconButton, 테두리 없음): 목록 · 카드의 ↑ · ↓ · 삭제처럼 반복되는 동작.
|
|
355
|
+
누르는 영역 40px, 아이콘(svg 18~22px, stroke="currentColor")은 가운데. aria-label을 꼭 붙인다 */
|
|
356
|
+
button.ec-icon-button {
|
|
357
|
+
display: inline-flex;
|
|
358
|
+
align-items: center;
|
|
359
|
+
justify-content: center;
|
|
360
|
+
flex: none;
|
|
361
|
+
width: 40px;
|
|
362
|
+
min-height: 40px;
|
|
363
|
+
padding: 0;
|
|
364
|
+
border: 0;
|
|
365
|
+
background: none;
|
|
366
|
+
color: var(--eds-text-secondary);
|
|
367
|
+
}
|
|
368
|
+
button.ec-icon-button svg {
|
|
369
|
+
display: block;
|
|
370
|
+
}
|
|
371
|
+
button.ec-icon-button:hover {
|
|
372
|
+
background: var(--eds-action-hover);
|
|
373
|
+
}
|
|
374
|
+
/* 목록 안 항목 하나 빼기(보기 · 그룹 삭제): 빨간 원 안의 − . 묶음 전체 삭제(문항 카드)는 휴지통 + 기본 색 */
|
|
375
|
+
button.ec-icon-button.ec-danger {
|
|
376
|
+
color: var(--ec-no);
|
|
377
|
+
border-radius: 50%;
|
|
378
|
+
}
|
|
379
|
+
button.ec-icon-button.ec-danger:hover {
|
|
380
|
+
background: var(--ec-no-bg);
|
|
381
|
+
}
|
|
382
|
+
button.ec-icon-button:disabled {
|
|
383
|
+
background: none;
|
|
384
|
+
color: var(--eds-text-disabled);
|
|
385
|
+
}
|
|
386
|
+
/* 비어 있는 놓기 칸 (끌어 놓기 대상이 비었을 때): 파일 올리기 칸처럼 점선 상자 + 아이콘 + 굵은 안내 + 보조 안내 */
|
|
387
|
+
.ec-dropzone {
|
|
388
|
+
flex: 1;
|
|
389
|
+
display: flex;
|
|
390
|
+
flex-direction: column;
|
|
391
|
+
align-items: center;
|
|
392
|
+
justify-content: center;
|
|
393
|
+
gap: 4px;
|
|
394
|
+
min-height: 96px;
|
|
395
|
+
padding: 12px;
|
|
396
|
+
border: 1px dashed var(--ec-border);
|
|
397
|
+
border-radius: 12px;
|
|
398
|
+
background: var(--ec-surface);
|
|
399
|
+
color: var(--eds-text-tertiary);
|
|
400
|
+
font-size: var(--eds-fs-caption);
|
|
401
|
+
text-align: center;
|
|
402
|
+
/* 한국어는 어절 단위로 줄바꿈 */
|
|
403
|
+
word-break: keep-all;
|
|
404
|
+
}
|
|
405
|
+
.ec-dropzone p {
|
|
406
|
+
margin: 0;
|
|
407
|
+
}
|
|
408
|
+
.ec-dropzone-title {
|
|
409
|
+
color: var(--ec-muted);
|
|
410
|
+
font-size: var(--eds-fs-body2);
|
|
411
|
+
font-weight: var(--eds-fw-semibold);
|
|
412
|
+
}
|
|
346
413
|
/* EDS Button text small */
|
|
347
414
|
button.ec-text-button {
|
|
348
415
|
min-height: 32px;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// 편집기 자동완성용 타입. lib/elice-content.js와 같이 고치지 않습니다.
|
|
2
2
|
|
|
3
|
-
export type Screen = 'learn' | 'instructor' | 'edit'
|
|
3
|
+
export type Screen = 'learn' | 'instructor' | 'edit';
|
|
4
4
|
export type Scope = 'learn' | 'edit';
|
|
5
5
|
export type Viewer = 'student' | 'instructor' | 'tutor';
|
|
6
6
|
|
|
@@ -61,8 +61,6 @@ export interface SaveOptions<C> {
|
|
|
61
61
|
label?: string;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
/** 완료 정책 (서버 material_version.completion_policy). 지원하는 정책은 metadata completionPolicies */
|
|
65
|
-
export type CompletionPolicy = 'on_access' | 'on_submit' | 'on_graded';
|
|
66
64
|
/** 채점 방식 (settings.grading.type) */
|
|
67
65
|
export type GraderType = 'pattern' | 'rubric';
|
|
68
66
|
|
|
@@ -74,16 +72,6 @@ export type Grading =
|
|
|
74
72
|
/** @deprecated Grading을 쓴다 */
|
|
75
73
|
export type GradingPart = Grading;
|
|
76
74
|
|
|
77
|
-
/** 완료 정책 읽기 · 바꾸기 (SDK material.completionPolicy · saveCompletionPolicy) */
|
|
78
|
-
export interface CompletionApi {
|
|
79
|
-
/** metadata completionPolicies (서버가 돌려주지 않으면 null, G132) */
|
|
80
|
-
readonly policies: CompletionPolicy[] | null;
|
|
81
|
-
/** 값 이름은 서버 material_version.completion_policy와 같다 */
|
|
82
|
-
get(): Promise<{ completion_policy: CompletionPolicy | null; policies: CompletionPolicy[] | null }>;
|
|
83
|
-
/** 완료 정책 화면에서만. policies 밖의 값 · 채점 설정 없는 on_graded는 거절 */
|
|
84
|
-
set(policy: CompletionPolicy): Promise<void>;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
75
|
export interface GradingBlockOptions {
|
|
88
76
|
/** 고를 수 있는 채점 방식 (기본 둘 다) */
|
|
89
77
|
graders?: GraderType[];
|
|
@@ -93,18 +81,6 @@ export interface GradingBlockOptions {
|
|
|
93
81
|
root?: Element;
|
|
94
82
|
}
|
|
95
83
|
|
|
96
|
-
export interface CompletionOptions {
|
|
97
|
-
/** 고를 수 있는 완료 정책 (기본 metadata completionPolicies, 서버가 주지 않으면 셋 다) */
|
|
98
|
-
policies?: CompletionPolicy[];
|
|
99
|
-
/** 넣을 곳. 없으면 화면 영역(#app)을 완료 정책 영역으로 채운다 ("불러오는 중"을 지움) */
|
|
100
|
-
root?: Element;
|
|
101
|
-
label?: string;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
/** 완료 정책 문구 (열람 · 제출은 LXP 설정 탭 문구 그대로) */
|
|
105
|
-
export declare const COMPLETION_POLICIES: Readonly<
|
|
106
|
-
Record<CompletionPolicy, { label: string; description: string }>
|
|
107
|
-
>;
|
|
108
84
|
/** 채점 방식 문구 (LXP 설정 탭 문구 그대로) */
|
|
109
85
|
export declare const GRADER_TYPES: Readonly<Record<GraderType, { label: string; description: string }>>;
|
|
110
86
|
/** '작성 예시 보기' 기본 예시 [정규식, 뜻] */
|
|
@@ -138,6 +114,7 @@ export interface ContentApp<C = Record<string, unknown>> {
|
|
|
138
114
|
scope: Scope;
|
|
139
115
|
viewer: Viewer;
|
|
140
116
|
readOnly: boolean;
|
|
117
|
+
/** 편집기의 draft 미리보기(#preview=1) · 저장 전 업로드의 편집 화면(#edit=1). 제출을 기록하지 않음 */
|
|
141
118
|
isDraft: boolean;
|
|
142
119
|
navigation: Navigation | null;
|
|
143
120
|
isLocal: boolean;
|
|
@@ -145,7 +122,12 @@ export interface ContentApp<C = Record<string, unknown>> {
|
|
|
145
122
|
account: { anonymousId: string; fullname: string | null } | null;
|
|
146
123
|
result: { score: number | null; submitCount: number; completedAt: string | null } | null;
|
|
147
124
|
readonly records: boolean;
|
|
125
|
+
/** 편집 화면이 저장한 내용 (settings에서 grading을 뺀 것). 아직 저장하지 않았으면 {} */
|
|
148
126
|
readonly content: C;
|
|
127
|
+
/** 편집 화면이 내용을 저장했는지. false면 학생 · 교육자 화면은 emptyState()를 보여 준다 */
|
|
128
|
+
readonly hasContent: boolean;
|
|
129
|
+
/** "아직 내용이 없습니다 …" 안내 요소 (학생 · 교육자 화면에서 hasContent가 false일 때) */
|
|
130
|
+
emptyState(): Element;
|
|
149
131
|
/** 저장된 채점 설정. edit 범위(편집 · 완료 정책 화면)에서만, 없으면 null */
|
|
150
132
|
readonly grading: Grading | null;
|
|
151
133
|
submit(answer: unknown): Promise<SubmitResult>;
|
|
@@ -153,10 +135,11 @@ export interface ContentApp<C = Record<string, unknown>> {
|
|
|
153
135
|
lastSubmission(): Promise<
|
|
154
136
|
(SubmitResult & { id: string; answer: unknown; createdAt: string }) | null
|
|
155
137
|
>;
|
|
156
|
-
/**
|
|
138
|
+
/**
|
|
139
|
+
* 내용 저장 (편집 화면). 자료의 draft에 저장하고, 학생에게는 LXP 편집 페이지에서 저장(새 버전)한 뒤 보인다.
|
|
140
|
+
* grading을 주면 settings.grading으로 같이 저장, 없으면 저장된 채점 설정 그대로
|
|
141
|
+
*/
|
|
157
142
|
saveContent(content: C, grading?: Grading): Promise<void>;
|
|
158
|
-
/** 완료 정책 (SDK material.completionPolicy · saveCompletionPolicy) */
|
|
159
|
-
readonly completion: CompletionApi;
|
|
160
143
|
/** 학생 화면 제출 영역 (보는 사람별 처리는 키트가) */
|
|
161
144
|
useSubmit<A = unknown>(
|
|
162
145
|
options: SubmitOptions<A>
|
|
@@ -184,20 +167,10 @@ export interface ContentApp<C = Record<string, unknown>> {
|
|
|
184
167
|
readonly grader: GraderType;
|
|
185
168
|
getGrading(): Grading | string;
|
|
186
169
|
};
|
|
187
|
-
/** 완료 정책 화면 (LXP 설정 탭의 완료 정책 영역) */
|
|
188
|
-
useCompletion(options?: CompletionOptions): {
|
|
189
|
-
element: Element;
|
|
190
|
-
/** 지금 완료 정책을 불러온 뒤 끝남 */
|
|
191
|
-
ready: Promise<void>;
|
|
192
|
-
readonly policy: CompletionPolicy;
|
|
193
|
-
markDirty(): void;
|
|
194
|
-
readonly dirty: boolean;
|
|
195
|
-
};
|
|
196
170
|
}
|
|
197
171
|
|
|
198
172
|
export interface StartOptions {
|
|
199
173
|
screen: Screen;
|
|
200
|
-
defaults?: string;
|
|
201
174
|
onError?: (error: ContentError) => void;
|
|
202
175
|
sdk?: 'real' | 'mock' | object;
|
|
203
176
|
mock?: {
|