@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
|
@@ -20,27 +20,30 @@ Read or watch / change values and observe (simulation, visualization) / follow s
|
|
|
20
20
|
| Something to read or watch, such as a simulation | `on_access` (done on open) | - | No submission |
|
|
21
21
|
| Done when the activity ends (results, self-check, survey) | `on_submit` (done on submit) | - | Submit the result with `useSubmit` |
|
|
22
22
|
| One correct answer or one set of answers | `on_graded` (done when it passes) | `pattern` (one regex) | `useSubmit` |
|
|
23
|
+
| Several questions with a score per question (partial score) | `on_graded` | `partial_pattern` | `useSubmit` with a string array |
|
|
23
24
|
| Writing or assignments graded against a rubric (AI grading) | `on_graded` | `rubric` (the criteria) | `useSubmit`, the score comes back at once |
|
|
24
25
|
|
|
25
26
|
- **The grader and the answers are set on the edit screen** and saved to `settings.grading` with the edit token (`useSave` with `getGrading`): `{ "type": "pattern", "answer_key": "^…$" }` or `{ "type": "rubric", "rubric": "…" }`. The kit's default block `app.useGradingBlock()` uses LXP's wording (기준 답안 (정규표현식), 작성 예시 보기, 평가 기준). When the answers depend on the content's structure (questions, choices, steps), set them where the content is edited, for example in each question card. The answer to `pattern` is **one regular expression** that must match the whole submitted answer string (trimmed), so submit one string and build the regex from the instructor's choices.
|
|
27
|
+
- **`partial_pattern` (partial score per question)**: `{ "type": "partial_pattern", "answer_key": ["^…$", "^…$"], "scores": [50, 50] }`. The student submits a **string array** in question order and `answer[i]` is matched against `answer_key[i]` the same way as `pattern` (trimmed, full match). The score is the sum of `scores[i]` of the matched questions, capped at 100. Rules the server enforces on save (422 otherwise): both arrays 1–50 long and the same length, each score an integer 0–100, the sum at least 100 (a lower sum could never complete). Only 100 is `is_correct: true` and completes `on_graded`; a missing item scores 0, extra items are ignored, and an answer that is not an array of strings is rejected (422). The response also carries `answer_correctness` (per question, `answer_key` order; `[]` for `pattern` · `rubric`), in the submit response and the submission lists, so a screen can mark each question right or wrong (SDK `answerCorrectness`). Kit helpers: `validatePartialGrading` (the same rules, for `getGrading`) and `splitScores(n)` (equal integer split summing to 100, e.g. 3 → [33, 33, 34]). The quiz template supports both (6).
|
|
28
|
+
- **Choosing between `pattern` and `partial_pattern` is the person's call.** For a material with several questions, ask: "모두 맞혀야 100점" (`pattern`) or "문항별 부분 점수" (`partial_pattern`). For partial scores, take the per-question scores from the person or from the planning material; if neither gives them, use the equal split (`splitScores`) and say so in the summary. Scores are integers 0–100 summing to at least 100 (usually exactly 100). Students must answer every question before they submit (the quiz blocks an unanswered question), so a skipped question cannot score 0 by design.
|
|
29
|
+
- **Regexes run on the server in Python `re`**, not JavaScript: for a case-insensitive match put `(?i)` at the very start (`(?i)^(paris|파리)$`); the kit, `ecdk dev` and the local mock turn a leading `(?i)` · `(?s)` · `(?m)` into the JS flag. Avoid what the two engines read differently: `\w` · `\d` · `\b` match Unicode (Korean letters, full-width digits) in Python but only ASCII in JS, so write the characters out (`[0-9]`, `[가-힣A-Za-z]`); named groups are `(?P<name>…)` in Python and `(?<name>…)` in JS (do not use them); lookbehind must be fixed-width in Python; inline flags anywhere but the start fail in both. The generated keys (escaped literals, `(?:…|…)`, `^…$`) mean the same in both.
|
|
26
30
|
- **The completion policy is picked in LXP**, not in the project: the publish skill proposes it from this table and sets it with the upload after the person agrees (graded: the quiz template or settings with `grading` → `on_graded`; submits without grading → `on_submit`; no submission → `on_access`), or the instructor chooses it in the '설정' panel at the top of the LXP edit page, which applies at once (ADR 0012). `on_graded` needs `settings.grading` saved first, so it goes in the same save as settings with `grading`, or later. Do not write it in `metadata.json` (the old `completionPolicies` and `screens.completionPolicy` are ignored with the warning `manifest.completion-policies-ignored`, and `ecdk build` leaves them out of the zip). The content can read the current policy (SDK `material.completionPolicy`) but never sets it. Build what the suggested policy needs: a submission (`useSubmit`) for `on_submit` · `on_graded`, and the grading saved on the edit screen for `on_graded`. The server rejects `on_graded` without `settings.grading` (`MATERIAL_GRADING_REQUIRED`). The edit screen never sends a policy.
|
|
27
31
|
- **Only `on_graded` grades.** `on_submit` completes on any submission and does not grade, even with saved answers: the submission comes back `is_correct: null`, `score: 100`, and the kit shows "제출했어요.". `on_access` completes on open. A quiz with `on_submit` shows no score; that is the policy, not broken grading.
|
|
28
|
-
- Custom HTML does not use manual grading (`manual`) or no grading (`none`).
|
|
32
|
+
- Custom HTML does not use manual grading (`manual`) or no grading (`none`). With `pattern` there is no per-question grading: every question must be right for 100 (use `partial_pattern` for a score per question). Changing the answers does not regrade past submissions.
|
|
29
33
|
- Answers never go in the zip (`metadata.json` · data JSON · code), and there is no answer file in the project: answers exist only in `settings.grading`, saved on the edit screen. The old `gradingTypes` field is gone (2026-11-10): `ecdk build` warns when it is still in `metadata.json` or an old `elice.config.json`. A grading with the 11-10 policy and grader fields is rejected with how to rewrite it.
|
|
30
34
|
|
|
31
35
|
**②-1 Learning notes**: write the key concepts, the activity, and the intent of the questions in `commentary.txt` (plain text) at the top of the project. `build` puts it in the zip and writes `"commentary": "commentary.txt"` in `metadata.json`; LXP's AI Helpy and AI quiz generation read it. It is inside the zip, so students can read it: **never put answers in it.** A material needs it: LXP rejects an upload without learning notes, and `ecdk validate` reports `manifest.commentary-missing` (a problem description, `kind: description`, does not need it). Once it is filled in, AI Helpy answers only questions about this material.
|
|
32
36
|
|
|
33
37
|
**③ Does it need an instructor screen?** Make one when there are explanations, a summary of the answer conditions, or teaching tips. Turn it off when it would equal the student screen.
|
|
34
38
|
|
|
35
|
-
**④ Does it need a content edit screen?** When instructors may want to rewrite text, numbers or lists (for example a simulation's initial values, a card list, step descriptions), keep them in the content the edit screen saves (`app.content`, the material's `settings`) and let the edit screen change them. There is no default content file: until the edit screen saves, `app.content` is `{}`, `app.hasContent` is false, and the student and instructor screens show `app.emptyState()` ("
|
|
39
|
+
**④ Does it need a content edit screen?** When instructors may want to rewrite text, numbers or lists (for example a simulation's initial values, a card list, step descriptions), keep them in the content the edit screen saves (`app.content`, the material's `settings`) and let the edit screen change them. There is no default content file: until the edit screen saves, `app.content` is `{}`, `app.hasContent` is false, and the student and instructor screens show `app.emptyState()` (illustration + "학습 자료를 준비하고 있어요"). **Whenever a learning screen has nothing to show, always use `app.emptyState()`**; never design your own empty-state markup, illustration or text (5, "Nothing to show"). Turn the edit screen off only when the material needs no content at all (everything is in the code).
|
|
36
40
|
|
|
37
41
|
**④-1 Design the content JSON shape** before the screens: the keys the student screen reads (for example `{ "title": "…", "unit": "km", "items": [{ "name": "수성", "value": 4879 }] }`), which are required, number ranges and list sizes. That shape becomes the schema of the kit's content editor (`useContentEditor`, see 5), so the edit screen needs no hand-written fields. Keep it small and flat, and keep graded answers out of it.
|
|
38
42
|
|
|
39
43
|
**⑤ Purpose**: the material itself (`kind: material`, the default), or the **problem description** of another material such as a practice (`kind: description`: student screen only, no grading).
|
|
40
44
|
|
|
41
|
-
|
|
45
|
+
**⑥ Choose navigation and content layout** ([14](14-layouts.md)): LXP already draws a bar **under every material** with `< 이전 · 3/6 · 다음 >` that moves between **lecture pages**, so never draw your own bottom 이전 · 다음 bar or `n / N` inside the material.
|
|
42
46
|
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
- On a phone (narrower than 512px) the kit puts the buttons under the content instead of over its edges.
|
|
47
|
+
- **Navigation**: one screen (the default), or the kit **stepper** for several steps (slides, STEP 1~5, intro → experiment → summary): `app.useStepper()` with one `<section data-ec-step>` per step. Back/Next sit in the side gutters, `n / N` bottom-left; the first step's Back and the last step's Next go to the previous / next LXP material. Options, off by default: `canNext` (block Next until the step is done) and `remember` (reopen at the last step in this browser).
|
|
48
|
+
- **Content layout** per screen or step: `single` (text, a question, a survey) · `split` (explanation | practice) · `stage` (simulation: stage, live readout, controls in the first screen) · `media` (video, PDF). Mark it with `data-ec-layout` and put content in `data-ec-region` boxes.
|
|
49
|
+
- Tell the person the choice in one line, for example "단계 3개: 1 도입 single · 2 실험 stage · 3 정리 split".
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# 3. Create the project
|
|
2
2
|
|
|
3
|
-
Run `ecdk create --list` first: it prints each template with its own version (`quiz@1.
|
|
3
|
+
Run `ecdk create --list` first: it prints each template with its own version (`quiz@1.5.0`), what it is for and its screens. Pick the template from that list. `ecdk create` records the template and version in `package.json` `"ecdk"` (`template`), `ecdk build` copies it to `metadata.json` `build.template`, and `ecdk doctor` says when the installed ecdk ships a newer version of that template (nothing changes on its own).
|
|
4
4
|
|
|
5
5
|
| Case | Start with |
|
|
6
6
|
| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
7
7
|
| A quiz (one question per quiz material; several questions mean several quiz materials) | `ecdk create <folder>` (quiz template: starts with no question; the edit screen adds one question of any of the five types with "문항 추가"; answers set on the edit screen; `pattern` grading, `on_graded` picked in LXP) |
|
|
8
8
|
| Any other material | `ecdk create <folder> --template blank` (three screens with a small example to replace, "예측하고 확인하기", and the kit content editor on the edit screen: see 5) |
|
|
9
|
+
| A material in several steps (intro → experiment → summary, slides) | `ecdk create <folder> --template steps` (kit stepper `app.useStepper` and a different content layout per step, example "진자의 주기", content editor on the edit screen: see [14](14-layouts.md)) |
|
|
9
10
|
| A dark screen | Add `--theme dark` to the above |
|
|
10
11
|
| A problem description | Create with blank, set `metadata.json` to `{ "kind": "description", "screens": { "learn": { "enabled": true, "entry": "index.html" } }, "commentary": "commentary.txt" }`, delete the other screen files |
|
|
11
12
|
| An existing HTML page | [7. Move existing HTML](07-move-existing-html.md) |
|
|
@@ -4,19 +4,25 @@
|
|
|
4
4
|
|
|
5
5
|
Do not open `lib/` to learn the API: this table is the API (from `lib/elice-content.d.ts`, `lib/elice-content-editor.d.ts`, `lib/elice-content.css`). Start from the template's example screens (`screens/*.js`) and change them. Never edit `lib/`.
|
|
6
6
|
|
|
7
|
-
| `lib/elice-content.js` | What it is
|
|
8
|
-
| --------------------------------------------------------------------------------------------------------- |
|
|
9
|
-
| `await start({ screen })` → `app` | `screen`: `'learn'` · `'instructor'` · `'edit'`. Optional `onError(err)` (`ContentError` with `code`)
|
|
10
|
-
| `app.content` · `app.hasContent` · `app.emptyState()`
|
|
11
|
-
| `app.screen` · `app.viewer` · `app.readOnly` · `app.isDraft` | `'learn'`… · `'student'` · `'instructor'` · `'tutor'` · tutoring (read-only, the kit locks the screen) · draft preview (submissions not recorded)
|
|
12
|
-
| `app.account` · `app.result` | `{ anonymousId, fullname }` or null (e.g. `anonymousId` as a per-person random seed) · `{ score, submitCount, completedAt }` or null
|
|
13
|
-
| `app.useSubmit({ getAnswer, setAnswer?, validate?, onResult?, root?, label? })` | Student screen submit bar → `{ element, result, restored }`. `getAnswer()` small JSON · `setAnswer(a)` on reopen and in tutoring · `validate(a)` → `true` or a message · `onResult({ isCorrect, score, answer? }, { restored })`. Locking, restoring and messages are the kit's |
|
|
14
|
-
| `app.useSave({ getContent, validate?, getGrading?, root?, label? })` | Edit screen save bar → `{ element, markDirty(), dirty }`. Watches `root` (default `#app`) for changes, except inside `[data-ec-quiet]`. `getGrading()` → `Grading`, a message (blocks saving) or `undefined` (keep)
|
|
15
|
-
| `app.useGradingBlock({ graders?, examples?, root? })` | Edit screen grader block (LXP's "기준 답안 (정규표현식)" · "평가 기준") → `{ element, grader, getGrading() }`; pass `getGrading` to `useSave`
|
|
16
|
-
| `app.
|
|
17
|
-
| `app.grading` | Saved grading on the edit screen only: `{ type: 'pattern', answer_key }` · `{ type: 'rubric', rubric }` or null
|
|
18
|
-
| `app.submit(answer)` · `app.lastAnswer()` · `app.lastSubmission()` · `app.saveContent(content, grading?)` | Low-level calls under `useSubmit` · `useSave` (rarely needed)
|
|
19
|
-
| `
|
|
7
|
+
| `lib/elice-content.js` | What it is |
|
|
8
|
+
| --------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
9
|
+
| `await start({ screen })` → `app` | `screen`: `'learn'` · `'instructor'` · `'edit'`. Optional `onError(err)` (`ContentError` with `code`) |
|
|
10
|
+
| `app.content` · `app.hasContent` · `app.emptyState({ title?, description?, theme? })` | What the edit screen saved (`{}` until saved) · whether it saved · the empty-state element to show when `hasContent` is false (student and instructor screens): illustration + "학습 자료를 준비하고 있어요" + "준비가 완료되면 이곳에서 볼 수 있어요", centred. Call it with no arguments; `theme: 'dark'` only on a dark area of a light page (the dark theme already gets dark colours). `title` · `description` (`''` hides it) only when the person asks for other words. Never your own empty-state markup (see "Nothing to show") |
|
|
11
|
+
| `app.screen` · `app.viewer` · `app.readOnly` · `app.isDraft` | `'learn'`… · `'student'` · `'instructor'` · `'tutor'` · tutoring (read-only, the kit locks the screen) · draft preview (submissions not recorded) |
|
|
12
|
+
| `app.account` · `app.result` | `{ anonymousId, fullname }` or null (e.g. `anonymousId` as a per-person random seed) · `{ score, submitCount, completedAt }` or null |
|
|
13
|
+
| `app.useSubmit({ getAnswer, setAnswer?, validate?, onResult?, root?, label? })` | Student screen submit bar → `{ element, result, restored }`. `getAnswer()` small JSON · `setAnswer(a)` on reopen and in tutoring · `validate(a)` → `true` or a message · `onResult({ isCorrect, score, answerCorrectness?, answer? }, { restored })` · `resultText(r)` → own result line or `undefined` · `allowUnchanged`. After a submit the kit scrolls the result into view and disables the button with "답을 고치면 다시 제출할 수 있어요." until the answer changes (`allowUnchanged: true` turns that off). Locking, restoring and messages are the kit's |
|
|
14
|
+
| `app.useSave({ getContent, validate?, getGrading?, root?, label? })` | Edit screen save bar → `{ element, markDirty(), dirty }`. Watches `root` (default `#app`) for changes, except inside `[data-ec-quiet]`. `getGrading()` → `Grading`, a message (blocks saving) or `undefined` (keep) |
|
|
15
|
+
| `app.useGradingBlock({ graders?, examples?, root? })` | Edit screen grader block (LXP's "기준 답안 (정규표현식)" · "평가 기준") → `{ element, grader, getGrading() }`; pass `getGrading` to `useSave` |
|
|
16
|
+
| `app.useStepper({ canNext?, remember?, count?, onChange?, start?, root? })` | Steps inside one material: one `<section data-ec-step>` per step (or `{ count, onChange(step, { content, section }) }` for code-drawn steps); Back/Next and `n / N` → `{ element, content, nav, go(i), refresh(), step, count, ready }`. `canNext(step)` → `true` or a reason (blocks Next). `remember` keeps the last step in this browser. Old name `app.usePaging` (same) |
|
|
17
|
+
| `app.grading` | Saved grading on the edit screen only: `{ type: 'pattern', answer_key }` · `{ type: 'partial_pattern', answer_key: [], scores: [] }` · `{ type: 'rubric', rubric }` or null |
|
|
18
|
+
| `app.submit(answer)` · `app.lastAnswer()` · `app.lastSubmission()` · `app.saveContent(content, grading?)` | Low-level calls under `useSubmit` · `useSave` (rarely needed) |
|
|
19
|
+
| `skeleton(layout?, { parts?, label? })` | Exported: loading placeholder (`.ec-sk`, shimmer, "불러오는 중…" for screen readers only). Put it in `#app` before `await start()`. `'learn'` = one block that fills the screen, `'edit'` = `parts` from the top (default `['bar', 'media']`: file bar + 16:9 preview). Use the same markup in the HTML so it shows before the script runs |
|
|
20
|
+
| `showSnackbar({ text, onAction?, action?, onClose?, focus? })` | Exported: edit screen "되돌리기" message at the bottom (`.ec-snackbar`, 6 s, one at a time, outside `#app`) → `{ element, close() }`. See [13](13-edit-screen-design.md) |
|
|
21
|
+
| `fileBar({ icon?, name, meta?, onChange?, changeLabel?, disabled? })` · `formatFileMeta` · `infoList` | Exported: edit screen uploaded-file row (`.ec-file-bar`, button "다른 파일로 변경") · "120MB, 08:30" · ⓘ list. `icon`: `fileVideoIcon()` (`lib/icons/file-video.js`) or `fileIcon()` (`lib/icons/file.js`); import only the icon you use, so the zip carries only that icon and its license comment |
|
|
22
|
+
| `fitCanvas(canvas, onResize?)` | Exported: sizes a canvas drawing buffer to its shown size × `devicePixelRatio` and again on every resize; `onResize({ ctx, width, height, dpr })` runs at once and on resize: redraw there with that `ctx`, in CSS px → `{ ctx, size, stop() }`. See [14](14-layouts.md) |
|
|
23
|
+
| `validateAnswerRegex(regex, samples?)` | Exported: checks an answer regex (non-empty, length ≤ `ANSWER_KEY_MAX`, compiles, `^…$`, run time; a leading `(?i)` is the case-insensitive flag) → `null` or a message. Also `GRADER_TYPES`, `GRADING_EXAMPLES`, `normalizeGrading` |
|
|
24
|
+
| `validatePartialGrading({ answer_key, scores })` · `splitScores(n)` | Exported: checks `partial_pattern` like the server (1–`PARTIAL_ITEMS_MAX` items, same lengths, integer scores 0–100, sum ≥ 100, each regex with `validateAnswerRegex`) → `null` or a message · equal integer scores summing to 100 (3 → `[33, 33, 34]`) |
|
|
25
|
+
| `toJsRegex(regex)` · `matchesAnswer(regex, answer)` | Exported: the server's Python regex as JS `{ source, flags }` (leading `(?i)` · `(?s)` · `(?m)` → flag) · whether the trimmed answer fully matches (the server's judgment) |
|
|
20
26
|
|
|
21
27
|
| `lib/elice-content-editor.js` (edit screen only) | What it is |
|
|
22
28
|
| ---------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
@@ -26,11 +32,13 @@ Do not open `lib/` to learn the API: this table is the API (from `lib/elice-cont
|
|
|
26
32
|
| `lib/elice-content.css` (EDS, light and dark) | Use |
|
|
27
33
|
| --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
28
34
|
| Elements | `main` (720px column, 20px gap), `h1`, `p`, `button`, `input` · `textarea` · `select` (full width, 16px text) are styled already |
|
|
35
|
+
| Content layouts | `data-ec-layout="single \| split \| stage \| media"` with regions `data-ec-region="main \| aside \| stage \| controls \| readout \| actions"`, CSS only. Tokens `--ec-layout-max` `--ec-layout-wide` `--ec-layout-gap` `--ec-panel-width` `--ec-stage-height` `--ec-nav-gutter` `--ec-fab-safe`. See [14](14-layouts.md) |
|
|
29
36
|
| Layout · boxes | `.ec-card` (bordered box, column) · `.ec-row` (wrapping row, 8px gap) · `.ec-col` (column, 12px gap) · `.ec-option` (one choice row with its input) · `.ec-badge` (small tag) |
|
|
30
37
|
| Buttons | `button.ec-primary` (main action) · `button.ec-text-button` · `button.ec-icon-button` (borderless icon, needs `aria-label`) · `button.ec-icon-button.ec-danger` (red ✕) |
|
|
31
38
|
| Messages | `.ec-result` (info) · `.ec-result.ok` · `.ec-result.no` · `.ec-error` · `.ec-notice` (message + one action) · `.ec-muted` · `.ec-empty` (from `emptyState()`) · `.ec-visually-hidden` |
|
|
32
39
|
| Student targets | `.ec-dropzone` + `.ec-dropzone-title` (empty drop target) |
|
|
33
|
-
|
|
|
40
|
+
| Edit screens | `body.ec-edit-page` · `.ec-edit-card` · `.ec-field` · `.ec-reveal` · `.ec-list` · `.ec-toggle` · `.ec-file-bar` · `.ec-info-line` and more: rules and example in [13](13-edit-screen-design.md) |
|
|
41
|
+
| Drawn by the kit | `.ec-submitbar` · `.ec-stepper` (with `<ec-stepper-nav>`, Shadow DOM) · `.ec-grading*` · `.ec-json*` (do not build these yourself) |
|
|
34
42
|
| Tokens | `--ec-bg` `--ec-surface` `--ec-fg` `--ec-muted` `--ec-line` `--ec-border` `--ec-accent` `--ec-accent-dark` `--ec-accent-bg` `--ec-ok` `--ec-ok-bg` `--ec-no` `--ec-no-bg` `--ec-warn-bg` `--ec-info` `--ec-info-bg` `--ec-radius` `--ec-shadow`; type: `--eds-font-family` `--eds-fs-h1`…`--eds-fs-h6` `--eds-fs-body1` `--eds-fs-body2` `--eds-fs-caption` `--eds-fw-medium` `--eds-fw-semibold` `--eds-fw-bold` `--eds-fw-extrabold`. Dark theme: `<html data-eds-theme="dark">` |
|
|
35
43
|
|
|
36
44
|
Your own styles go in `styles.css` with these tokens, so both themes work.
|
|
@@ -73,22 +81,30 @@ const grading = app.useGradingBlock();
|
|
|
73
81
|
app.useSave({ getContent: () => app.content, getGrading: () => grading.getGrading() });
|
|
74
82
|
```
|
|
75
83
|
|
|
76
|
-
- `getGrading` returns the grading settings (`{ type: 'pattern', answer_key }` or `{ type: 'rubric', rubric }`) or an error message that blocks saving. `app.grading` is the saved grading (only on the edit screen).
|
|
84
|
+
- `getGrading` returns the grading settings (`{ type: 'pattern', answer_key }`, `{ type: 'partial_pattern', answer_key, scores }` or `{ type: 'rubric', rubric }`) or an error message that blocks saving. `useGradingBlock` offers `pattern` and `rubric` only; a screen that grades per question builds `partial_pattern` itself and checks it with `validatePartialGrading`. `useSave` · `saveContent` save it unchanged (arrays included). `app.grading` is the saved grading (only on the edit screen).
|
|
77
85
|
- When the edit screen saves the grading, the student screen must submit (`grading.no-submit` warns when the edit screen uses `useGradingBlock` · `getGrading` · `grading:` but no code calls `useSubmit` · `submit(`).
|
|
78
86
|
- Saving on the edit screen (`useSave`) **saves to the material's draft** (SDK `saveSettings`, with the edit token LXP opens the edit screen with). LXP's previews show the draft right away; learners see it only after the person presses '수업 자료에 반영' at the top of the LXP edit page, which publishes the draft as a new version. In `ecdk dev` there is no publish step, so the student view changes at once. The kit shows the result and the failure messages (the upload is not saved yet, the upload is still processing, session expired), so the screen code does not announce "saved" itself.
|
|
79
87
|
- Materials without a submission do not call `useSubmit` (only `on_access` fits them in LXP).
|
|
80
88
|
- Use `app.viewer` (`student` · `instructor` · `tutor`), `app.readOnly` (tutoring) and `app.account.anonymousId` (for example a per-person fixed random seed) only when needed. The kit handles per-viewer behavior such as the tutoring lock, so the screen code does not branch on the viewer.
|
|
81
|
-
- Steps inside one material
|
|
89
|
+
- Steps inside one material: turn on the kit's stepper and give each step a layout ([14](14-layouts.md)). Never draw an LXP-like bottom 이전 · 다음 bar or your own `n / N`.
|
|
90
|
+
|
|
91
|
+
```html
|
|
92
|
+
<main id="app">
|
|
93
|
+
<section data-ec-step data-ec-layout="single">…</section>
|
|
94
|
+
<section data-ec-step data-ec-layout="stage">…</section>
|
|
95
|
+
</main>
|
|
96
|
+
```
|
|
82
97
|
|
|
83
98
|
```js
|
|
84
|
-
app.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
99
|
+
const stepper = app.useStepper({
|
|
100
|
+
// optional: block Next until the step is done; call stepper.refresh() when that changes
|
|
101
|
+
canNext: i => i !== 1 || tried || '실험을 한 번 해 보세요.',
|
|
102
|
+
// stop timers, sound and video of the step you leave
|
|
103
|
+
onChange: (i, { section }) => pauseOthers(section),
|
|
88
104
|
});
|
|
89
105
|
```
|
|
90
106
|
|
|
91
|
-
|
|
107
|
+
For steps drawn by code, pass `{ count, onChange: (i, { content }) => content.replaceChildren(renderStep(steps[i])) }` (also called once at start; draw only into `content`). The kit wraps the content area (`root`, default `#app`) in its frame, so redrawing `#app` does not remove the buttons. Use `go(i)` to jump. The last step's Next goes on to the next LXP material.
|
|
92
108
|
|
|
93
109
|
- Run simulations and animations with `requestAnimationFrame` and stop them while the view is hidden. Split heavy computation into small pieces.
|
|
94
110
|
|
|
@@ -124,14 +140,25 @@ app.useSave({ getContent: editor.getContent, validate: editor.validate });
|
|
|
124
140
|
- Only the edit screen imports `lib/elice-content-editor.js`; `ecdk build` bundles code per screen, so the student screen does not carry it.
|
|
125
141
|
- Use the editor when the content is data (lists, numbers, short texts). Write a custom edit screen when editing needs its own UI (placing points on an image, a per-question answer UI like the quiz template). The content is visible to students: values the student screen reveals (like "정답 보기" of a self-check) may be in it, answers that are graded never are (`settings.grading`).
|
|
126
142
|
|
|
143
|
+
### Nothing to show: `app.emptyState()`
|
|
144
|
+
|
|
145
|
+
**When a student or instructor screen has nothing to show, always use `app.emptyState()`. Never build your own empty-state markup, illustration or text.** With no arguments it is the shared design every template uses: the illustration, "학습 자료를 준비하고 있어요" and "준비가 완료되면 이곳에서 볼 수 있어요", centred, in light colours (dark colours in the dark theme). Do not pass text or add styles. The only option a screen normally needs is `theme: 'dark'`, when the notice sits on a dark area of a light page (for example a dark document stage).
|
|
146
|
+
|
|
147
|
+
```js
|
|
148
|
+
const app = await start({ screen: 'learn' });
|
|
149
|
+
if (app.hasContent) render(app.content);
|
|
150
|
+
else root.replaceChildren(app.emptyState()); // on a dark stage: app.emptyState({ theme: 'dark' })
|
|
151
|
+
```
|
|
152
|
+
|
|
127
153
|
### UI patterns
|
|
128
154
|
|
|
129
|
-
Build screens from the kit's classes in `lib/elice-content.css` (EDS values, both themes) so every material looks and behaves the same. The quiz template follows these patterns; copy its markup from `ui/templates/`.
|
|
155
|
+
Build screens from the kit's classes in `lib/elice-content.css` (EDS values, both themes) so every material looks and behaves the same. The quiz template follows these patterns; copy its markup from `ui/templates/`. Edit screens: [13](13-edit-screen-design.md) (cards, underline fields, "+ 추가" reveal, answer on the option row, snackbar undo).
|
|
130
156
|
|
|
131
157
|
| Where | Pattern |
|
|
132
158
|
| ------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
133
159
|
| Edit screen, a card for one item (question, step) | Title on the left, then a type `<select>` in regular weight. On the right, borderless icon buttons `button.ec-icon-button`: ↑ · ↓ · delete with a **trash** icon. Hide ↑ · ↓ when there is only one card. |
|
|
134
160
|
| Edit screen, one row in a list (choice, group) | `⠿` drag handle → the answer control (radio or checkbox) → number → text input → remove with `button.ec-icon-button.ec-danger` (a red **✕**, no border). A wide answer control (a `<select>`) goes after the input instead. Disable remove at the minimum count. |
|
|
161
|
+
| Student · instructor screen, nothing to show yet | Always `app.emptyState()` (above), never your own empty-state markup, illustration or text. |
|
|
135
162
|
| Student screen, an empty drop target | `.ec-dropzone`: a dashed box with an icon, a bold line `.ec-dropzone-title` (for example "보기를 여기로 끌어 놓으세요") and a hint `<p>` ("또는 보기를 누른 뒤 이곳을 눌러 주세요."). It also takes clicks, not only drops. |
|
|
136
163
|
| Student screen, undo actions ("답안 초기화") | Show only when there is something to undo (for example at least one item placed), hide on read-only screens, and keep the row height fixed so nothing below jumps. Keep it away from the submit button. |
|
|
137
164
|
| Any Korean text in a narrow box | `word-break: keep-all` so lines do not break inside a word. |
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
# 6. Using the quiz template
|
|
2
2
|
|
|
3
3
|
- The quiz has **no instructor screen** (`metadata.json` `screens.instructor.enabled: false`): an instructor who opens it in LXP gets the student screen and can solve and submit it (graded, not recorded). Add `instructor.html` and turn it on only when the person asks for one.
|
|
4
|
-
- The template starts with **no questions**: the student screen shows "
|
|
5
|
-
- Question types: `select_one` · `select_multiple` · `order` · `text` · `group`. Question, choice and group ids (`q1`, `a`, `g1`) are lower-case letters and digits; once set, do not change them.
|
|
6
|
-
- Student answer: **one string**, `id=answer` per question joined by `;` in question order: `q1=b;q2=a,d;q3=c,a,b;q4=weight;q5=g1:a|g2:b,c`. Multiple choice lists choice ids **sorted**, order lists them in slot order, group lists `group:choices(sorted)` in group order joined by `|`, and a text answer is trimmed and `encodeURIComponent`-encoded.
|
|
7
|
-
- Answers: the instructor picks the answer in each question card of the edit screen. Single and multiple choice mark it in the option rows (a "정답" radio or checkbox per option), group sorting picks each option's group in its row, order uses a separate "정답" section, and text questions take one allowed answer per line. Saving builds one regex and checks it, and blocks the save with the question number when an answer is missing, points at a deleted choice, or the regex does not match the answers back or still matches a changed answer. The quiz grades with `pattern` (no hand-written regex); its completion policy is `on_graded` (set by the publish skill with the answers, or picked in the '설정' panel at the top of the LXP edit page); with `on_submit` the server does not grade (`is_correct: null`, the kit shows "제출했어요."). `pattern` compares the whole answer at once, so **everything must match for 100
|
|
4
|
+
- The template starts with **no questions**: the student screen shows "학습 자료를 준비하고 있어요" until the edit screen saves. The questions and answers are added on the edit screen ("+ 문제 추가", any of the five types picked from the type button's list, the answer in the same card; up to 20 questions): in `ecdk dev`, so the upload can carry them (`.ecdk/settings.json`, sent after the person agrees), or on the LXP edit screen after upload. There is no quiz title or description field (the student screen starts with the questions); a `title` · `description` saved earlier is kept as is.
|
|
5
|
+
- Question types: `select_one` · `select_multiple` · `order` · `text` · `group`. For `order` the student taps the choices in the right order and each gets a number 1 · 2 · 3 (tap again to remove, "답안 초기화" to clear); the answer string is the same as before. Question, choice and group ids (`q1`, `a`, `g1`) are lower-case letters and digits; once set, do not change them.
|
|
6
|
+
- Student answer (`pattern`, the default): **one string**, `id=answer` per question joined by `;` in question order: `q1=b;q2=a,d;q3=c,a,b;q4=weight;q5=g1:a|g2:b,c`. Multiple choice lists choice ids **sorted**, order lists them in slot order, group lists `group:choices(sorted)` in group order joined by `|`, and a text answer is trimmed and `encodeURIComponent`-encoded.
|
|
7
|
+
- Answers: the instructor picks the answer in each question card of the edit screen. Single and multiple choice mark it in the option rows (a "정답" radio or checkbox per option), group sorting picks each option's group in its row, order uses a separate "정답" section, and text questions take one allowed answer per line. Saving builds one regex and checks it, and blocks the save with the question number when an answer is missing, points at a deleted choice, or the regex does not match the answers back or still matches a changed answer. The quiz grades with `pattern` or `partial_pattern` (no hand-written regex; the edit screen keeps the saved type, a new quiz is `pattern`); its completion policy is `on_graded` (set by the publish skill with the answers, or picked in the '설정' panel at the top of the LXP edit page); with `on_submit` the server does not grade (`is_correct: null`, the kit shows "제출했어요."). `pattern` compares the whole answer at once, so **everything must match for 100**.
|
|
8
|
+
- **Partial score per question (`partial_pattern`, 2 ②)**: ask the person which one they want ("모두 맞혀야 100점" or "문항별 부분 점수"). For partial scores, write into `.ecdk/settings.json` both the public `"gradingType": "partial_pattern"` (the student screen cannot see `grading`, so this tells it to submit an array) and `grading` `{ "type": "partial_pattern", "answer_key": ["^q1=b$", "^q2=a,d$", …], "scores": [60, 40, …] }`, one regex per question in question order, each the same as one `id=answer` piece of the `pattern` regex wrapped in `^…$`. Scores come from the person or the planning material, otherwise the equal split (3 questions → 33 · 33 · 34). Then have the person open the edit view and save once ("초안으로 저장") so the edit screen checks every answer. The edit screen has no score field: it keeps the saved scores while the number of questions is the same, and when questions are added or removed it saves an equal split and shows a short notice. The student answer is then an array `["q1=b", "q2=a,d", …]`, and the student screen marks each question ✓ · ✕ from `answer_correctness` (right after submitting and when reopened) and keeps the score line. With `pattern` the score line is hidden: one question shows "오답입니다." in its card, and several questions with any wrong show "틀린 문제가 있어요. 다시 한번 풀어보세요." above the submit bar. Every question must still be answered before submitting.
|
|
8
9
|
|
|
9
10
|
```json
|
|
10
11
|
{
|
|
@@ -16,8 +17,8 @@
|
|
|
16
17
|
- File split: **`ui/` is the look** (edit freely), **`screens/` is the layout** (which blocks in which order), **`core/` is behavior and the grading contract** (do not edit).
|
|
17
18
|
- Colors, spacing, corners, choice cards: the `--qz-*` variables in `ui/theme.css` (they point at EDS tokens, so `--theme dark` also fits)
|
|
18
19
|
- Text: `ui/texts.js` (tab title, loading, student, edit, and validation messages)
|
|
19
|
-
- Markup: the `` html`…` `` snippets in `ui/templates/*.js` (`choice` card, `question` frame, `order`, `group`, `text`, `page` header, `edit` fields). Inserted values are escaped. Classes and tags are free; **keep the `data-role` attributes** (`result` · `explanation` · `choice` · `input` · `
|
|
20
|
+
- Markup: the `` html`…` `` snippets in `ui/templates/*.js` (`choice` card, `question` frame, `order`, `group`, `text`, `page` header, `edit` fields). Inserted values are escaped. Classes and tags are free; **keep the `data-role` attributes** (`result` · `explanation` · `choice` · `input` · `options` · `pool` · `items` and so on, listed at the top of each file) and selecting, tapping, dragging and the answer strings keep working.
|
|
20
21
|
- Behavior adds state as attributes: `data-result="correct|wrong"` · `data-dragging` · `data-ghost`. Style them in CSS.
|
|
21
|
-
- After a change, solve all five types in `ecdk dev` by
|
|
22
|
+
- After a change, solve all five types in `ecdk dev` by tapping and dragging, submit, and check that the answer string (local grading) is unchanged.
|
|
22
23
|
|
|
23
24
|
To mix a visualization or simulation into a quiz, edit the quiz template, or write the question data in the same shape on top of blank.
|
|
@@ -2,27 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
Read `check.issues[]` (`id` · `level` · `path` · `line` · `message`) from `ecdk build --json`. With an `error` no zip is made. Each `message` says how to fix it.
|
|
4
4
|
|
|
5
|
-
| id | Fix
|
|
6
|
-
| ----------------------------------------------------------------- |
|
|
7
|
-
| `ref.missing` · `ref.case-mismatch` | Match the path and case to the real file
|
|
8
|
-
| `ref.root-absolute` | Change `/…` to a relative path
|
|
9
|
-
| `ref.external-script` · `ref.external-request` · `ref.insecure` | Put the library, image, font or video in the zip and use a relative path (fonts: files or data URIs)
|
|
10
|
-
| `html.iframe` | Remove the `<iframe src>`/`<object>`/`<embed>` (an `<iframe>` with `srcdoc` for a code preview passes): upload video as an Elice video material, put other content in this HTML
|
|
11
|
-
| `ref.external-font` (warn) | A font from a host in `rules.json` `externalAllow` (empty for now): closed-network schools cannot reach it, so put a font that matters in the zip
|
|
12
|
-
| `ref.vendor-external-url` (warn) | A library file holds outside addresses: run `ecdk dev`, look for "막힌 외부 요청", put what it loads in the zip and set the library to a relative path
|
|
13
|
-
| `api.storage` · `api.cookie` (warn) | Browser storage and cookies stay only in that browser and device and are not the learner's record. Submit results; save content from the edit screen
|
|
14
|
-
| `api.dialog` · `api.window-open` · `html.form` | An in-page message · the same view · a button click + `useSubmit`
|
|
15
|
-
| `api.external-send` | Remove the external send
|
|
16
|
-
| `sec.
|
|
17
|
-
| `sec.
|
|
18
|
-
| `
|
|
19
|
-
| `
|
|
20
|
-
| `
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
24
|
-
| `
|
|
25
|
-
| `
|
|
26
|
-
| `
|
|
5
|
+
| id | Fix |
|
|
6
|
+
| ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
7
|
+
| `ref.missing` · `ref.case-mismatch` | Match the path and case to the real file |
|
|
8
|
+
| `ref.root-absolute` | Change `/…` to a relative path |
|
|
9
|
+
| `ref.external-script` · `ref.external-request` · `ref.insecure` | Put the library, image, font or video in the zip and use a relative path (fonts: files or data URIs) |
|
|
10
|
+
| `html.iframe` | Remove the `<iframe src>`/`<object>`/`<embed>` (an `<iframe>` with `srcdoc` for a code preview passes): upload video as an Elice video material, put other content in this HTML |
|
|
11
|
+
| `ref.external-font` (warn) | A font from a host in `rules.json` `externalAllow` (empty for now): closed-network schools cannot reach it, so put a font that matters in the zip |
|
|
12
|
+
| `ref.vendor-external-url` (warn) | A library file holds outside addresses: run `ecdk dev`, look for "막힌 외부 요청", put what it loads in the zip and set the library to a relative path |
|
|
13
|
+
| `api.storage` · `api.cookie` (warn) | Browser storage and cookies stay only in that browser and device and are not the learner's record. Submit results; save content from the edit screen |
|
|
14
|
+
| `api.dialog` · `api.window-open` · `html.form` | An in-page message · the same view · a button click + `useSubmit` |
|
|
15
|
+
| `api.external-send` | Remove the external send |
|
|
16
|
+
| `sec.answer-in-bundle` | A correct answer saved on the edit screen (`.ecdk/settings.json` grading) appears as is in screen code, a data JSON or `commentary.txt`, which students can read from the zip. Remove it there; answers live only in the grading settings |
|
|
17
|
+
| `sec.html-injection` | Use `textContent`. If justified: escape + `ecdk-ignore` + the reason |
|
|
18
|
+
| `sec.secret` · `file.secret` | Remove the secret or the answer file (if it was already uploaded, tell the user to **revoke the key**) |
|
|
19
|
+
| `manifest.completion-policies-ignored` (warn) | Remove the old `completionPolicies` and `screens.completionPolicy` from `metadata.json` (and the completion policy screen files). The instructor picks the policy in the '설정' panel at the top of the LXP edit page |
|
|
20
|
+
| `grading.no-submit` (warn) | The edit screen saves the grading but nothing submits: add `useSubmit` to the student screen, or drop the grading block when the material is not graded |
|
|
21
|
+
| `project.legacy-file` (warn, project only) | An old `elice.config.json` · `content.json` · `grading.json` is left: `ecdk doctor --fix` moves `elice.config.json`; re-enter the content and answers in the edit screen, then delete the other files |
|
|
22
|
+
| `sdk.outdated` (error) | The installed SDK bundled into the zip is older than the minimum (1.0.0-alpha.3 or older cannot save in the LXP edit screen - draft save fails): `npm update @eliceio/cdk`, then build again |
|
|
23
|
+
| `project.deps` (doctor) · "@eliceio/cdk 패키지를 찾지 못했습니다" | The SDK package is not installed in the project: run `npm install` in the project, then build again |
|
|
24
|
+
| `build.template-unknown` (warn) | The material was made with a template or template version this ecdk does not know. Update ecdk (`npm i -g @eliceio/cdk-cli`) or check `template` in `package.json` `"ecdk"` |
|
|
25
|
+
| `manifest.*` · `entry.*` | Check `screens` and `kind` in `metadata.json` |
|
|
26
|
+
| `limit.*` · `file.large-image` | Shrink images and video, drop unused files (build output: "files not referenced anywhere") |
|
|
27
|
+
| `sdk.lib-copy` (error, project only) | An SDK copy `lib/cdk.js` in the project (never put in the zip): `ecdk doctor --fix`, `npm install`, replace the kit `lib/elice-content.js` with a new `ecdk create` one, delete `lib/cdk.js` |
|
|
27
28
|
|
|
28
29
|
Use `ecdk-ignore`, which turns a rule off, only for legitimate code a regular expression cannot tell apart, and **always with the reason**. Do not scatter it to silence errors.
|
|
@@ -6,21 +6,22 @@ ecdk dev <folder> --check # one-shot check of every enabled screen, headless
|
|
|
6
6
|
```
|
|
7
7
|
|
|
8
8
|
- Start `ecdk dev` in the background right after `ecdk create` and give the person the URL it prints (the next free port pair when 4170 is taken), so they watch the screens change while you write code. It checks the project again and reloads the view on every change, so do not run `ecdk validate` in a loop; run it once before building.
|
|
9
|
-
- **`ecdk dev [folder] --check [--screens learn,tutoring,instructor,edit] [--viewport desktop,mobile] [--json]`** is the only way you check screens yourself. Never write your own browser-automation script (Playwright, Puppeteer, a headless Chrome command). It starts dev, opens each enabled screen headless at desktop and mobile width (mobile is the dev host's 360px mode) and prints one line per screen and width, then a summary and the validation result, in about 5–15 s:
|
|
9
|
+
- **`ecdk dev [folder] --check [--screens learn,tutoring,instructor,edit] [--viewport desktop,mobile] [--step all|1,2] [--theme light|dark|all] [--json]`** is the only way you check screens yourself. Never write your own browser-automation script (Playwright, Puppeteer, a headless Chrome command). It starts dev, opens each enabled screen headless at desktop and mobile width (mobile is the dev host's 360px mode) and prints one line per screen and width, then a summary and the validation result, in about 5–15 s:
|
|
10
10
|
|
|
11
11
|
```text
|
|
12
12
|
[ok] learn · desktop 1254px 화면 그림 .ecdk/screens/learn-desktop.png
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
- `[fail]`: console or page errors, "막힌 외부 요청" (requests the content CSP blocks; LXP blocks them too: put the file in the zip), failed requests (4xx · 5xx), a blank screen, or `ecdk validate` errors.
|
|
16
|
-
- `[warn]`: a leftover "불러오는 중…"
|
|
17
|
-
- Screenshots of the content only: `.ecdk/screens/<screen>-<viewport
|
|
18
|
-
- `--
|
|
15
|
+
- `[fail]`: console or page errors, "막힌 외부 요청" (requests the content CSP blocks; LXP blocks them too: put the file in the zip), failed requests (4xx · 5xx), a blank screen, a kit stepper button covered by another element or the kit submit button under the stepper row (`render.covered-control`; a control of yours overlapping the stepper buttons is the same id as a `[warn]`), or `ecdk validate` errors.
|
|
16
|
+
- `[warn]`: a leftover "불러오는 중…", horizontal overflow (usually the mobile width), or layout problems: a `stage` layout whose `readout` or `controls` is below the first screen (`render.readout-below` · `render.controls-below`), a `stage` readout over the stage drawing (`render.readout-covers`), content directly in a `split` · `stage` · `media` layout outside a region (`render.outside-region`). See [14](14-layouts.md).
|
|
17
|
+
- Screenshots of the content only: `.ecdk/screens/<screen>-<viewport>[-<theme>][-step<n>].png` (for example `.ecdk/screens/learn-mobile.png`; never in the zip).
|
|
18
|
+
- A material with the kit stepper: add `--step all` to capture every step (the kit moves to each step itself, even past `canNext`); `--theme all` also captures the dark theme. Look at every step and both themes before you report.
|
|
19
|
+
- `--json`: `ok`, `validate` (`errors`, `warnings`, `issues`), `browser`, `screenshotsDir`, and per screen `screen`, `viewport`, `width`, `rendered`, `loading`, `consoleErrors`, `pageErrors`, `blocked`, `failedRequests`, `overflowX`, `layout` (`[{ id, level, message }]`), `theme`, `step`, `missingStep`, `screenshot`, `ms`.
|
|
19
20
|
|
|
20
21
|
Exit codes: 0 no problems · 1 problems · 2 wrong usage · 3 no browser found (it needs Chrome, Edge or Chromium, or `ECDK_BROWSER`). It checks only the first state of each screen (no clicks, no submits): the activity itself is for the person to try in the browser.
|
|
21
22
|
|
|
22
23
|
- After each screen you write, run it for that screen (`--screens learn`); on exit 1 fix what it reports and run again (at most twice). Tell the person the result lines, the screenshot paths (Claude Code: Read the PNG to look at it) and what to try in the browser. A direct link to one view: the dev URL with `?view=student|tutor|instructor|edit` and `?width=360px` (mobile).
|
|
23
|
-
- Screens show their empty state ("
|
|
24
|
+
- Screens show their empty state ("학습 자료를 준비하고 있어요") until content is saved. To check them with sample content, write `<folder>/.ecdk/settings.json` yourself before `--check`: **the same object the edit screen's `getContent()` returns, at the top level** (not wrapped in a `content` key), plus `grading` only when the material is graded (`{ "type": "pattern", "answer_key": "…" }`). For the blank template with the content editor that is the `initial` sample in `screens/edit.js`; for the quiz template `{ "title": …, "questions": [ … ] }` as in `references/06-using-the-quiz-template.md`. The file is never in the zip. It stays local unless the person agrees to send it with the upload ([12](12-upload-with-the-material-mcp.md)), and a file you wrote by hand must first be saved once through the edit view in `ecdk dev` so the edit screen's validation runs.
|
|
24
25
|
- Before the first run, make sure `ecdk dev --help` lists `--check`: an older ecdk does not have it (an ecdk that has it also stops with a usage error, exit 2, on an option the command does not take).
|
|
25
26
|
- On exit 3 (no browser), no `--check` in `--help` (an older ecdk: suggest `ecdk update`), or a problem you cannot fix after two tries, stop checking yourself: ask the person to open the dev URL and go through the list below.
|
|
26
27
|
- What the person (or you, from the screenshots) goes through: finish the student activity (with the score and result when it submits), the tutoring lock, saving on the edit screen → the change on the student screen, saving answers on the edit view → grading of the student view (without saved grading a submission is only accepted, with no score), the mobile width, and the dark theme.
|
|
@@ -37,13 +37,13 @@ Next time, read it, confirm the page with the person as above (기관 · 과목
|
|
|
37
37
|
|
|
38
38
|
1. **Does the server take it?** Look at the input schema of `save_draft` (and `update_material`): use `settings` only when the schema lists it as a key of `payload` (or, on an older server, as a top-level parameter). The same holds for `completion_policy`, `title` and `icon`. If no tool has it, use the fallback below. Never guess another argument or tool name.
|
|
39
39
|
2. **Only this project's file.** Use `<project>/.ecdk/settings.json` of the project you just built, never a file from another project or copied for another material. If the person changed the target page or project since, ask again.
|
|
40
|
-
3. **Checked by the edit screen.** It must be what the edit screen saved, so its own validation ran (the quiz edit screen checks every answer and builds the regex): the person opens the edit view in `ecdk dev`, checks the content and saves with the edit screen's button (the quiz template: "
|
|
40
|
+
3. **Checked by the edit screen.** It must be what the edit screen saved, so its own validation ran (the quiz edit screen checks every answer and builds the regex): the person opens the edit view in `ecdk dev`, checks the content and saves with the edit screen's button (the quiz template: "초안으로 저장"); the dev log prints "내용을 .ecdk/settings.json에 저장했습니다". If you wrote or changed the file by hand (`references/09-check.md`), that save must happen before the upload. Then check the shape: a JSON object, content keys at the top level (not wrapped in `content`), `grading` only when graded. The quiz: `{ "title": …, "questions": [ … ] }` with `grading` `{ "type": "pattern", "answer_key": "^…$" }`, or for partial scores `{ "title": …, "questions": [ … ], "gradingType": "partial_pattern" }` with `grading` `{ "type": "partial_pattern", "answer_key": ["^q1=…$", …], "scores": [ … ] }` (one regex and one score per question, same length as `questions`, integer scores summing to at least 100; `gradingType` must be there too or students submit the wrong shape and get 422).
|
|
41
41
|
4. **Whole replace: compare first.** `settings` replaces the page's settings as a whole (the content keys and `grading`); nothing is merged. On a page that already has a version, read its settings with `get_material` and compare them with the local file. If keys would disappear, or the content saved in LXP differs from the file (an instructor edited it in LXP after the last upload), show a short summary of the difference (which keys or items, the title, the number of questions; never answer values) and ask before overwriting. The person may prefer to keep LXP's content: then send no `settings`. A first upload to a new page needs no comparison.
|
|
42
|
-
5. **Summary and an explicit yes.** Before the upload, show what goes with it: the title, the number of questions or items, and whether answers are included (`grading.type`, `pattern` or `rubric`), but never the answer values (`answer_key`, `rubric`). The answers must be ones the person confirmed (Always: ask before you settle correct answers). Send it only after an explicit yes; a no means the fallback.
|
|
42
|
+
5. **Summary and an explicit yes.** Before the upload, show what goes with it: the title, the number of questions or items, and whether answers are included (`grading.type`, `pattern`, `partial_pattern` or `rubric`; for `partial_pattern` also the number of questions and the scores), but never the answer values (`answer_key`, `rubric`). The answers must be ones the person confirmed (Always: ask before you settle correct answers). Send it only after an explicit yes; a no means the fallback.
|
|
43
43
|
6. **Send** it as `payload.settings` with the save (`save_draft` above), with the completion policy the person agreed to (below). Then check it with `get_material` (or `get_draft` when the draft shows it before saving) as in the table.
|
|
44
44
|
7. **No settings file?** Suggest filling the edit view in `ecdk dev` first and saving, so the upload carries it, or skip it (the person enters the content in the LXP edit screen later).
|
|
45
45
|
|
|
46
|
-
**Fallback (the server has no `settings`, the person said no, or there is no file)**: upload the zip only, without content or `grading`, and without `on_graded` (see "Completion policy"). After saving, tell the person to open the LXP edit page, enter the content and answers on the edit screen (`settings`, with `settings.grading` for `on_graded`) and save with the edit screen's own button (the quiz template: "
|
|
46
|
+
**Fallback (the server has no `settings`, the person said no, or there is no file)**: upload the zip only, without content or `grading`, and without `on_graded` (see "Completion policy"). After saving, tell the person to open the LXP edit page, enter the content and answers on the edit screen (`settings`, with `settings.grading` for `on_graded`) and save with the edit screen's own button (the quiz template: "초안으로 저장"). That saves to the draft; learners see it only after '수업 자료에 반영' at the top of the LXP edit page.
|
|
47
47
|
|
|
48
48
|
**Uploading a zip by hand in LXP**: on the LXP edit page, ⋮ › '다른 파일로 변경', pick the zip, then '수업 자료에 반영'.
|
|
49
49
|
|
|
@@ -69,15 +69,15 @@ The completion policy is not in the project or the zip (ADR 0012): it is a setti
|
|
|
69
69
|
|
|
70
70
|
**Errors and warnings**
|
|
71
71
|
|
|
72
|
-
| Result
|
|
73
|
-
|
|
|
74
|
-
| A login prompt
|
|
75
|
-
| A permission error
|
|
76
|
-
| `MATERIAL_CHANGED`
|
|
77
|
-
| `MATERIAL_GRADING_REQUIRED`
|
|
78
|
-
| `MATERIAL_DRAFT_PENDING` (`update_material`)
|
|
79
|
-
| `PACKAGE_TOO_LARGE`
|
|
80
|
-
| An error about `settings` (for example `INVALID_INPUT`, a bad `settings.grading` pattern or rubric) | Nothing was saved: report it, and save without settings (the fallback) only after the person agrees |
|
|
81
|
-
| `warnings` in a tool result
|
|
72
|
+
| Result | What to do |
|
|
73
|
+
| ------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
74
|
+
| A login prompt | Ask the person to log in again (`/mcp`) |
|
|
75
|
+
| A permission error | The account needs HeadTA or higher in that course |
|
|
76
|
+
| `MATERIAL_CHANGED` | Someone saved after your `get_material`. Do not retry blindly; tell the person |
|
|
77
|
+
| `MATERIAL_GRADING_REQUIRED` | `on_graded` without `grading`. Stop and tell the person |
|
|
78
|
+
| `MATERIAL_DRAFT_PENDING` (`update_material`) | Someone uploaded a package to this page and did not save it: a ready draft holds a package different from the current version. Nothing changed. Stop, explain it, and ask whether to save that draft (`save_draft`, which publishes their upload) or discard it (`discard_draft`). Never pick for the person |
|
|
79
|
+
| `PACKAGE_TOO_LARGE` | Over 20 MB |
|
|
80
|
+
| An error about `settings` (for example `INVALID_INPUT`, a bad `settings.grading` pattern or rubric, `partial_pattern` scores summing to less than 100) | Nothing was saved: report it, and save without settings (the fallback) only after the person agrees |
|
|
81
|
+
| `warnings` in a tool result | Show them to the person close to word for word (for example `settings.grading` sent while the policy is not `on_graded`). No `warnings` key means none |
|
|
82
82
|
|
|
83
83
|
**After saving**: report 기관 · 과목 · 수업 · 페이지 (names and ids), the LXP URL, the saved version, the completion policy (set, or what to pick in the '설정' panel and why: only `on_graded` grades; `on_submit` completes on any submission without grading), any `warnings`, and whether the page is closed to learners (a new page stays closed until the person opens it in LXP). If the LXP edit tab of the page is open, it must be refreshed before editing there, or it overwrites this save.
|