@eliceio/cdk-cli 1.7.2-sharedqa.0 → 1.8.1-qa.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/README.md +18 -15
  2. package/es/commands/create/index.js +6 -3
  3. package/es/commands/create/scaffold.d.ts +1 -1
  4. package/es/commands/create/scaffold.js +1 -1
  5. package/es/commands/doctor/index.js +34 -1
  6. package/es/core/lesson-check.d.ts +7 -0
  7. package/es/core/lesson-check.js +87 -0
  8. package/es/core/templates.d.ts +2 -0
  9. package/es/core/templates.js +4 -1
  10. package/es/dev/host-page.js +5 -2
  11. package/package.json +2 -2
  12. package/skills/_shared/always.md +1 -1
  13. package/skills/_shared/references/02-design-the-material.md +10 -9
  14. package/skills/_shared/references/03-create-the-project.md +12 -11
  15. package/skills/_shared/references/08-fix-check-errors.md +1 -0
  16. package/skills/_shared/references/12-upload-with-the-material-mcp.md +2 -2
  17. package/skills/_shared/references/17-using-the-entry-template.md +44 -5
  18. package/skills/_shared/references/18-using-the-lesson-template.md +207 -0
  19. package/skills/_shared/references/19-lesson-layouts.md +2132 -0
  20. package/skills/elice-content-create/SKILL.md +4 -3
  21. package/skills/elice-content-publish/SKILL.md +3 -3
  22. package/templates/blank/template.json +1 -1
  23. package/templates/board/package.json +1 -1
  24. package/templates/board/template.json +1 -1
  25. package/templates/board/ui/board.css +4 -1
  26. package/templates/board/ui/texts.js +3 -1
  27. package/templates/entry/screens/edit.js +8 -3
  28. package/templates/entry/template.json +1 -1
  29. package/templates/lesson/README.md +71 -0
  30. package/templates/lesson/commentary.txt +7 -0
  31. package/templates/lesson/core/dom.d.ts +4 -0
  32. package/templates/lesson/core/dom.js +22 -0
  33. package/templates/lesson/core/engine.d.ts +23 -0
  34. package/templates/lesson/core/engine.js +169 -0
  35. package/templates/lesson/core/interact.d.ts +2 -0
  36. package/templates/lesson/core/interact.js +429 -0
  37. package/templates/lesson/core/layout-files.d.ts +4 -0
  38. package/templates/lesson/core/layout-files.js +9 -0
  39. package/templates/lesson/core/lesson.d.ts +95 -0
  40. package/templates/lesson/core/lesson.js +609 -0
  41. package/templates/lesson/core/sample.d.ts +4 -0
  42. package/templates/lesson/core/sample.js +128 -0
  43. package/templates/lesson/edit.html +21 -0
  44. package/templates/lesson/gitignore +4 -0
  45. package/templates/lesson/index.html +22 -0
  46. package/templates/lesson/layouts/_actions.html +1 -0
  47. package/templates/lesson/layouts/_cmp.html +1 -0
  48. package/templates/lesson/layouts/_deco-corner.html +1 -0
  49. package/templates/lesson/layouts/_deco-cover.html +1 -0
  50. package/templates/lesson/layouts/_deco-section.html +1 -0
  51. package/templates/lesson/layouts/_foot.html +1 -0
  52. package/templates/lesson/layouts/_head.html +1 -0
  53. package/templates/lesson/layouts/_media.html +1 -0
  54. package/templates/lesson/layouts/agenda.html +13 -0
  55. package/templates/lesson/layouts/bar-chart.html +14 -0
  56. package/templates/lesson/layouts/cards.html +12 -0
  57. package/templates/lesson/layouts/checklist.html +12 -0
  58. package/templates/lesson/layouts/choice-list.html +13 -0
  59. package/templates/lesson/layouts/closing.html +13 -0
  60. package/templates/lesson/layouts/compare.html +12 -0
  61. package/templates/lesson/layouts/cover-dark.html +13 -0
  62. package/templates/lesson/layouts/cover.html +15 -0
  63. package/templates/lesson/layouts/figures.html +12 -0
  64. package/templates/lesson/layouts/flow.html +13 -0
  65. package/templates/lesson/layouts/how-to.html +15 -0
  66. package/templates/lesson/layouts/image-bg.html +12 -0
  67. package/templates/lesson/layouts/image-pair.html +15 -0
  68. package/templates/lesson/layouts/image-split.html +12 -0
  69. package/templates/lesson/layouts/layers.html +12 -0
  70. package/templates/lesson/layouts/objectives.html +12 -0
  71. package/templates/lesson/layouts/ox-card.html +24 -0
  72. package/templates/lesson/layouts/ox-list.html +21 -0
  73. package/templates/lesson/layouts/process.html +14 -0
  74. package/templates/lesson/layouts/profile.html +13 -0
  75. package/templates/lesson/layouts/prompt-builder.html +18 -0
  76. package/templates/lesson/layouts/quiz.html +14 -0
  77. package/templates/lesson/layouts/quote.html +12 -0
  78. package/templates/lesson/layouts/scenario-rows.html +12 -0
  79. package/templates/lesson/layouts/section.html +14 -0
  80. package/templates/lesson/layouts/simulation.html +18 -0
  81. package/templates/lesson/layouts/stat.html +14 -0
  82. package/templates/lesson/layouts/statement.html +13 -0
  83. package/templates/lesson/layouts/stats.html +12 -0
  84. package/templates/lesson/layouts/stepper.html +13 -0
  85. package/templates/lesson/layouts/table.html +12 -0
  86. package/templates/lesson/layouts/tabs.html +13 -0
  87. package/templates/lesson/layouts/text-visual.html +16 -0
  88. package/templates/lesson/layouts/timeline.html +12 -0
  89. package/templates/lesson/layouts/toggle.html +16 -0
  90. package/templates/lesson/layouts/variables.html +14 -0
  91. package/templates/lesson/layouts/venn.html +15 -0
  92. package/templates/lesson/layouts/versus.html +12 -0
  93. package/templates/lesson/metadata.json +9 -0
  94. package/templates/lesson/package.json +15 -0
  95. package/templates/lesson/public/img/sample-chat.svg +21 -0
  96. package/templates/lesson/screens/edit.js +79 -0
  97. package/templates/lesson/screens/learn.js +56 -0
  98. package/templates/lesson/styles.css +27 -0
  99. package/templates/lesson/template.json +7 -0
  100. package/templates/lesson/ui/design.css +1103 -0
  101. package/templates/lesson/ui/fonts/PretendardVariable.woff2 +0 -0
  102. package/templates/lesson/ui/learn.css +64 -0
  103. package/templates/lesson/ui/mobile.css +492 -0
  104. package/templates/lesson/ui/reset.css +6 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: elice-content-create
3
- description: Create a new Elice Custom HTML learning material (LXP material type 17) with the ecdk CLI - a quiz, simulation, interactive explanation, guided exercise, flashcards or survey - and answer how-to questions about making one (design, screens, the screen kit and SDK, templates, the content editor, checking in ecdk dev, building the zip). Use when the person asks to make Elice or LXP learning content, a Custom HTML material or an ecdk project, or asks how to build something in one. To change a material that already exists (its questions, answers or points), use elice-content-edit.
3
+ description: Create a new Elice Custom HTML learning material (LXP material type 17) with the ecdk CLI - a page-by-page learning material (the default lesson template), a quiz, simulation, interactive explanation, guided exercise, flashcards or survey - and answer how-to questions about making one (design, screens, the screen kit and SDK, templates, the content editor, checking in ecdk dev, building the zip). Use when the person asks to make Elice or LXP learning content, a Custom HTML material or an ecdk project, or asks how to build something in one. To change a material that already exists (its questions, answers or points), use elice-content-edit.
4
4
  ---
5
5
 
6
6
  # Create an Elice learning material
@@ -16,8 +16,9 @@ Write the progress line `[n/N] …` before and after every step below (Always
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; AI grading is `rubric` saved by the edit screen's `getGrading` and the student submits only the answer, never a score computed with `mlapi`, `references/05-screen-code.md` "AI grading") 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 (seen only in the LXP editor preview; instructors on the learning page see the student 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
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`; a survey (opinions, feedback, self-assessment, no right answers): the survey template and `references/16-using-the-survey-template.md` for the settings shape, question-writing rules, personal data and where the answers are; block coding in Entry: the Entry template and `references/17-using-the-entry-template.md`, where the person builds the start and answer projects on the edit screen and you never write project JSON); 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
- - For a material that is not a quiz or a survey, 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
- - 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). One quiz material holds up to 20 questions (`references/06-using-the-quiz-template.md`): put them all in one material; only more than 20 means several quiz materials (pages). 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.
19
+ - **A learning material the person did not give a screen layout for** (explanations, guided practice, self-check, "학습 자료 만들어줘") and that is not a quiz, survey, PDF/PPT document, video, Entry or board request: use the lesson template and `references/18-using-the-lesson-template.md`. You write only the content (`.ecdk/settings.json`, the lesson content object with layouts from `references/19-lesson-layouts.md`), never screen code; `ecdk doctor` (`project.lesson`) checks it. Lesson quizzes are self-check only. In a run without a person, skip the edit-view save and report how the content reaches LXP (`references/18-using-the-lesson-template.md` step 8).
20
+ - When the person wants to design the screens themselves, or the activity needs an interaction the lesson layouts cannot do (a live simulation, a game, a custom visualization), 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 `이 자료에 맞게 바꿀 곳`.
21
+ - 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). One quiz material holds up to 20 questions (`references/06-using-the-quiz-template.md`): put them all in one material; only more than 20 means several quiz materials (pages). 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. Not for the Entry template: its settings are Entry projects the person builds on the edit screen, never written by you, also in a run without a person (`references/17-using-the-entry-template.md` "Who makes what").
21
22
  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.
22
23
  5. **Build and report.** `ecdk validate` once, then `ecdk build --json` must return `ok: true`. Report as `references/10-build.md` says.
23
24
  6. **Upload** only after the person approves: the elice-content-publish skill (it can send `.ecdk/settings.json` with the upload after the person agrees to the summary), or the person uploads `dist/content.zip` in LXP. Content not sent with the upload is entered in the LXP edit screen, then '수업 자료에 반영' at the top of the LXP edit page (`references/12-upload-with-the-material-mcp.md`, "Content and answers (settings)" and "Fallback").
@@ -13,13 +13,13 @@ 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), run `ecdk doctor` and send no `settings` while its `project.grading` or `project.quiz` 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). Adding images to a page that already has a version: merge its current settings (`get_material` or `get_draft`) into `.ecdk/settings.json` first, keeping `asset:` images as they are (`references/12-upload-with-the-material-mcp.md` item 8). 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
- 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`, the survey template → `on_access` (decided 2026-11-25; may change; its submissions are still recorded), other 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); a material that grades with AI (`mlapi.fetch`, evaluation criteria) and has no `grading`: stop and fix it first (rubric from the criteria, `references/12-upload-with-the-material-mcp.md` "AI grading"), never `on_graded` without grading, and `on_submit` only on purpose for display-only AI feedback (tell the person scores won't reflect the AI); 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.
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, except for **the lesson template**, whose hand-written content counts as checked when `ecdk doctor` `project.lesson` does not fail, so a run without a person skips the save: `references/18-using-the-lesson-template.md` step 8), run `ecdk doctor` and send no `settings` while its `project.grading` or `project.quiz` 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). Adding images to a page that already has a version: merge its current settings (`get_material` or `get_draft`) into `.ecdk/settings.json` first, keeping `asset:` images as they are (`references/12-upload-with-the-material-mcp.md` item 8). No file: suggest filling the edit view in `ecdk dev` first, or skip it. **The Entry template** (`references/17-using-the-entry-template.md`): never write or complete `.ecdk/settings.json` yourself (the start and answer projects are Entry project JSON the person builds), even when no one can open the edit screen in this run (Helpy and other unattended runs); send only a file the edit view saved, otherwise zip only. 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
+ 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`, the survey template → `on_access` (decided 2026-11-25; may change; its submissions are still recorded), other 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; the Entry template without them: no policy now, and the to-do in step 10); a material that grades with AI (`mlapi.fetch`, evaluation criteria) and has no `grading`: stop and fix it first (rubric from the criteria, `references/12-upload-with-the-material-mcp.md` "AI grading"), never `on_graded` without grading, and `on_submit` only on purpose for display-only AI feedback (tell the person scores won't reflect the AI); 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. Images or a PDF/PPTX for the settings: only now (draft ready), `create_asset_upload` per file → its `curl_command`, and put the returned `key`, never the URL, into the merged settings (`references/12-upload-with-the-material-mcp.md` "Images and documents"); no such tool: zip images, and tell the person.
20
20
  7. **Approve.** Show what changes (page, title, whether the content and answers go with it or are entered on the LXP edit screen after saving, the completion policy) and the draft `preview_urls`. Saving is visible to learners at once if the page is open. Wait for an explicit yes.
21
21
  8. **Save.** One `save_draft` with `material_draft_id`, `expected_current_version_id` and `payload` holding only keys its schema lists: `settings` (the content of `.ecdk/settings.json`) only when step 3 got a yes, `completion_policy` only when step 4 got a yes, and `title` · `icon` when the page has none (a new page; icon: `references/12-upload-with-the-material-mcp.md` "Icon"), all in this one save so no extra version is made. On `MATERIAL_CHANGED` or `MATERIAL_GRADING_REQUIRED`, stop and tell the person (`references/12-upload-with-the-material-mcp.md` "Errors and warnings").
22
22
  9. **Check.** Show any `warnings` in the result to the person close to word for word. `get_material` must show what was sent: the settings (same keys, item count and `grading.type` as the summary), the completion policy, the title. If not, tell the person and use the fallback. Without settings: tell the person to enter the content and answers in the LXP edit screen, save with its own button, then press '수업 자료에 반영' at the top of the LXP edit page (`references/12-upload-with-the-material-mcp.md` "Fallback"); for a graded material, then pick 답안 확인 후 완료 in the '설정' panel at the top of the LXP edit page, or offer to set `on_graded` with `update_material` (when it takes `completion_policy`) once `get_material` shows the grading. No `completion_policy` key: tell the person which policy to pick in that '설정' panel. `update_material` stopping with `MATERIAL_DRAFT_PENDING`: someone's upload is not saved; explain and ask whether to save it (`save_draft`) or discard it (`discard_draft`), never pick for them.
23
- 10. **Finish.** Write `.ecdk/link.json` as `{ "org": …, "lecture_page_id": …, "version_id": … }` so the next upload goes to the same page. Report 기관 · 과목 · 수업 · 페이지 (names and ids), the LXP URL, the saved version, whether content and answers were sent, the completion policy (only `on_graded` grades: a quiz with `on_submit` completes on any submission and shows "제출했어요.", not a score), any `warnings`, and whether the page is closed to learners (a new page stays closed until the person opens it in LXP). Later changes to the title, icon, settings or policy of this page without a new zip go through `update_material`.
23
+ 10. **Finish.** Write `.ecdk/link.json` as `{ "org": …, "lecture_page_id": …, "version_id": … }` so the next upload goes to the same page. Report 기관 · 과목 · 수업 · 페이지 (names and ids), the LXP URL, the saved version, whether content and answers were sent, the completion policy (only `on_graded` grades: a quiz with `on_submit` completes on any submission and shows "제출했어요.", not a score), any `warnings`, and whether the page is closed to learners (a new page stays closed until the person opens it in LXP). **The Entry template uploaded without settings** (always the case in a run without a person): the report is not "done"; end it with a remaining to-do, in the person's language, to open the LXP edit screen, build the start project ('시작 화면' tab) and the answer project ('채점 화면' tab), pick the grading (일반 채점 · AI 채점, with the AI criteria you drafted as text to type in) in the '설정' tab, press '초안으로 저장' and then '수업 자료에 반영', and for grading pick '답안 확인 후 완료' (`on_graded`) in the '설정' panel at the top of the LXP edit page (`references/17-using-the-entry-template.md` "Runs without a person"). Later changes to the title, icon, settings or policy of this page without a new zip go through `update_material`.
24
24
 
25
25
  {{version}}
@@ -2,5 +2,5 @@
2
2
  "name": "blank",
3
3
  "version": "1.2.6",
4
4
  "title": "빈 자료",
5
- "description": "퀴즈가 아닌 모든 자료(시뮬레이션 · 시각화 · 활동 · 설명 · 플래시카드 · 설문)를 직접 만들 때. 예제 \"예측하고 확인하기\"(막대 예측 · 정답 보기)와 내용 JSON 편집기(폼 보기 · 코드 보기)로 시작 (완료 정책은 LXP 자료 편집 화면의 '설정'에서 교육자가 고름)"
5
+ "description": "화면을 직접 짜야 하는 자료(시뮬레이션 · 게임 · 시각화 등, 레이아웃에 내용만 채우는 학습 자료는 lesson). 예제 \"예측하고 확인하기\"(막대 예측 · 정답 보기)와 내용 JSON 편집기(폼 보기 · 코드 보기)로 시작 (완료 정책은 LXP 자료 편집 화면의 '설정'에서 교육자가 고름)"
6
6
  }
@@ -7,7 +7,7 @@
7
7
  "validate": "ecdk validate"
8
8
  },
9
9
  "dependencies": {
10
- "@eliceio/cdk": "workspace:^1.7.0"
10
+ "@eliceio/cdk": "workspace:^1.8.0"
11
11
  },
12
12
  "ecdk": {}
13
13
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "board",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "title": "참여형 보드",
5
5
  "description": "카드를 올려 함께 생각을 나눕니다",
6
6
  "catalog": {
@@ -1211,6 +1211,7 @@ body.ec-edit-page:has(.bw) .ec-submitbar {
1211
1211
  white-space: nowrap;
1212
1212
  }
1213
1213
  .bw-filehint {
1214
+ white-space: pre-line;
1214
1215
  margin: -4px 0 0 4px;
1215
1216
  font-size: 12px;
1216
1217
  color: var(--bw-text2);
@@ -1265,9 +1266,11 @@ body.ec-edit-page:has(.bw) .ec-submitbar {
1265
1266
  color: var(--bw-text3);
1266
1267
  font-weight: 500;
1267
1268
  }
1268
- /* 지우기 · 메뉴 버튼(오른쪽 위)이 맨 위 그림을 가리지 않게 */
1269
+ /* 지우기 · 메뉴 버튼(오른쪽 위)이 맨 위 그림에 묻히지 않게. 한 번 누른 '삭제'(빨강, .is-confirm)는 덮지 않음 */
1269
1270
  .bw-card-x:has(+ .bw-card-media) {
1270
1271
  z-index: 1;
1272
+ }
1273
+ .bw-card-x:not(.is-confirm):has(+ .bw-card-media) {
1271
1274
  background: rgba(255, 255, 255, 0.85);
1272
1275
  border-radius: 50%;
1273
1276
  }
@@ -115,7 +115,9 @@ export const texts = {
115
115
  submit: '올리기',
116
116
  /** 파일 올리기 (그림 · PDF, 종류 · 크기는 서버 기준) */
117
117
  pickFile: '파일 올리기',
118
- fileHint: '이미지(PNG, JPG, WebP)는 10MB, PDF는 20MB까지 올릴 수 있어요. 끌어다 놓거나 붙여넣어도 돼요.',
118
+ /** 줄바꿈(\n)은 그대로 보임 */
119
+ fileHint:
120
+ '지원 형식: 이미지(PNG, JPG, WebP) 최대 10MB, PDF 최대 20MB\n파일을 끌어다 놓거나 붙여넣을 수도 있습니다.',
119
121
  clearFile: '고른 파일 지우기',
120
122
  sending: '카드를 추가하는 중',
121
123
  uploading: percent => `파일을 올리는 중 ${percent}%`,
@@ -63,12 +63,17 @@ const workspaces = { start: null, answer: null };
63
63
  const held = { start: null, answer: null };
64
64
  const heldListeners = { start: new Set(), answer: new Set() };
65
65
  /** 정답 작품 워크스페이스가 처음 열 작품: 저장된 정답 → 없으면 지금 시작 화면 작품 (오브젝트 id가 같아야 AI 채점 기준이 맞음) */
66
- const answerStart = async () =>
67
- savedAnswer ?? (await workspaces.start?.getProject().catch(() => null)) ?? startProject;
66
+ const answerStart = async () => savedAnswer ?? (await startNow());
67
+ /** 지금 시작 화면 작품: 시작 화면 워크스페이스를 띄웠으면 거기서(저장 전 고친 것 포함), 아니면 저장된 것 */
68
+ async function startNow() {
69
+ return (await workspaces.start?.getProject().catch(() => null)) ?? startProject;
70
+ }
68
71
 
72
+ // getInitialProject: 워크스페이스 [작품 불러오기] > [시작 상태로 작품 초기화하기]가 묻는 작품.
73
+ // 정답 작품 탭에서는 저장된 정답이 아니라 지금 시작 화면을 준다 (시작 화면에 블록을 더해 정답을 만들므로)
69
74
  const providers = {
70
75
  start: { getProject: () => startProject, getInitialProject: () => startProject },
71
- answer: { getProject: answerStart, getInitialProject: answerStart },
76
+ answer: { getProject: answerStart, getInitialProject: startNow },
72
77
  };
73
78
 
74
79
  function workspace(name) {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "entry",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "title": "엔트리",
5
5
  "description": "엔트리로 블록 코딩 실습을 합니다",
6
6
  "catalog": {
@@ -0,0 +1,71 @@
1
+ # {{name}}
2
+
3
+ Elice Custom HTML 학습자료 프로젝트입니다. 학생이 쪽을 넘기며 읽고, 값을 입력하고, 프롬프트를 복사하고, 확인 문제로 스스로 점검하는 **학습 자료(페이지형)** 템플릿입니다. 디자인(보라 `#673cda` · Pretendard · 16:9)과 레이아웃 39종은 정해져 있고, 자료마다 바꾸는 것은 **내용(JSON)뿐**입니다. 화면 코드나 CSS를 새로 쓰지 않습니다.
4
+
5
+ ## 고치는 곳
6
+
7
+ | 파일 | 내용 |
8
+ | ---------------------------------- | ---------------------------------------------------------------------------------------------------------- |
9
+ | 편집 화면 (`ecdk dev`의 내용 편집) | 내용 `{ meta, slides }`. 저장하면 `.ecdk/settings.json` (zip에는 들어가지 않음, LXP에서는 자료의 settings) |
10
+ | `public/img/` | 슬라이드 이미지. 내용에는 `public/` 없이 `"image": "img/파일.png"`로 씀 (외부 주소는 콘텐츠 CSP가 막음) |
11
+ | `commentary.txt` | 학습 참고 내용 (LXP AI 헬피가 읽음, 정답은 적지 않음) |
12
+ | `metadata.json` | 화면 구성(학생 · 편집 화면, 교육자 화면은 꺼 둠). `ecdk build`가 `build`만 채움 |
13
+ | `styles.css` | 이 콘텐츠만의 스타일 (보통 고치지 않음, 색은 내용 `meta.key_color`) |
14
+
15
+ 고치지 않는 곳: `layouts/`(레이아웃 틀 · 슬롯 규칙, 빌드 때 화면 코드에 글로 묶이고 zip에는 파일로 들어가지 않음), `core/`(틀 엔진 · 검사 · 실습 동작), `ui/`(디자인 · 폰트), `screens/`, `lib/`(화면 키트). 원하는 모양의 레이아웃이 없으면 템플릿 기능 요청으로 알립니다.
16
+
17
+ ## 내용 모양
18
+
19
+ ```json
20
+ {
21
+ "meta": {
22
+ "title": "자료 제목",
23
+ "variables": [{ "key": "org", "label": "기관 이름", "default": "my-org" }]
24
+ },
25
+ "slides": [
26
+ { "layout": "cover", "data": { "title": "신규 기능\n도입 가이드", "subtitle": "도입 전 확인 항목과 적용 절차" } },
27
+ { "layout": "cards", "data": { "title": "세 가지 방법 비교", "cols": "3", "items": [{ "title": "방법 A", "desc": "설명 문장입니다." }] } }
28
+ ]
29
+ }
30
+ ```
31
+
32
+ - 레이아웃 이름 · 슬롯 · 글자 수 상한은 스킬 참고 문서 19(레이아웃), 고르는 법 · 문체 · 구성 규칙은 18에 있습니다 (`ecdk setup --only skills`로 설치한 스킬의 `references/`).
33
+ - 글 안에서 `**강조**`는 보라 굵은 글씨, `` `코드` ``는 코드 서식, `\n`은 줄바꿈, `[[key]]`는 `meta.variables`의 변수(학생이 `variables` 쪽에서 입력한 값으로 바뀜)입니다.
34
+ - 편집 화면의 견본(9장, "생성형 AI에게 질문 잘하기")은 바꿔 쓰라고 넣은 예시입니다. 저장하기 전에는 학생 화면이 "학습 자료를 준비하고 있어요" 안내를 보입니다.
35
+
36
+ ## 검사
37
+
38
+ | 어디서 | 무엇을 |
39
+ | ------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
40
+ | 편집 화면 저장 | 오류(필수 슬롯 · 항목 수 · 허용값 · 없는 레이아웃 · 퀴즈 정답 번호 · 외부 이미지 · `meta` 값)가 있으면 저장을 막음. 글자 수 · 문체 경고는 아래 목록에만 |
41
+ | `ecdk doctor` (`project.lesson`) | 같은 검사를 `.ecdk/settings.json`에 다시 돌림 + 이미지 파일이 `public/`에 있는지. 내용을 손으로(AI가) 고쳤으면 꼭 돌리고, 편집 화면에서 한 번 저장 |
42
+ | `ecdk dev --check --step all` | 쪽마다 화면 그림 (`.ecdk/screens/learn-desktop-step<n>.png`): 글 넘침 · 빈 이미지 자리 · 제목 줄바꿈을 눈으로 |
43
+
44
+ 경고는 읽고 판단합니다. 넘치면 글자 크기가 아니라 글을 줄이거나 쪽을 나눕니다.
45
+
46
+ ## 진행과 제출
47
+
48
+ - **쪽 넘기기**: 양옆 버튼 · ← → 키 · 터치로 밀기. 왼쪽 아래 `n / N`. 첫 쪽의 이전 · 마지막 쪽의 다음은 LXP 이전 · 다음 수업 자료로 갑니다 (키트 스테퍼 `app.useStepper`).
49
+ - **제출 없음**: 퀴즈(`quiz` · `choice-list` · `ox-list` · `ox-card`) · 시뮬레이션 미션은 **자가 확인**입니다. 화면 안에서 정오와 해설만 보이고 서버에 제출 · 채점하지 않습니다. 정답은 내용(settings)에 있어 학생도 읽을 수 있으니, 성적에 들어가는 문제는 퀴즈 템플릿으로 만듭니다.
50
+ - **완료 정책**: LXP 자료 편집 화면 '설정'에서 **열면 완료**(`on_access`)를 고릅니다 (제출이 없어 `on_submit` · `on_graded`로는 완료되지 않음).
51
+ - 입력한 변수 값 · 체크리스트 체크는 그 화면에만 있고 저장하지 않습니다. 강의 노트(`notes`)는 내용에 남지만 학생 화면에는 보이지 않습니다.
52
+
53
+ ## 원본(디자이너 deck-kit)과 다른 점
54
+
55
+ 디자이너 deck-kit(build.py · deck.css · deck.js · layouts)를 옮겼습니다. 레이아웃 틀은 `layouts/*.html`(원본에서 "덱" 표현 · 머리글 변수 이름 `lesson_title`만 바꿈, 맨 위 `<!--SCHEMA {...}-->`가 슬롯 규칙), 디자인은 `ui/design.css`(원본 deck.css, 틀 id만 `#lesson`)입니다. 틀 엔진 · 검사 문구는 원본과 같은 결과를 냅니다.
56
+
57
+ - 쪽 넘기기 버튼 · 쪽 번호는 키트 스테퍼(LXP 이전 · 다음 자료와 이어짐)가 그리고, 원본의 원형 좌우 버튼 · 슬라이드 안 쪽 번호는 쓰지 않습니다. 슬라이드는 양옆 버튼 자리를 비우고 16:9로 화면에 맞춥니다.
58
+ - 전체 보기(O) · 강의 노트 패널(N) · 전체 화면(F) 키, 넘침 검사 · 캡처 · PDF는 없습니다.
59
+ - 휴대폰 · 세로 태블릿(콘텐츠 폭 768px 미만)에서는 쪽을 통째로 줄이지 않고 세로로 풀어 쌓습니다(`ui/mobile.css`, 원본에는 없음): 글씨 · 버튼은 원래 크기, 여러 열 · 좌우 배치는 위아래로, 장식은 숨김, 표는 가로 스크롤, 화면은 세로로 스크롤됩니다. 넓은 화면은 원본 16:9 그대로입니다. 글이 길거나 그림이 세로로 길면 휴대폰에서 쪽이 길어집니다.
60
+ - 변수 값을 브라우저 저장소에 남기지 않습니다. 복사할 때 줄바꿈 방지 글자(보이지 않는 글자)를 뺍니다.
61
+ - 이미지는 zip 안 파일(`public/`)만 씁니다 (원본 `--embed-images` · CDN 폰트 옵션 없음).
62
+
63
+ ## 명령
64
+
65
+ ```sh
66
+ ecdk dev # 로컬에서 운영과 같은 조건으로 보기 (http://localhost:4170)
67
+ ecdk doctor # 환경 · 프로젝트 점검 (project.lesson: 내용 검사)
68
+ ecdk build # 검사 후 dist/content.zip (편집 화면에 올릴 파일)
69
+ ```
70
+
71
+ 폰트: Pretendard (SIL Open Font License 1.1, `ui/fonts/PretendardVariable.woff2`).
@@ -0,0 +1,7 @@
1
+ 이 자료에서 다루는 핵심 개념, 학생이 하는 활동, 문제의 의도를 적어 주세요. LXP AI 헬피가 이 내용을 참고해 답합니다.
2
+ 정답은 적지 않습니다: zip 안 파일이라 학생도 읽을 수 있습니다.
3
+
4
+ (아래는 템플릿 예제 "생성형 AI에게 질문 잘하기"의 설명입니다. 자료를 만들면 이 자료에 맞게 모두 다시 씁니다.)
5
+ 핵심 개념: 생성형 AI에게 하는 질문에 역할, 맥락, 할 일, 형식을 담으면 바로 쓸 수 있는 답을 얻는다.
6
+ 학생 활동: 쪽을 넘기며 네 요소와 고치기 전후 질문을 비교하고, 자기 주제를 입력해 완성된 질문을 복사해 써 본다. 확인 문제로 요소의 역할을 스스로 점검한다.
7
+ 의도: 질문 요소를 외우기보다 막연한 질문을 직접 고쳐 보게 한다. 확인 문제는 자가 확인이고 채점하지 않는다.
@@ -0,0 +1,4 @@
1
+ import type { BuiltLesson } from './lesson.js';
2
+
3
+ /** 자료 틀(#lesson) + 슬라이드 요소 (슬라이드는 모두 hidden, 키트 스테퍼가 하나씩 보인다) */
4
+ export declare function mountLesson(lesson: BuiltLesson): HTMLElement;
@@ -0,0 +1,22 @@
1
+ // 조립한 학습 자료(core/lesson.js buildLesson 결과)을 화면 요소로. 슬라이드 HTML의 값은 모두 core/engine.js가 이스케이프했다.
2
+
3
+ /** 자료 틀(#lesson) + 슬라이드. 원본 디자인(ui/design.css)이 읽는 data-* 속성을 붙인다 */
4
+ export function mountLesson(lesson) {
5
+ const el = document.createElement('div');
6
+ el.id = 'lesson';
7
+ const { attrs } = lesson;
8
+ el.dataset.title = attrs.title;
9
+ el.dataset.header = attrs.header;
10
+ el.dataset.hright = attrs.hright;
11
+ el.dataset.bg = attrs.bg;
12
+ if (attrs.single) el.dataset.single = 'true';
13
+ if (attrs.key) el.style.setProperty('--key', attrs.key);
14
+ if (lesson.title) el.setAttribute('aria-label', lesson.title);
15
+ const template = document.createElement('template');
16
+ // 틀 엔진이 만든 글: 내용 값은 모두 이스케이프됨 (core/engine.js fmt · escapeHtml)
17
+ // ecdk-ignore-next-line sec.html-injection
18
+ template.innerHTML = lesson.slides.map(s => s.html).join('\n');
19
+ for (const s of template.content.querySelectorAll('section.slide')) s.hidden = true;
20
+ el.append(template.content);
21
+ return el;
22
+ }
@@ -0,0 +1,23 @@
1
+ // core/engine.js 타입 (편집기 자동완성 · 테스트용). engine.js와 같이 고칩니다.
2
+
3
+ export type TemplateNode =
4
+ | ['t', string]
5
+ | ['r', string]
6
+ | ['v', string]
7
+ | ['a', string]
8
+ | ['p', string]
9
+ | ['s', string, boolean, TemplateNode[]];
10
+
11
+ /** 틀 글 → 노드 목록 (닫는 태그가 맞지 않으면 오류) */
12
+ export declare function parse(src: string): TemplateNode[];
13
+ /** 값이 있는지 (없음 · false · '' · [] · {}는 없음) */
14
+ export declare function truthy(v: unknown): boolean;
15
+ export declare function escapeHtml(s: unknown, quote?: boolean): string;
16
+ /** 본문 서식: 이스케이프 · [[변수]] · **강조** · `코드` · 줄바꿈 · 줄 끝 두 글자 묶기 */
17
+ export declare function fmt(v: unknown, vars?: Record<string, string>): string;
18
+ /** 틀 노드에 값을 채운 HTML 글 */
19
+ export declare function render(
20
+ nodes: TemplateNode[],
21
+ ctx: Record<string, unknown>,
22
+ env?: { partials?: Record<string, TemplateNode[]>; vars?: Record<string, string> }
23
+ ): string;
@@ -0,0 +1,169 @@
1
+ // 학습 자료(lesson) 템플릿의 틀 엔진 (Mustache 부분집합, 디자이너 deck-kit build.py를 옮긴 것). 레이아웃 틀(layouts/*.html)에 슬라이드 내용을 채워 HTML 글을 만든다.
2
+ // 브라우저 · Node 모두에서 돈다 (DOM을 쓰지 않음). 모든 값은 여기서 이스케이프하므로 틀 밖에서 HTML을 섞지 않는다.
3
+ //
4
+ // {{x}} 본문이면 서식 적용(fmt: **강조** · `코드` · 줄바꿈 · [[변수]] · 줄 끝 두 글자 묶기), 태그 안(속성 값)이면 이스케이프만
5
+ // {{{x}}} 원문 그대로 (틀이 만든 값에만 쓴다)
6
+ // {{=x}} 속성용 이스케이프
7
+ // {{#x}}…{{/x}} 목록이면 반복, 값이 있으면 한 번 / {{^x}}…{{/x}} 값이 없을 때 / {{#a|b}} a나 b가 있을 때
8
+ // {{>name}} 부분 틀 (layouts/_name.html)
9
+ // 반복 안에서 {{.}} {{@n}} {{@nn}} {{@first}} {{@last}}
10
+
11
+ const TOK = /\{\{\{\s*([^{}]+?)\s*\}\}\}|\{\{\s*([#^/>=]?)\s*([^{}]+?)\s*\}\}/g;
12
+
13
+ /** 틀 글 → 노드 목록. 노드: ['t', 글] · ['r', 이름] · ['v', 이름] · ['a', 이름] · ['p', 부분 틀] · ['s', 이름, 반대인지, 자식] */
14
+ export function parse(src) {
15
+ const root = [];
16
+ const stack = [{ name: '', children: root }];
17
+ let pos = 0;
18
+ for (const m of src.matchAll(TOK)) {
19
+ const top = stack[stack.length - 1];
20
+ if (m.index > pos) top.children.push(['t', src.slice(pos, m.index)]);
21
+ pos = m.index + m[0].length;
22
+ if (m[1] !== undefined) {
23
+ top.children.push(['r', m[1]]);
24
+ continue;
25
+ }
26
+ const kind = m[2];
27
+ const name = m[3].trim();
28
+ if (kind === '#' || kind === '^') {
29
+ const node = ['s', name, kind === '^', []];
30
+ top.children.push(node);
31
+ stack.push({ name, children: node[3] });
32
+ } else if (kind === '/') {
33
+ if (top.name !== name)
34
+ throw new Error(`닫는 태그 불일치: {{/${name}}} (열린 태그: ${top.name})`);
35
+ stack.pop();
36
+ } else if (kind === '>') top.children.push(['p', name]);
37
+ else if (kind === '=') top.children.push(['a', name]);
38
+ else top.children.push(['v', name]);
39
+ }
40
+ if (stack.length !== 1) throw new Error(`닫히지 않은 태그: ${stack[stack.length - 1].name}`);
41
+ if (pos < src.length) root.push(['t', src.slice(pos)]);
42
+ return root;
43
+ }
44
+
45
+ /** 값이 있는지 (없음 · false · '' · [] · {}는 없음) */
46
+ export function truthy(v) {
47
+ if (v === null || v === undefined || v === false || v === '') return false;
48
+ if (Array.isArray(v)) return v.length > 0;
49
+ if (typeof v === 'object') return Object.keys(v).length > 0;
50
+ return true;
51
+ }
52
+
53
+ /** Python html.escape와 같게: & < >, quote면 " '도 */
54
+ export function escapeHtml(s, quote = false) {
55
+ const out = String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
56
+ return quote ? out.replace(/"/g, '&quot;').replace(/'/g, '&#x27;') : out;
57
+ }
58
+
59
+ /** 값 → 화면 글. Python str()처럼 true/false는 True/False가 아니라 그대로 쓰지 않도록 글로만 쓴다 */
60
+ function str(v) {
61
+ if (v === null || v === undefined) return '';
62
+ if (v === true) return 'True';
63
+ if (v === false) return 'False';
64
+ return String(v);
65
+ }
66
+
67
+ const WORD_JOINER = '⁠';
68
+
69
+ /**
70
+ * 본문 서식: 이스케이프 → [[변수]] 자리 → **강조** → `코드` → 줄바꿈 → 줄 끝 두 글자 사이 줄바꿈 막기(한 글자만 남는 줄 방지).
71
+ * vars: 변수 key → 입력 전에 보일 값 (meta.variables)
72
+ */
73
+ export function fmt(v, vars = {}) {
74
+ if (v === null || v === undefined) return '';
75
+ let s = escapeHtml(str(v));
76
+ s = s.replace(/\[\[([a-z0-9_-]+)\]\]/g, (m, key) =>
77
+ Object.hasOwn(vars, key)
78
+ ? `<span class="var" data-var="${key}" data-default="${escapeHtml(vars[key], true)}">${escapeHtml(vars[key])}</span>`
79
+ : m
80
+ );
81
+ s = s.replace(/\*\*([\s\S]+?)\*\*/g, '<strong>$1</strong>');
82
+ s = s.replace(/`(.+?)`/g, '<code>$1</code>');
83
+ s = s.replace(/\n/g, '<br>');
84
+ return s.replace(
85
+ /((?:&[a-z]+;|[^\s<>&;]))((?:&[a-z]+;|[^\s<>&;]))((?:<\/[a-z]+>)*)(?=<br>|$)/gu,
86
+ `$1${WORD_JOINER}$2$3`
87
+ );
88
+ }
89
+
90
+ /** 이름 → 값. 안쪽 틀부터 찾는다 (반복 항목 → 슬라이드 → 공통) */
91
+ function lookup(name, frames) {
92
+ if (name === '.') return frames[frames.length - 1].value;
93
+ if (name.startsWith('@')) {
94
+ for (let i = frames.length - 1; i >= 0; i--)
95
+ if (frames[i].meta) return frames[i].meta[name.slice(1)];
96
+ return undefined;
97
+ }
98
+ for (let i = frames.length - 1; i >= 0; i--) {
99
+ const v = frames[i].value;
100
+ if (v && typeof v === 'object' && !Array.isArray(v) && Object.hasOwn(v, name)) return v[name];
101
+ }
102
+ return undefined;
103
+ }
104
+
105
+ /**
106
+ * 노드를 글로. env: { partials: 이름 → 노드 목록, vars: 변수 기본값 }
107
+ * 속성 안인지는 지금까지 쓴 글의 마지막 '<'가 마지막 '>'보다 뒤인지로 본다 (원본 build.py와 같은 방식)
108
+ */
109
+ function renderNodes(nodes, frames, env, out) {
110
+ for (const n of nodes) {
111
+ const kind = n[0];
112
+ if (kind === 't') out.push(n[1]);
113
+ else if (kind === 'r') out.push(str(lookup(n[1], frames)));
114
+ else if (kind === 'v') {
115
+ const v = lookup(n[1], frames);
116
+ if (insideTag(out)) out.push(v === null || v === undefined ? '' : escapeHtml(str(v), true));
117
+ else out.push(fmt(v, env.vars));
118
+ } else if (kind === 'a') {
119
+ const v = lookup(n[1], frames);
120
+ out.push(v === null || v === undefined ? '' : escapeHtml(str(v), true));
121
+ } else if (kind === 'p') {
122
+ const partial = env.partials[n[1]];
123
+ if (!partial) throw new Error(`없는 부분 틀: ${n[1]}`);
124
+ renderNodes(partial, frames, env, out);
125
+ } else {
126
+ const [, name, inverted, children] = n;
127
+ const v = name.includes('|')
128
+ ? name.split('|').some(x => truthy(lookup(x.trim(), frames)))
129
+ : lookup(name, frames);
130
+ if (inverted) {
131
+ if (!truthy(v)) renderNodes(children, frames, env, out);
132
+ } else if (Array.isArray(v)) {
133
+ v.forEach((item, i) => {
134
+ const meta = {
135
+ n: i + 1,
136
+ nn: String(i + 1).padStart(2, '0'),
137
+ first: i === 0,
138
+ last: i === v.length - 1,
139
+ };
140
+ renderNodes(children, [...frames, { value: item, meta }], env, out);
141
+ });
142
+ } else if (truthy(v)) renderNodes(children, [...frames, { value: v }], env, out);
143
+ }
144
+ }
145
+ }
146
+
147
+ function insideTag(out) {
148
+ // 마지막 몇 조각만 보면 충분하다 (태그 하나는 몇 조각 안에 끝남). 긴 슬라이드에서 전체를 다시 합치지 않게
149
+ for (let i = out.length - 1; i >= 0; i--) {
150
+ const s = out[i];
151
+ const lt = s.lastIndexOf('<');
152
+ const gt = s.lastIndexOf('>');
153
+ if (lt > gt) return true;
154
+ if (gt > lt) return false;
155
+ }
156
+ return false;
157
+ }
158
+
159
+ /** 틀 노드에 값(ctx)을 채운 HTML 글 */
160
+ export function render(nodes, ctx, env) {
161
+ const out = [];
162
+ renderNodes(
163
+ nodes,
164
+ [{ value: ctx }],
165
+ { partials: env?.partials ?? {}, vars: env?.vars ?? {} },
166
+ out
167
+ );
168
+ return out.join('');
169
+ }
@@ -0,0 +1,2 @@
1
+ /** 학습 자료의 실습 요소(복사 · 변수 · 프롬프트 빌더 · 탭 · 퀴즈 · OX · 시뮬레이션 · 토글 · 단계 칩)를 켠다 */
2
+ export declare function setupInteractions(root: Element, vars?: Record<string, string>): void;