@eliceio/cdk-cli 1.2.1 → 1.3.0-contenttypes.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +63 -53
- package/es/cli.js +11 -2
- package/es/commands/build/index.js +12 -0
- package/es/commands/create/index.js +2 -0
- 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/commands/doctor/index.js +6 -2
- package/es/core/config.d.ts +42 -9
- package/es/core/config.js +217 -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/assets.d.ts +80 -0
- package/es/dev/assets.js +240 -0
- package/es/dev/check.d.ts +30 -0
- package/es/dev/check.js +224 -34
- package/es/dev/grading.d.ts +49 -14
- package/es/dev/grading.js +109 -29
- package/es/dev/host-page.js +27 -3
- package/es/dev/inject.d.ts +2 -1
- package/es/dev/inject.js +10 -2
- package/es/dev/mock-api.d.ts +26 -3
- package/es/dev/mock-api.js +219 -40
- package/es/dev/server.d.ts +12 -1
- package/es/dev/server.js +115 -9
- 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 +34 -5
- 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 +10 -8
- package/skills/_shared/references/04-rules.md +1 -1
- package/skills/_shared/references/05-screen-code.md +52 -23
- 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 +8 -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/skills/elice-content-publish/SKILL.md +1 -1
- package/templates/_shared/lib/cdk-mock.d.ts +47 -3
- package/templates/_shared/lib/cdk-mock.js +293 -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 +222 -23
- package/templates/_shared/lib/elice-content.js +1176 -88
- 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 +6 -4
- package/templates/blank/edit.html +8 -2
- package/templates/blank/index.html +6 -1
- package/templates/blank/instructor.html +6 -1
- package/templates/blank/screens/instructor.js +8 -2
- package/templates/blank/screens/learn.js +1 -1
- package/templates/blank/template.json +1 -1
- package/templates/document/README.md +92 -0
- package/templates/document/commentary.txt +2 -0
- package/templates/document/core/dom.d.ts +13 -0
- package/templates/document/core/dom.js +83 -0
- package/templates/document/core/file-type.d.ts +21 -0
- package/templates/document/core/file-type.js +85 -0
- package/templates/document/core/group-3d.d.ts +20 -0
- package/templates/document/core/group-3d.js +256 -0
- package/templates/document/core/inline-edit.d.ts +15 -0
- package/templates/document/core/inline-edit.js +377 -0
- package/templates/document/core/load.d.ts +13 -0
- package/templates/document/core/load.js +40 -0
- package/templates/document/core/pdf-options.d.ts +9 -0
- package/templates/document/core/pdf-options.js +36 -0
- package/templates/document/core/pdf-worker.d.ts +24 -0
- package/templates/document/core/pdf-worker.js +122 -0
- package/templates/document/core/pdf.d.ts +12 -0
- package/templates/document/core/pdf.js +190 -0
- package/templates/document/core/pptx-edit.d.ts +14 -0
- package/templates/document/core/pptx-edit.js +137 -0
- package/templates/document/core/pptx-fonts.d.ts +5 -0
- package/templates/document/core/pptx-fonts.js +115 -0
- package/templates/document/core/pptx-media.d.ts +18 -0
- package/templates/document/core/pptx-media.js +83 -0
- package/templates/document/core/pptx-view.d.ts +5 -0
- package/templates/document/core/pptx-view.js +185 -0
- package/templates/document/core/settings.d.ts +25 -0
- package/templates/document/core/settings.js +86 -0
- package/templates/document/core/slide-edges.d.ts +3 -0
- package/templates/document/core/slide-edges.js +82 -0
- package/templates/document/core/viewer.d.ts +28 -0
- package/templates/document/core/viewer.js +159 -0
- package/templates/document/edit.html +17 -0
- package/templates/document/gitignore +4 -0
- package/templates/document/index.html +18 -0
- package/templates/document/metadata.json +9 -0
- package/templates/document/package.json +17 -0
- package/templates/document/public/fonts/OFL-Caladea.txt +93 -0
- package/templates/document/public/fonts/OFL-Carlito.txt +93 -0
- package/templates/document/public/fonts/caladea-latin-400-normal.woff2 +0 -0
- package/templates/document/public/fonts/caladea-latin-700-normal.woff2 +0 -0
- package/templates/document/public/fonts/carlito-latin-400-normal.woff2 +0 -0
- package/templates/document/public/fonts/carlito-latin-700-normal.woff2 +0 -0
- package/templates/document/screens/edit.js +574 -0
- package/templates/document/screens/learn.js +61 -0
- package/templates/document/styles.css +644 -0
- package/templates/document/template.json +6 -0
- package/templates/document/ui/templates/edit.js +82 -0
- package/templates/document/ui/templates/page.js +11 -0
- package/templates/document/ui/templates/viewer.js +41 -0
- package/templates/document/ui/texts.d.ts +3 -0
- package/templates/document/ui/texts.js +62 -0
- package/templates/document/ui/theme.css +69 -0
- package/templates/quiz/README.md +32 -14
- package/templates/quiz/core/behaviors.d.ts +17 -7
- package/templates/quiz/core/behaviors.js +40 -53
- package/templates/quiz/core/editor.d.ts +27 -2
- package/templates/quiz/core/editor.js +412 -11
- package/templates/quiz/core/markdown.d.ts +19 -0
- package/templates/quiz/core/markdown.js +225 -11
- package/templates/quiz/core/model.d.ts +40 -3
- package/templates/quiz/core/model.js +112 -5
- package/templates/quiz/core/rich-text.d.ts +18 -0
- package/templates/quiz/core/rich-text.js +469 -0
- package/templates/quiz/edit.html +12 -3
- package/templates/quiz/index.html +12 -3
- package/templates/quiz/public/img/mascot-half.webp +0 -0
- package/templates/quiz/screens/edit.js +331 -49
- package/templates/quiz/screens/learn.js +147 -15
- package/templates/quiz/styles.css +1244 -622
- package/templates/quiz/template.json +9 -2
- package/templates/quiz/ui/templates/edit.d.ts +19 -5
- package/templates/quiz/ui/templates/edit.js +371 -77
- 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 +33 -8
- package/templates/quiz/ui/templates/question.js +6 -4
- package/templates/quiz/ui/texts.js +91 -26
- 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
|
@@ -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. An AI call to mlapi goes through `sdk.mlapi.fetch` (the check allows it, also with the absolute `https://mlapi.run/…` address) |
|
|
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,24 +6,26 @@ 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.
|
|
28
|
+
- `ecdk dev` grades and completes like the server, by the completion policy picked in the host's **SDK 기능 › 완료 정책** (default: the recommended one, `on_graded` when the saved settings have `grading`, otherwise `on_submit`). `on_access` completes on open and does not grade; `on_submit` gives 100 without grading; `on_graded` grades: a `pattern` answer must be a string and a `partial_pattern` answer a string array (anything else is 422 and is not saved), only 100 is correct, and without `grading` every answer scores 0. Rubric (AI) answers are not graded in dev (`score: null`). To check the screens under the policy the person will pick in LXP, pick it there first.
|
|
27
29
|
- Even after your own check, the person looks at the screens before uploading (see [0. What the person decides](00-what-the-person-decides.md)).
|
|
28
30
|
- `ecdk dev` serves the content with the LXP content CSP. "막힌 외부 요청: <address> (<directive>)" in the log above the content and in the terminal is a request LXP blocks too (an external image, font or `fetch`, or a library calling outside while it runs): put the file in the zip.
|
|
29
31
|
- Opening files directly with `file://` is not a check.
|
|
@@ -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). Then run `ecdk doctor` in the project: its `project.grading` check tests the saved `grading` against the server's save rules (`partial_pattern` scores summing to at least 100, integers 0–100, one score per regex, 1–50 questions, valid regexes; `rubric` up to 10,000 characters) and that `gradingType` matches `grading.type`. If it fails, do not upload `settings`: tell the person what doctor said (never the answer values) and have them fix it in the edit view and save again. `ecdk build` does not check `.ecdk/settings.json` (it is not in the zip), so a passing build is not enough.
|
|
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.
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# 13. Edit screen design
|
|
2
|
+
|
|
3
|
+
Every content edit screen (CMS) looks the same: the designer's edit-screen design (design V3: quiz, video and PDF/PPT; the quiz template uses these classes, and following the designer's later quiz revision it alone has no ⓘ line, a gray save bar and an accent-outlined "+ 문항 추가" in its own `styles.css`) is in the kit, `lib/elice-content.css` "편집 화면" (EDS values, light and dark). Use these classes for a hand-written edit screen and for any new template. The blank template's content editor (`useContentEditor`, [5](05-screen-code.md)) already draws this look. Never copy the quiz's `qe-*` classes or hard-code colors: use the kit classes and the `--ec-*` / `--eds-*` tokens, so the dark theme works.
|
|
4
|
+
|
|
5
|
+
## Layout rules
|
|
6
|
+
|
|
7
|
+
1. `<body class="ec-edit-page">` on `edit.html` (the content editor adds it itself): gray page, white cards, the save bar from `app.useSave` fixed white at the bottom with a top line. Content sits in the kit's centered `main` column (720px) by default. A material whose main editing surface is a wide visual (slides with a thumbnail strip) may widen `main` with its own token (like the document template's `--dc-max-width: 1120px`); never full-bleed. Keep the template's own save button label (`useSave({ label })`, for example the quiz's '초안에 반영'); do not rename it.
|
|
8
|
+
2. **Top: title and description of the material**, in one card `.ec-edit-card.ec-edit-info` with underline fields and no visible labels (title `.ec-field-title`, description `.ec-field-body`). An always-true hint about how the screen works goes above it as one `.ec-info-line` (ⓘ, for example "정답으로 고른 보기로 자동 채점합니다."); a hint the person must read first goes in `.ec-edit-notice` (light purple box).
|
|
9
|
+
3. **One card per item** (question, step, slide, uploaded file): `.ec-edit-card`. Head `.ec-edit-card-head`: name in bold ("문항 1"), then a type `<select>` if the item has types, then on the right the bordered icon buttons ↑ · ↓ · trash (`button.ec-icon-button`, `aria-label` always). Hide ↑ · ↓ when there is one card. Below the last card a dashed full-width `button.ec-add` ("+ 문항 추가").
|
|
10
|
+
4. **Underline fields, placeholder as the label**: `.ec-field` + `input.ec-field-input` / `textarea.ec-field-input` with `placeholder` and `aria-label` (sizes `.ec-field-title` · `.ec-field-question` · `.ec-field-body`). A field whose meaning is not clear from its place (unit, value, file language) gets a small label above: `.ec-field-label` (+ `.ec-required` "\*" or `.ec-optional` "선택"), and a hint `.ec-field-hint`. Character count `.ec-field-count` shows only while the field has focus. An empty required field on save: `aria-invalid="true"` (red underline) and focus it.
|
|
11
|
+
5. **Optional fields stay closed** behind an outlined "이름 추가 +" button: `.ec-reveal` > `button.ec-reveal-button` + `.ec-reveal-body[hidden]`. Open: a head row `.ec-reveal-head` (icon, name, `.ec-hint-inline`, a delete button that clears the value and closes), then the field. Open it from the start when it has a value.
|
|
12
|
+
6. **Lists inside a card** (choices, allowed answers, groups): `.ec-section` with a head row `.ec-section-head` (`.ec-label` on the left, a toggle on the right), then `.ec-list` of `.ec-list-row`: drag handle `button.ec-handle` (⠿) → answer mark → number `.ec-list-no` → `input.ec-field-input` → remove `button.ec-icon-button.ec-danger` (✕, disabled at the minimum with a `title` that says why). End with a gray `button.ec-list-add` ("+ 보기 추가"); limits go in `.ec-list-caption`.
|
|
13
|
+
7. **The answer is marked inline on the option row**: `label.ec-answer-mark > input[type=radio|checkbox]` before the text (radio = one answer, checkbox = several), and `data-correct` on the row (purple underline). No separate "정답" section for choice questions. Answers go to `settings.grading`, never into the content ([5](05-screen-code.md)).
|
|
14
|
+
8. **On / off options** (shuffle, show hint): a chip `label.ec-toggle` with a hidden checkbox, `.ec-toggle-off` icon and `.ec-toggle-on` check, not a bare checkbox.
|
|
15
|
+
9. **Uploaded file**: `fileBar({ icon, name, meta, onChange })` draws `.ec-file-bar`: a white row with a divider border, the icon (import only the one you use: `fileVideoIcon` from `lib/icons/file-video.js`, `fileIcon` from `lib/icons/file.js`; each carries its Font Awesome license comment into the zip), `.ec-file-name`, `.ec-file-meta` "120MB, 08:30" (`formatFileMeta`), and a filled small button "다른 파일로 변경". Do not restyle it per template. Something to add, like subtitles: full-width `button.ec-button-small.ec-block` ("+ 자막 추가") with `.ec-info-list` under it (supported formats, what happens automatically).
|
|
16
|
+
10. **Destructive changes are undoable, not confirmed**: delete or change at once and call `showSnackbar({ text, onAction })` from `lib/elice-content.js` (`.ec-snackbar`, "문항 2를 삭제했습니다. 되돌리기", 6 s, bottom center, outside `#app` so it does not mark the screen dirty). Never `confirm()` (blocked in the sandbox anyway).
|
|
17
|
+
11. **Media preview** (video, PDF/PPT page) under the file bar: full column width, 16:9, corner radius 10px, directly on the page. No gray box or padding around it.
|
|
18
|
+
12. **Loading**: show `skeleton('edit')` (file bar + 16:9 block) or `skeleton('learn')` (one block filling the screen) from `lib/elice-content.js` until `start()` resolves, not a "불러오는 중…" text. Put the same markup in the HTML so it shows before the script runs (below). Pick other blocks with `parts` (`'bar'` · `'media'`).
|
|
19
|
+
13. Material-specific looks (a slide thumbnail strip, a video player frame) go in the template's `styles.css`; shared pieces stay in the kit classes.
|
|
20
|
+
|
|
21
|
+
## Microcopy (Korean)
|
|
22
|
+
|
|
23
|
+
- Buttons are noun + verb: "보기 추가", "문항 추가", "다른 파일로 변경", "되돌리기". The reveal button ends with "+": "설명 추가 +".
|
|
24
|
+
- Placeholders say what to type: "질문을 입력하세요", "보기 1". Hints are one short polite sentence ("정답인 보기 1개에 표시하세요").
|
|
25
|
+
- Messages end with "-습니다/-세요", name the item and number: "문항 2를 삭제했습니다.", "보기는 2개 이상이어야 합니다". No exclamation marks, no English.
|
|
26
|
+
|
|
27
|
+
## Loading markup
|
|
28
|
+
|
|
29
|
+
```html
|
|
30
|
+
<!-- edit.html: same as skeleton('edit') -->
|
|
31
|
+
<main id="app">
|
|
32
|
+
<div class="ec-sk ec-sk-edit" role="status">
|
|
33
|
+
<span class="ec-visually-hidden">불러오는 중…</span>
|
|
34
|
+
<div class="ec-sk-bar ec-sk-shimmer"></div>
|
|
35
|
+
<div class="ec-sk-media ec-sk-shimmer"></div>
|
|
36
|
+
</div>
|
|
37
|
+
</main>
|
|
38
|
+
<!-- index.html: same as skeleton('learn') -->
|
|
39
|
+
<main id="app">
|
|
40
|
+
<div class="ec-sk ec-sk-learn ec-sk-shimmer" role="status">
|
|
41
|
+
<span class="ec-visually-hidden">불러오는 중…</span>
|
|
42
|
+
</div>
|
|
43
|
+
</main>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Example
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<body class="ec-edit-page">
|
|
50
|
+
<main id="app">
|
|
51
|
+
<p class="ec-info-line">
|
|
52
|
+
<svg
|
|
53
|
+
viewBox="0 0 24 24"
|
|
54
|
+
fill="none"
|
|
55
|
+
stroke="currentColor"
|
|
56
|
+
stroke-width="2"
|
|
57
|
+
aria-hidden="true"
|
|
58
|
+
>
|
|
59
|
+
<circle cx="12" cy="12" r="9" />
|
|
60
|
+
<path d="M12 11v5M12 8h.01" />
|
|
61
|
+
</svg>
|
|
62
|
+
정답으로 고른 보기로 자동 채점합니다.
|
|
63
|
+
</p>
|
|
64
|
+
<section class="ec-edit-card ec-edit-info">
|
|
65
|
+
<div class="ec-field ec-field-title">
|
|
66
|
+
<input class="ec-field-input" aria-label="제목" placeholder="제목" />
|
|
67
|
+
</div>
|
|
68
|
+
<div class="ec-field ec-field-body">
|
|
69
|
+
<textarea class="ec-field-input" rows="1" aria-label="안내" placeholder="안내"></textarea>
|
|
70
|
+
</div>
|
|
71
|
+
</section>
|
|
72
|
+
<section class="ec-edit-card">
|
|
73
|
+
<header class="ec-edit-card-head">
|
|
74
|
+
<strong>문항 1</strong>
|
|
75
|
+
<button type="button" class="ec-icon-button" aria-label="문항 1 삭제">
|
|
76
|
+
<!-- trash svg -->
|
|
77
|
+
</button>
|
|
78
|
+
</header>
|
|
79
|
+
<div class="ec-field ec-field-question">
|
|
80
|
+
<input class="ec-field-input" aria-label="질문" placeholder="질문을 입력하세요" />
|
|
81
|
+
</div>
|
|
82
|
+
<div class="ec-reveal">
|
|
83
|
+
<button type="button" class="ec-reveal-button">설명 추가 +</button>
|
|
84
|
+
<div class="ec-reveal-body" hidden><!-- .ec-field --></div>
|
|
85
|
+
</div>
|
|
86
|
+
<div class="ec-section">
|
|
87
|
+
<div class="ec-section-head"><span class="ec-label">보기</span></div>
|
|
88
|
+
<div class="ec-list">
|
|
89
|
+
<div class="ec-list-row" data-correct>
|
|
90
|
+
<button type="button" class="ec-handle" aria-label="보기 1 순서 바꾸기">⠿</button>
|
|
91
|
+
<label class="ec-answer-mark"
|
|
92
|
+
><input type="radio" name="q1" aria-label="보기 1 정답" checked
|
|
93
|
+
/></label>
|
|
94
|
+
<input class="ec-field-input" aria-label="보기 1" placeholder="보기 1" />
|
|
95
|
+
<button type="button" class="ec-icon-button ec-danger" aria-label="보기 1 삭제">
|
|
96
|
+
<!-- ✕ svg -->
|
|
97
|
+
</button>
|
|
98
|
+
</div>
|
|
99
|
+
<button type="button" class="ec-list-add">+ 보기 추가</button>
|
|
100
|
+
</div>
|
|
101
|
+
</div>
|
|
102
|
+
</section>
|
|
103
|
+
<button type="button" class="ec-add">+ 문항 추가</button>
|
|
104
|
+
</main>
|
|
105
|
+
</body>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
import { showSnackbar, start } from '../lib/elice-content.js';
|
|
110
|
+
|
|
111
|
+
function removeQuestion(i) {
|
|
112
|
+
const [removed] = draft.questions.splice(i, 1);
|
|
113
|
+
render();
|
|
114
|
+
showSnackbar({
|
|
115
|
+
text: `문항 ${i + 1}을 삭제했습니다.`,
|
|
116
|
+
onAction: () => {
|
|
117
|
+
draft.questions.splice(i, 0, removed);
|
|
118
|
+
render();
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
```
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# 14. Layouts and the stepper
|
|
2
|
+
|
|
3
|
+
A screen = an optional **navigation layout** (the kit stepper, for several steps) × one **content layout** per screen or step × the content inside it. The two do not know each other: the stepper only shows one step at a time, a content layout only places what is inside it. Both are kit parts in `lib/elice-content.css` · `lib/elice-content.js`; settings, grading and LXP do not change.
|
|
4
|
+
|
|
5
|
+
## Content layouts (CSS only)
|
|
6
|
+
|
|
7
|
+
Put `data-ec-layout` on the element that holds one screen (or one step) and put content only in named regions `data-ec-region`. A heading (`h1`–`h3`) may sit directly in the layout as its title row. No JavaScript needed, so it works on any screen.
|
|
8
|
+
|
|
9
|
+
| Layout | Pick it for | Regions | Placement |
|
|
10
|
+
| -------- | --------------------------------------------------------- | --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
11
|
+
| `single` | Explanation text, a quiz question, a survey | none needed (`main` · `actions` optional) | One column, reading width `--ec-layout-max` (720px) |
|
|
12
|
+
| `split` | Explanation + practice, code + result, passage + question | `main` · `aside` · `actions` | `main` \| `aside` (`aside` width `--ec-panel-width`, 40%). Under 768px: one above the other |
|
|
13
|
+
| `stage` | Exploration simulations, physics or math experiments | `stage` · `readout` · `controls` · `main` · `aside` · `actions` | Optional short prompt `main` on top, `stage` (height `--ec-stage-height`), `readout` floats in the stage's top-right corner, `controls` right under the stage. Stage, readout and controls fit the first screen |
|
|
14
|
+
| `media` | A video, PDF or slides with a short caption | `main` (the media) · `aside` · `actions` | `main` is 16:9 and fits the screen width and height, `aside` below |
|
|
15
|
+
|
|
16
|
+
When a `stage` layout has a `readout`, the kit keeps a band at the top of the stage free for it (`--ec-readout-safe`, 56px, 72px on phones) and the readout sits in that band as one row on the right, so it never covers the drawing. Keep the readout short (two or three values); `--check` warns `render.readout-covers` when it overlaps the drawing.
|
|
17
|
+
|
|
18
|
+
A `canvas`, `svg`, `img` or `video` placed directly in the `stage` region fills it (the kit positions it over the whole box, `object-fit: contain`); do not add your own `position: absolute` or `height: 100%` for it. For a sharp canvas at any screen density, size its drawing buffer with the kit helper and redraw in its callback:
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
import { fitCanvas } from '../lib/elice-content.js';
|
|
22
|
+
const canvas = document.querySelector('[data-ec-region="stage"] canvas');
|
|
23
|
+
// runs once right away and on every resize; draw with the ctx it passes, in CSS px
|
|
24
|
+
const fit = fitCanvas(canvas, ({ ctx, width, height }) => draw(ctx, width, height));
|
|
25
|
+
// later redraws (animation): draw(fit.ctx, fit.size.width, fit.size.height)
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Card grids and full-screen stages (games, 3D) are not in the kit yet: use `single` and your own CSS inside a region.
|
|
29
|
+
|
|
30
|
+
```html
|
|
31
|
+
<div data-ec-layout="stage">
|
|
32
|
+
<h2>실험: 줄 길이와 주기</h2>
|
|
33
|
+
<div data-ec-region="main"><p>줄 길이를 바꿔 보세요.</p></div>
|
|
34
|
+
<div data-ec-region="stage"><svg viewBox="0 0 400 300">…</svg></div>
|
|
35
|
+
<div data-ec-region="readout">
|
|
36
|
+
<span>주기 <b>2.01 초</b></span>
|
|
37
|
+
</div>
|
|
38
|
+
<div data-ec-region="controls">
|
|
39
|
+
<label>줄 길이 <input type="range" /></label>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- An empty region takes no space. Layouts leave room at the bottom (`--ec-fab-safe`) so the last row can scroll clear of LXP's floating buttons in the bottom-right corner.
|
|
45
|
+
- Tune with tokens in `styles.css`, not new grids: `--ec-layout-max` · `--ec-layout-wide` (1200px, `split` · `stage` · `media`) · `--ec-layout-gap` · `--ec-panel-width` · `--ec-stage-height`.
|
|
46
|
+
- On a phone (under 512px) every layout is one column; `stage` keeps the readout over the stage and the controls right under it.
|
|
47
|
+
- The `stage` box and the readout use the quiz card look: 12px corners, 1px border, no shadow. A step title (`h2` directly in a layout) is EDS h6 size, semibold. Inside the stepper a `single` step starts at the same left edge as the wider steps, so the title does not jump between steps (the text keeps the 720px reading width).
|
|
48
|
+
|
|
49
|
+
## The stepper (several steps)
|
|
50
|
+
|
|
51
|
+
Use it for a material with steps (intro → experiment → summary, slides, STEP 1~5). One `<section data-ec-step>` per step inside `#app`, each with its own layout, and one call:
|
|
52
|
+
|
|
53
|
+
```html
|
|
54
|
+
<main id="app">
|
|
55
|
+
<section data-ec-step data-ec-layout="single">
|
|
56
|
+
<h2>도입</h2>
|
|
57
|
+
…
|
|
58
|
+
</section>
|
|
59
|
+
<section data-ec-step data-ec-layout="stage" hidden>
|
|
60
|
+
<h2>실험</h2>
|
|
61
|
+
…
|
|
62
|
+
</section>
|
|
63
|
+
<section data-ec-step data-ec-layout="split" hidden>
|
|
64
|
+
<h2>정리</h2>
|
|
65
|
+
…
|
|
66
|
+
</section>
|
|
67
|
+
</main>
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```js
|
|
71
|
+
const stepper = app.useStepper({
|
|
72
|
+
// optional: block Next until the step is done (a string is the reason shown on the button)
|
|
73
|
+
canNext: step => step !== 1 || tried >= 2 || '줄 길이를 두 번 이상 바꿔 보세요.',
|
|
74
|
+
// stop timers, animation, sound and video of the step you leave
|
|
75
|
+
onChange: (step, { section }) => (step === 1 ? play() : stop()),
|
|
76
|
+
// optional: reopen at the last step; stored in this browser only, not on the server (not a learning record)
|
|
77
|
+
remember: false,
|
|
78
|
+
});
|
|
79
|
+
// call stepper.refresh() when what canNext looks at changes
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
- Steps drawn by code instead of sections: `app.useStepper({ count, onChange: (i, { content }) => content.replaceChildren(render(i)) })` (`onChange` also runs once at start). `app.usePaging` is the old name of the same call.
|
|
83
|
+
- What the kit does: Back · Next are 32px outlined round buttons (1px border, no fill or shadow, 16px chevron in the secondary colour; only the chevron dims when Next is blocked by `canNext`; a light hover background on mouse devices), the same look as the document material's page buttons. They sit at the vertical centre of the side gutters (`--ec-nav-gutter`, 112px), the `n / N` indicator is an outlined pill (14px semibold) bottom-left. The bottom-right corner stays empty. Under 512px a row `‹ n / N ›` with 40px buttons and the pill between them floats at the bottom centre (no full-width bar); the indicator stays centred on every step. The step buttons, the indicator and the 이전 자료 · 다음 자료 pills never use the accent purple: keep purple for the material's one or two main actions such as submit. The dark theme follows the EDS tokens (white chevron, translucent white border). The stepper frame keeps `--ec-nav-reserve-mobile` (72px) free at the bottom so the last controls can scroll clear of that row; on a phone a `stage` step fills the screen above that row and the stage takes the height that is left (at least `--ec-stage-min-mobile`, 160px), so its controls sit above the row in the first screen. With a stepper the kit submit bar (`useSubmit`) also stays above that row on a phone: it is still pinned to the bottom, but its button sits `--ec-nav-reserve-mobile` higher; don't change `.ec-submitbar`'s `bottom` or `padding` (`--check` fails `render.covered-control` when the submit button is under the row). Keep the prompt above the stage short: `--check` warns `render.covered-control` when a control in a region still overlaps the stepper buttons. Tune the look only through the `--ec-nav-*` tokens. The first step's Back and the last step's Next become labeled pills that go to the previous / next LXP material (hidden when there is none). ← → keys move between steps (not while an input, select or slider has focus; never leaving the material). On a step change the page scrolls to the top and focus moves to the step's first heading, which the indicator also reads out.
|
|
84
|
+
- Short windows: LXP sizes the content frame to the window height minus 112px (header 56 + bottom bar 56) but never below 512px. Below a window of about 568px the frame runs past the window, LXP's floating buttons (anchored to the window bottom, right side) reach the vertical centre and its bottom bar covers the frame's lowest ~64px. So when the frame is 520px tall or less (and 512px wide or more) the kit lifts Back/Next by `--ec-nav-short-shift` (50px: at a 512px frame the buttons span 190–222px, above the floating buttons at about 268px) and moves `n / N` right under the Back button (230–262px). Keep your own important controls out of the frame's bottom ~64px too.
|
|
85
|
+
- The buttons live in `<ec-stepper-nav>` (Shadow DOM, shown in the top layer), so your CSS, `z-index` and `position: fixed` cannot restyle or cover them. Only a later `<dialog>` or full screen goes above them.
|
|
86
|
+
- Keep a step's own action (submit, "결과 보기") inside that step's regions. `useSubmit` puts its bar right after `root`, so to show it only in the last step pass an element _inside_ a region of that step, for example `app.useSubmit({ root: lastStep.querySelector('.my-table'), getAnswer })`. Passing the region or the `section` itself puts the bar outside the region (`render.outside-region`, a broken grid) or under every step. With the default `root` (`#app`) the bar shows under every step.
|
|
87
|
+
|
|
88
|
+
## Do and don't
|
|
89
|
+
|
|
90
|
+
- Do pick the layouts in the design step and tell the person in one line (for example "단계 3개: 1 single · 2 stage · 3 split").
|
|
91
|
+
- Do keep content inside regions; style inside regions with `--ec-*` tokens.
|
|
92
|
+
- Don't build your own Back/Next buttons, `n / N` or a bottom 이전 · 다음 bar: LXP draws one under every material and students mix them up (`layout.own-step-nav`).
|
|
93
|
+
- Don't put `position: fixed` elements in the side gutters or the bottom-right corner, and don't restyle `html` · `body` or bind global ← → keys.
|
|
94
|
+
- Don't invent layout or region names (`layout.unknown`): only the values above.
|
|
95
|
+
- `ecdk dev --check` reports a covered stepper button (`render.covered-control`), a `stage` readout or controls below the first screen (`render.readout-below` · `render.controls-below`), a readout over the drawing (`render.readout-covers`) and content outside regions (`render.outside-region`). See [9](09-check.md).
|
|
96
|
+
- A working example: `ecdk create <folder> --template steps` ("진자의 주기"); the blank template's student screen uses `single`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: elice-content-check
|
|
3
|
-
description: Find and fix problems in an Elice Custom HTML learning material and answer questions about its rules and SDK - ecdk validate or ecdk build errors, blocked browser APIs and the LXP sandbox and CSP rules, missing or wrongly cased files, a zip that LXP rejects, a material that stays on "Loading" or shows nothing in LXP, and how the @eliceio/cdk SDK or the screen kit works (submit, save, grading,
|
|
3
|
+
description: Find and fix problems in an Elice Custom HTML learning material and answer questions about its rules and SDK - ecdk validate or ecdk build errors, blocked browser APIs and the LXP sandbox and CSP rules, missing or wrongly cased files, a zip that LXP rejects, a material that stays on "Loading" or shows nothing in LXP, and how the @eliceio/cdk SDK or the screen kit works (submit, save, grading, stepper and layouts). Use when the person reports an error with an Elice or LXP material or with ecdk, or asks what is allowed or how an SDK or kit call works.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Fix an Elice learning material
|
|
@@ -16,7 +16,7 @@ Reference files are in `references/` in this skill's folder (see Always). For th
|
|
|
16
16
|
3. **Problems that show only in LXP.**
|
|
17
17
|
- Stays on "Loading" or shows nothing: rebuild with the current `ecdk build` (it adapts the pages to the LXP sandbox) and check the built zip with `ecdk validate dist/content.zip`. Ask the person for the browser console error.
|
|
18
18
|
- Upload rejected: check `ecdk validate dist/content.zip`; a material needs `commentary.txt` and every file named in `metadata.json`.
|
|
19
|
-
- Screens show "
|
|
19
|
+
- Screens show "학습 자료를 준비하고 있어요": nothing is saved yet; create the content in the edit screen (there is no default content file), and in LXP press '수업 자료에 반영' at the top of the edit page after saving the edit screen (`references/12-upload-with-the-material-mcp.md`, "Fallback").
|
|
20
20
|
- Answers or grading wrong: check the answers on the edit screen (saving in the `ecdk dev` content edit view writes `.ecdk/settings.json`) and that the submitted answer string matches the regex (`references/02-design-the-material.md`, `references/06-using-the-quiz-template.md`). In `ecdk dev` a submission is graded only when grading is saved; otherwise it is only accepted. Completing at the wrong time is the completion policy, an LXP setting (Always).
|
|
21
21
|
4. **Confirm.** `ecdk validate` has no errors, `ecdk dev --check` passes (or the person checked the dev URL), and `ecdk build --json` returns `ok: true`. Tell the person what caused it and what you changed.
|
|
22
22
|
|
|
@@ -15,7 +15,7 @@ Write the progress line `[n/N] …` before and after every step below (Always
|
|
|
15
15
|
|
|
16
16
|
1. **Design before code.** Read `references/00-what-the-person-decides.md` and `references/02-design-the-material.md`. Decide ① what the student does, ② whether the student submits and the grading (`type` `pattern` or `rubric`, set on the edit screen; the quiz template uses `pattern`, so do not ask for a quiz) and which completion policy fits (the publish skill sets it after the person agrees; only `on_graded` grades, `on_submit` completes on any submission without grading), ③ the instructor screen, ④ the content edit screen, ⑤ the purpose. Decide what the request leaves out and tell the person briefly; ask only when the learning goal is unclear. Then show the numbered plan.
|
|
17
17
|
2. **Environment and project.** `ecdk --version && ecdk doctor --json` (`references/01-check-the-environment.md`, also for `cli.latest`), then `ecdk create --list` to pick a template and `ecdk create <folder> --template <name>` (`references/03-create-the-project.md`; it runs `npm install` for the SDK, so when that fails run `npm install` in the project). Start `ecdk dev <folder>` in the background now and give the person the URL.
|
|
18
|
-
3. **Write the screens.** Start from the template's example code and the kit API table at the top of `references/05-screen-code.md`; do not open `lib/` to learn the API (the table is the API). Follow its UI patterns (kit icon buttons, list rows, drop zones; the quiz template: `references/06-using-the-quiz-template.md`), and write `commentary.txt` (key concepts and intent, no answers). There is no default content file: the content and answers are what the edit screen saves (`ecdk dev` writes `.ecdk/settings.json`, local by default; the elice-content-publish skill can send it with the upload after the person agrees, otherwise the person enters it in the LXP edit screen).
|
|
18
|
+
3. **Write the screens.** Start from the template's example code and the kit API table at the top of `references/05-screen-code.md`; do not open `lib/` to learn the API (the table is the API). Follow its UI patterns (kit icon buttons, list rows, drop zones; the quiz template: `references/06-using-the-quiz-template.md`); an edit screen you write by hand follows `references/13-edit-screen-design.md` (kit classes, layout, microcopy); when a student or instructor screen has nothing to show, always use `app.emptyState()`, never your own empty-state markup, illustration or text (`references/05-screen-code.md`, "Nothing to show"), and write `commentary.txt` (key concepts and intent, no answers). There is no default content file: the content and answers are what the edit screen saves (`ecdk dev` writes `.ecdk/settings.json`, local by default; the elice-content-publish skill can send it with the upload after the person agrees, otherwise the person enters it in the LXP edit screen).
|
|
19
19
|
- For a material that is not a quiz, start from the blank template and its content editor: design the content JSON shape and its schema first (`references/02-design-the-material.md` ④-1), put them in `screens/edit.js` (`useContentEditor(app, { initial, schema })`), then write the student screen against that shape. Replace the template's example everywhere it says `이 자료에 맞게 바꿀 곳`.
|
|
20
20
|
- If the person describes the content (for example "5 questions about perceptrons"), fill it in so the upload can carry it: write `.ecdk/settings.json` in the shape `references/09-check.md` describes (the edit screen's content object at the top level, `grading` when graded), then have the person open the edit view in `ecdk dev`, check it and save with the edit screen's button, so the edit screen's own validation runs. Draft the answers, but the person confirms them before any upload (Always). A quiz material holds one question, so several questions mean several quiz materials (pages): fill in the first and give the rest as draft text, one per page (each can be put in the edit view and uploaded in turn). If the person prefers, give the content as draft text (the content editor: one JSON block for 코드 보기) to enter in the LXP edit screen instead.
|
|
21
21
|
4. **Check each screen** with `ecdk dev <folder> --check --screens <screen>` after you write it (`references/09-check.md`), fix what it reports (error ids: `references/08-fix-check-errors.md`). The person looks at the screens too.
|
|
@@ -17,7 +17,7 @@ Write the progress line `[n/N] …` before and after every step below (Always
|
|
|
17
17
|
2. **Look at the original first.** List its entry HTML, the files it loads, and storage or cookies used to keep learner data, anything the sandbox blocks (dialogs, `window.open`, the parent window, external requests, absolute `/` paths). Tell the person what will change, then show the numbered plan.
|
|
18
18
|
3. **Wrap it.** Make or reuse an ecdk project as `references/07-move-existing-html.md` says, keep the original files as they are where possible, and write `commentary.txt`. An old ecdk project: `references/08-fix-check-errors.md` (`project.legacy-file`, `sdk.lib-copy`). Start `ecdk dev <folder>` in the background and give the person the URL.
|
|
19
19
|
4. **Submission and grading.** Decide whether it submits and how it grades (`references/02-design-the-material.md`); say which completion policy fits (e.g. `on_access` without a submission); the elice-content-publish skill sets it with the upload after the person agrees. When it grades, set the grader and the answers on the edit screen (`app.useGradingBlock()`). Ask the person for correct answers when it is graded. Data the instructor should edit goes in the content the edit screen saves, not in a default JSON file; until it is saved the screens show `app.emptyState()`. To carry the original's data with the upload, save it through the edit view in `ecdk dev` (`.ecdk/settings.json`, shape in `references/09-check.md`); the elice-content-publish skill sends it after the person agrees, with answers the person confirmed.
|
|
20
|
-
Keep the original design on the student screen. Screens you add (an edit screen, an empty state) follow the kit API table and UI patterns in `references/05-screen-code.md`.
|
|
20
|
+
Keep the original design on the student screen. Screens you add (an edit screen, an empty state) follow the kit API table and UI patterns in `references/05-screen-code.md`; when there is nothing to show yet, always use `app.emptyState()`, never your own empty-state markup, illustration or text; an edit screen also follows `references/13-edit-screen-design.md`.
|
|
21
21
|
5. **Bring external assets in.** Download every external image, font, CSS file, video and library into the zip and use relative paths (fonts as files or data URIs; replace `<iframe>` embeds, video goes to an Elice video material). The content CSP blocks anything outside the zip.
|
|
22
22
|
6. **Check.** `ecdk dev <folder> --check` (`references/09-check.md`), fix what it reports (`references/08-fix-check-errors.md`), compare with the original. "막힌 외부 요청" is a library calling outside at runtime; bring that file into the zip too.
|
|
23
23
|
7. **Build and report.** `ecdk validate` once, then `ecdk build --json` returns `ok: true`; report what changed from the original (`references/10-build.md`).
|
|
@@ -13,7 +13,7 @@ Reference files are in `references/` in this skill's folder (see Always). Read `
|
|
|
13
13
|
|
|
14
14
|
1. **MCP ready?** The `elice-material` tools must be available. If not, ask the person to run `ecdk setup --only mcp` 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. **Content and answers.** Check whether the input schema of `save_draft` (or `update_material`) lists `settings` as a key of `payload` (on an older server, a top-level parameter). If it does and this project has `.ecdk/settings.json`: make sure the edit screen saved it (the person saves the edit view in `ecdk dev`; a file you wrote by hand must go through that save), show a short summary (title, number of questions or items, answers included or not and `grading.type`, never the answer values) and ask for an explicit yes to send it with the upload. `settings` replaces the page's settings as a whole: on a page that already has a version, compare `get_material`'s settings with the file first, and if keys would disappear or the LXP content differs (an instructor edited it in LXP), show the difference briefly and ask before overwriting (a new page needs no comparison). No file: suggest filling the edit view in `ecdk dev` first, or skip it. No `settings` key, or the person says no: zip only (the fallback). Details: `references/12-upload-with-the-material-mcp.md` "Content and answers (settings)".
|
|
16
|
+
3. **Content and answers.** Check whether the input schema of `save_draft` (or `update_material`) lists `settings` as a key of `payload` (on an older server, a top-level parameter). If it does and this project has `.ecdk/settings.json`: make sure the edit screen saved it (the person saves the edit view in `ecdk dev`; a file you wrote by hand must go through that save), run `ecdk doctor` and send no `settings` while its `project.grading` check fails (tell the person why, never the answer values; they fix it in the edit view), show a short summary (title, number of questions or items, answers included or not and `grading.type`, never the answer values) and ask for an explicit yes to send it with the upload. `settings` replaces the page's settings as a whole: on a page that already has a version, compare `get_material`'s settings with the file first, and if keys would disappear or the LXP content differs (an instructor edited it in LXP), show the difference briefly and ask before overwriting (a new page needs no comparison). No file: suggest filling the edit view in `ecdk dev` first, or skip it. No `settings` key, or the person says no: zip only (the fallback). Details: `references/12-upload-with-the-material-mcp.md` "Content and answers (settings)".
|
|
17
17
|
4. **Completion policy.** If `save_draft` (or `update_material`) lists `completion_policy` in its input schema (in `payload`), propose one (`references/12-upload-with-the-material-mcp.md` "Completion policy"): graded (the quiz template, or settings with `grading`) → `on_graded`, submits without grading → `on_submit`, no submission → `on_access`. `on_graded` only when the same save carries `settings` with `grading` (or the page already has grading); otherwise no policy at the first save, or `on_submit` if the person wants it (ask). Tell the person that only `on_graded` grades: `on_submit` completes on any submission without grading ("제출했어요."), `on_access` completes on open. The policy is a page setting and applies at once.
|
|
18
18
|
5. **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, its LXP edit URL, whether content and answers go with it and the completion policy to set (the page's current one too), 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. If the page already has content or answers saved in LXP, say that sending settings replaces them and ask again.
|
|
19
19
|
6. **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.
|
|
@@ -22,6 +22,11 @@ export declare const ErrorCode: Readonly<{
|
|
|
22
22
|
NavigationTimeout: 'navigation_timeout';
|
|
23
23
|
RequestFailed: 'request_failed';
|
|
24
24
|
DraftNotSaved: 'draft_not_saved';
|
|
25
|
+
FileInvalidType: 'file_invalid_type';
|
|
26
|
+
FileInvalidSize: 'file_invalid_size';
|
|
27
|
+
ScriptLoadFailed: 'script_load_failed';
|
|
28
|
+
ScriptNamespaceNotFound: 'script_namespace_not_found';
|
|
29
|
+
StorageLimitExceeded: 'storage_limit_exceeded';
|
|
25
30
|
}>;
|
|
26
31
|
export declare class EliceCDKError extends Error {
|
|
27
32
|
static code: typeof ErrorCode;
|
|
@@ -33,6 +38,8 @@ export declare class EliceCDKError extends Error {
|
|
|
33
38
|
export interface SubmitResult {
|
|
34
39
|
isCorrect: boolean | null;
|
|
35
40
|
score: number | null;
|
|
41
|
+
/** partial_pattern 문항별 맞음 (answer_key 순서, 없는 답은 false). pattern · rubric · 채점 없음은 [] (옛 서버는 없음) */
|
|
42
|
+
answerCorrectness?: boolean[];
|
|
36
43
|
}
|
|
37
44
|
|
|
38
45
|
export interface Submission extends SubmitResult {
|
|
@@ -43,12 +50,18 @@ export interface Submission extends SubmitResult {
|
|
|
43
50
|
answer: unknown;
|
|
44
51
|
}
|
|
45
52
|
|
|
46
|
-
/** 채점 설정을 서버 모양으로 ({ type: pattern | rubric }). camelCase answerKey도 받는다. 채점 방식이 아니면 null */
|
|
53
|
+
/** 채점 설정을 서버 모양으로 ({ type: pattern | partial_pattern | rubric }). camelCase answerKey도 받는다. 채점 방식이 아니면 null */
|
|
47
54
|
export declare function normalizeGradingSettings(
|
|
48
55
|
grading: unknown
|
|
49
|
-
):
|
|
50
|
-
|
|
56
|
+
):
|
|
57
|
+
| { type: 'pattern'; answer_key?: string }
|
|
58
|
+
| { type: 'partial_pattern'; answer_key: string[]; scores: number[] }
|
|
59
|
+
| { type: 'rubric'; rubric?: string }
|
|
60
|
+
| null;
|
|
61
|
+
/** 채점 설정이 있으면 로컬 채점, 없으면 제출만 받음 (점수 null). partial_pattern은 맞은 문항 점수의 합(최대 100) */
|
|
51
62
|
export declare function gradeLocally(grading: unknown, answer: unknown): SubmitResult;
|
|
63
|
+
/** 서버가 채점 전에 거절하는 답(422)이면 이유: partial_pattern에 문자열 배열이 아닌 답. 문제가 없으면 null */
|
|
64
|
+
export declare function answerShapeError(grading: unknown, answer: unknown): string | null;
|
|
52
65
|
|
|
53
66
|
export interface Navigation {
|
|
54
67
|
previous(): void;
|
|
@@ -58,6 +71,30 @@ export interface Navigation {
|
|
|
58
71
|
getHasNext(): Promise<boolean>;
|
|
59
72
|
}
|
|
60
73
|
|
|
74
|
+
interface Assets {
|
|
75
|
+
post(
|
|
76
|
+
file: File,
|
|
77
|
+
options?: {
|
|
78
|
+
onProgress?: (progress: { loaded: number; total: number }) => void;
|
|
79
|
+
signal?: AbortSignal;
|
|
80
|
+
}
|
|
81
|
+
): Promise<{ id: string; name: string; size: number; mime: string; url: string }>;
|
|
82
|
+
get(id: string): Promise<{ id: string; url: string } | null>;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
type KvValue = string | number | boolean | Record<string, any>;
|
|
86
|
+
|
|
87
|
+
interface Kvstore {
|
|
88
|
+
get<T extends KvValue = any>(params: { key: string }, init?: RequestInit): Promise<T | null>;
|
|
89
|
+
post(params: { key: string; value: KvValue }, init?: RequestInit): Promise<void>;
|
|
90
|
+
delete(key: string, init?: RequestInit): Promise<void>;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
interface Mlapi {
|
|
94
|
+
/** Same as `fetch`. The mock answers 503 SERVICE_UNAVAILABLE (reason ai_not_configured) */
|
|
95
|
+
fetch(input: string | URL | Request, init?: RequestInit): Promise<Response>;
|
|
96
|
+
}
|
|
97
|
+
|
|
61
98
|
export declare class MockEliceCDK {
|
|
62
99
|
constructor(options?: {
|
|
63
100
|
onSessionExpired?: () => void;
|
|
@@ -82,6 +119,12 @@ export declare class MockEliceCDK {
|
|
|
82
119
|
readonly isDraft: boolean;
|
|
83
120
|
readonly isSessionExpired: boolean;
|
|
84
121
|
readonly navigation: Navigation;
|
|
122
|
+
/** 자료 파일. ecdk dev 콘텐츠 주소를 직접 열면 흉내 서버에, 아니면 이 페이지 메모리에만 (blob:) */
|
|
123
|
+
readonly assets: Assets;
|
|
124
|
+
readonly kvstore: Kvstore;
|
|
125
|
+
readonly mlapi: Mlapi;
|
|
126
|
+
readonly accessToken: string | null;
|
|
127
|
+
readonly videoPlayerUrl: string | null;
|
|
85
128
|
readonly material: {
|
|
86
129
|
description: unknown;
|
|
87
130
|
entries: Partial<Record<Screen, string>>;
|
|
@@ -99,6 +142,7 @@ export declare class MockEliceCDK {
|
|
|
99
142
|
history(options?: { offset?: number; limit?: number }): Promise<Submission[]>;
|
|
100
143
|
/** 저장하고 부모 창에 settings-saved로 알린다. 토큰 없는 draft(#edit=1)는 draft_not_saved로 거절 */
|
|
101
144
|
saveSettings(settings: Record<string, unknown>): Promise<void>;
|
|
145
|
+
onAccessTokenChange(listener: (token: string) => void): () => void;
|
|
102
146
|
dispose(): void;
|
|
103
147
|
reset(): void;
|
|
104
148
|
}
|