@eliceio/cdk-cli 1.2.1 → 1.3.0-contenttypes.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/README.md +59 -50
  2. package/es/cli.js +11 -2
  3. package/es/commands/build/index.js +12 -0
  4. package/es/commands/create/index.js +1 -0
  5. package/es/commands/create/scaffold.d.ts +2 -2
  6. package/es/commands/create/scaffold.js +3 -3
  7. package/es/commands/dev/index.d.ts +10 -1
  8. package/es/commands/dev/index.js +47 -7
  9. package/es/core/config.d.ts +20 -9
  10. package/es/core/config.js +53 -12
  11. package/es/core/project-check.d.ts +3 -2
  12. package/es/core/project-check.js +14 -3
  13. package/es/core/regex.d.ts +11 -0
  14. package/es/core/regex.js +41 -0
  15. package/es/core/sandbox.d.ts +26 -0
  16. package/es/core/sandbox.js +240 -30
  17. package/es/dev/check.d.ts +30 -0
  18. package/es/dev/check.js +224 -34
  19. package/es/dev/grading.d.ts +20 -1
  20. package/es/dev/grading.js +38 -7
  21. package/es/dev/host-page.js +1 -1
  22. package/es/dev/mock-api.d.ts +3 -1
  23. package/es/dev/mock-api.js +20 -11
  24. package/es/engines/vite/index.js +1 -1
  25. package/es/engines/vite/plugin.d.ts +2 -0
  26. package/es/engines/vite/plugin.js +33 -5
  27. package/es/rules/answers.d.ts +13 -0
  28. package/es/rules/answers.js +94 -0
  29. package/es/rules/check.js +70 -1
  30. package/es/rules/index.d.ts +1 -0
  31. package/es/rules/index.js +1 -0
  32. package/es/rules/size.d.ts +31 -0
  33. package/es/rules/size.js +58 -0
  34. package/es/rules/types.d.ts +12 -0
  35. package/es/rules.json.js +2 -2
  36. package/package.json +2 -2
  37. package/rules.json +32 -3
  38. package/skills/_shared/always.md +3 -3
  39. package/skills/_shared/references/00-what-the-person-decides.md +1 -1
  40. package/skills/_shared/references/02-design-the-material.md +10 -7
  41. package/skills/_shared/references/03-create-the-project.md +2 -1
  42. package/skills/_shared/references/05-screen-code.md +49 -22
  43. package/skills/_shared/references/06-using-the-quiz-template.md +7 -6
  44. package/skills/_shared/references/08-fix-check-errors.md +23 -22
  45. package/skills/_shared/references/09-check.md +7 -6
  46. package/skills/_shared/references/12-upload-with-the-material-mcp.md +13 -13
  47. package/skills/_shared/references/13-edit-screen-design.md +122 -0
  48. package/skills/_shared/references/14-layouts.md +96 -0
  49. package/skills/elice-content-check/SKILL.md +2 -2
  50. package/skills/elice-content-create/SKILL.md +1 -1
  51. package/skills/elice-content-migrate/SKILL.md +1 -1
  52. package/templates/_shared/lib/cdk-mock.d.ts +30 -3
  53. package/templates/_shared/lib/cdk-mock.js +88 -15
  54. package/templates/_shared/lib/elice-content-editor.js +89 -58
  55. package/templates/_shared/lib/elice-content.css +1313 -126
  56. package/templates/_shared/lib/elice-content.d.ts +162 -23
  57. package/templates/_shared/lib/elice-content.js +863 -82
  58. package/templates/_shared/lib/icons/empty-content.d.ts +2 -0
  59. package/templates/_shared/lib/icons/empty-content.js +11 -0
  60. package/templates/_shared/lib/icons/file-video.d.ts +2 -0
  61. package/templates/_shared/lib/icons/file-video.js +11 -0
  62. package/templates/_shared/lib/icons/file.d.ts +2 -0
  63. package/templates/_shared/lib/icons/file.js +11 -0
  64. package/templates/blank/README.md +5 -3
  65. package/templates/blank/edit.html +8 -2
  66. package/templates/blank/index.html +6 -1
  67. package/templates/blank/instructor.html +6 -1
  68. package/templates/blank/template.json +1 -1
  69. package/templates/quiz/README.md +28 -12
  70. package/templates/quiz/core/behaviors.d.ts +13 -7
  71. package/templates/quiz/core/behaviors.js +36 -51
  72. package/templates/quiz/core/editor.d.ts +10 -0
  73. package/templates/quiz/core/editor.js +334 -8
  74. package/templates/quiz/core/markdown.d.ts +4 -0
  75. package/templates/quiz/core/markdown.js +65 -11
  76. package/templates/quiz/core/model.d.ts +34 -1
  77. package/templates/quiz/core/model.js +86 -5
  78. package/templates/quiz/core/rich-text.d.ts +19 -0
  79. package/templates/quiz/core/rich-text.js +521 -0
  80. package/templates/quiz/edit.html +12 -3
  81. package/templates/quiz/index.html +12 -3
  82. package/templates/quiz/screens/edit.js +217 -48
  83. package/templates/quiz/screens/learn.js +90 -14
  84. package/templates/quiz/styles.css +840 -678
  85. package/templates/quiz/template.json +9 -2
  86. package/templates/quiz/ui/templates/edit.d.ts +18 -5
  87. package/templates/quiz/ui/templates/edit.js +309 -71
  88. package/templates/quiz/ui/templates/group.js +19 -8
  89. package/templates/quiz/ui/templates/order.js +25 -24
  90. package/templates/quiz/ui/templates/page.js +19 -8
  91. package/templates/quiz/ui/templates/question.js +2 -2
  92. package/templates/quiz/ui/texts.js +72 -25
  93. package/templates/quiz/ui/theme.css +8 -9
  94. package/templates/steps/README.md +77 -0
  95. package/templates/steps/commentary.txt +7 -0
  96. package/templates/steps/edit.html +21 -0
  97. package/templates/steps/gitignore +4 -0
  98. package/templates/steps/index.html +69 -0
  99. package/templates/steps/metadata.json +9 -0
  100. package/templates/steps/package.json +13 -0
  101. package/templates/steps/screens/edit.js +32 -0
  102. package/templates/steps/screens/learn.js +108 -0
  103. package/templates/steps/styles.css +54 -0
  104. package/templates/steps/template.json +6 -0
@@ -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, paging). 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.
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 "아직 내용이 없습니다": 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").
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`).
@@ -22,6 +22,10 @@ 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';
25
29
  }>;
26
30
  export declare class EliceCDKError extends Error {
27
31
  static code: typeof ErrorCode;
@@ -33,6 +37,8 @@ export declare class EliceCDKError extends Error {
33
37
  export interface SubmitResult {
34
38
  isCorrect: boolean | null;
35
39
  score: number | null;
40
+ /** partial_pattern 문항별 맞음 (answer_key 순서, 없는 답은 false). pattern · rubric · 채점 없음은 [] (옛 서버는 없음) */
41
+ answerCorrectness?: boolean[];
36
42
  }
37
43
 
38
44
  export interface Submission extends SubmitResult {
@@ -43,12 +49,18 @@ export interface Submission extends SubmitResult {
43
49
  answer: unknown;
44
50
  }
45
51
 
46
- /** 채점 설정을 서버 모양으로 ({ type: pattern | rubric }). camelCase answerKey도 받는다. 채점 방식이 아니면 null */
52
+ /** 채점 설정을 서버 모양으로 ({ type: pattern | partial_pattern | rubric }). camelCase answerKey도 받는다. 채점 방식이 아니면 null */
47
53
  export declare function normalizeGradingSettings(
48
54
  grading: unknown
49
- ): { type: 'pattern'; answer_key?: string } | { type: 'rubric'; rubric?: string } | null;
50
- /** 채점 설정이 있으면 로컬 채점, 없으면 제출만 받음 (점수 null) */
55
+ ):
56
+ | { type: 'pattern'; answer_key?: string }
57
+ | { type: 'partial_pattern'; answer_key: string[]; scores: number[] }
58
+ | { type: 'rubric'; rubric?: string }
59
+ | null;
60
+ /** 채점 설정이 있으면 로컬 채점, 없으면 제출만 받음 (점수 null). partial_pattern은 맞은 문항 점수의 합(최대 100) */
51
61
  export declare function gradeLocally(grading: unknown, answer: unknown): SubmitResult;
62
+ /** 서버가 채점 전에 거절하는 답(422)이면 이유: partial_pattern에 문자열 배열이 아닌 답. 문제가 없으면 null */
63
+ export declare function answerShapeError(grading: unknown, answer: unknown): string | null;
52
64
 
53
65
  export interface Navigation {
54
66
  previous(): void;
@@ -58,6 +70,17 @@ export interface Navigation {
58
70
  getHasNext(): Promise<boolean>;
59
71
  }
60
72
 
73
+ interface Assets {
74
+ post(
75
+ file: File,
76
+ options?: {
77
+ onProgress?: (progress: { loaded: number; total: number }) => void;
78
+ signal?: AbortSignal;
79
+ }
80
+ ): Promise<{ id: string; name: string; size: number; mime: string; url: string }>;
81
+ get(id: string): Promise<{ id: string; url: string } | null>;
82
+ }
83
+
61
84
  export declare class MockEliceCDK {
62
85
  constructor(options?: {
63
86
  onSessionExpired?: () => void;
@@ -82,6 +105,9 @@ export declare class MockEliceCDK {
82
105
  readonly isDraft: boolean;
83
106
  readonly isSessionExpired: boolean;
84
107
  readonly navigation: Navigation;
108
+ readonly assets: Assets;
109
+ readonly accessToken: string | null;
110
+ readonly videoPlayerUrl: string | null;
85
111
  readonly material: {
86
112
  description: unknown;
87
113
  entries: Partial<Record<Screen, string>>;
@@ -99,6 +125,7 @@ export declare class MockEliceCDK {
99
125
  history(options?: { offset?: number; limit?: number }): Promise<Submission[]>;
100
126
  /** 저장하고 부모 창에 settings-saved로 알린다. 토큰 없는 draft(#edit=1)는 draft_not_saved로 거절 */
101
127
  saveSettings(settings: Record<string, unknown>): Promise<void>;
128
+ onAccessTokenChange(listener: (token: string) => void): () => void;
102
129
  dispose(): void;
103
130
  reset(): void;
104
131
  }
@@ -2,8 +2,8 @@
2
2
  * @eliceio/cdk 1.x(EliceCDK)와 같은 공개 인터페이스를 가진 mock · 템플릿이 제공 (고치지 마세요)
3
3
  *
4
4
  * 서버 없이 화면을 시험할 때 키트가 대신 씁니다. 실제 SDK와 다른 점:
5
- * - 채점: 편집 화면이 저장한 채점 설정(settings.grading { type: pattern | rubric })이 있으면 로컬 채점, 없으면 제출만 받음.
6
- * pattern 답은 정규식 하나, 답 문자열 전체 일치. 프로젝트 폴더를 그대로 열면 ecdk dev가 저장한 .ecdk/settings.json으로 시작
5
+ * - 채점: 편집 화면이 저장한 채점 설정(settings.grading { type: pattern | partial_pattern | rubric })이 있으면 로컬 채점, 없으면 제출만 받음.
6
+ * pattern 답은 정규식 하나, 답 문자열 전체 일치. partial_pattern은 문항별 정규식 · 점수, 답은 문자열 배열. 프로젝트 폴더를 그대로 열면 ecdk dev가 저장한 .ecdk/settings.json으로 시작
7
7
  * - 완료 정책: 흉내 내지 않는다 (LXP에 올린 뒤 자료 편집 화면의 '설정'에서 교육자가 고름, ADR 0012). material.completionPolicy는 null
8
8
  * - 저장: 설정 화면이 저장한 내용과 제출 기록을 브라우저에 남겨 다른 화면에서도 보임
9
9
  * (sandbox라 저장소가 막히면 이 페이지 안에서만)
@@ -14,6 +14,8 @@
14
14
  * 실제 SDK처럼 account · result는 null (edit 토큰은 /me를 부르지 않음)
15
15
  * 편집 화면이 넣은 settings.grading은 학생 화면의 material.settings에서 서버처럼 빼고 준다
16
16
  * - 수업 페이지 이동: 아무 데도 가지 않고, 이전·다음 페이지는 없음(false)
17
+ * - Files (assets) and the video player: nothing is uploaded. assets.post rejects with request_failed,
18
+ * assets.get returns null, videoPlayerUrl and accessToken are null (try them in ecdk dev or LXP)
17
19
  * - 시나리오: 주소에 ?mock=session_expired | rate_limited | request_failed | external_service_error
18
20
  * | slow | content_not_ready | unauthorized | draft_not_ready
19
21
  *
@@ -37,6 +39,10 @@ export const ErrorCode = Object.freeze({
37
39
  NavigationTimeout: 'navigation_timeout',
38
40
  RequestFailed: 'request_failed',
39
41
  DraftNotSaved: 'draft_not_saved',
42
+ FileInvalidType: 'file_invalid_type',
43
+ FileInvalidSize: 'file_invalid_size',
44
+ ScriptLoadFailed: 'script_load_failed',
45
+ ScriptNamespaceNotFound: 'script_namespace_not_found',
40
46
  });
41
47
 
42
48
  export class EliceCDKError extends Error {
@@ -107,42 +113,79 @@ const answerText = answer =>
107
113
  typeof answer === 'string' ? answer.trim() : JSON.stringify(answer ?? null);
108
114
 
109
115
  /**
110
- * 채점 설정을 서버 모양(2026-11-11 결정)으로: `{ type: 'pattern', answer_key }` · `{ type: 'rubric', rubric }`.
116
+ * 채점 설정을 서버 모양(2026-11-11 결정)으로: `{ type: 'pattern', answer_key }` ·
117
+ * `{ type: 'partial_pattern', answer_key: string[], scores: number[] }` · `{ type: 'rubric', rubric }`.
111
118
  * camelCase(answerKey)도 받는다. 채점 방식이 아니면 null
112
119
  */
113
120
  export function normalizeGradingSettings(grading) {
114
121
  if (!grading || typeof grading !== 'object') return null;
115
- if (grading.type === 'pattern') {
116
- const answerKey = grading.answer_key ?? grading.answerKey;
122
+ const answerKey = grading.answer_key ?? grading.answerKey;
123
+ if (grading.type === 'pattern')
117
124
  return { type: 'pattern', ...(typeof answerKey === 'string' ? { answer_key: answerKey } : {}) };
118
- }
125
+ if (grading.type === 'partial_pattern')
126
+ return {
127
+ type: 'partial_pattern',
128
+ answer_key: Array.isArray(answerKey) ? [...answerKey] : [],
129
+ scores: Array.isArray(grading.scores) ? [...grading.scores] : [],
130
+ };
119
131
  if (grading.type === 'rubric')
120
132
  return { type: 'rubric', ...(typeof grading.rubric === 'string' ? { rubric: grading.rubric } : {}) };
121
133
  return null;
122
134
  }
123
135
 
136
+ /** 서버(Python re) 맨 앞 전체 플래그 (?i) · (?s) · (?m): JS는 받지 않아 떼고 같은 JS 플래그로 (키트 toJsRegex와 같음) */
137
+ const LEADING_FLAGS = /^\(\?([ims]+)\)/;
138
+
139
+ /** 정답 정규식이 답 문자열(앞뒤 공백을 자름) 전체와 맞는지 (서버 re.fullmatch와 같은 판정). 정규식이 틀리면 false */
140
+ function fullMatch(regex, text) {
141
+ if (typeof regex !== 'string') return false;
142
+ try {
143
+ const m = LEADING_FLAGS.exec(regex);
144
+ const source = m ? regex.slice(m[0].length) : regex;
145
+ const flags = m ? [...new Set(m[1])].join('') : '';
146
+ return new RegExp(`^(?:${source})$`, flags).test(text.trim());
147
+ } catch {
148
+ return false;
149
+ }
150
+ }
151
+
152
+ /**
153
+ * 채점 전에 서버가 거절하는 답 (422): partial_pattern은 답이 문자열 배열이어야 한다. 문제가 없으면 null
154
+ * @param {object | null} grading settings.grading
155
+ * @param {unknown} answer
156
+ */
157
+ export function answerShapeError(grading, answer) {
158
+ if (normalizeGradingSettings(grading)?.type !== 'partial_pattern') return null;
159
+ if (!Array.isArray(answer)) return 'partial_pattern: answer must be an array of strings';
160
+ const bad = answer.findIndex(item => typeof item !== 'string');
161
+ return bad < 0 ? null : `partial_pattern: answer[${bad}] must be a string`;
162
+ }
163
+
124
164
  /**
125
165
  * elice-material 채점 흉내 (채점 방식 → 점수). 실제 서버처럼 요청 안에서 바로 채점한 `{ isCorrect, score }`만
126
166
  * 돌려준다. 완료 정책은 LXP 설정이라 보지 않는다 (ADR 0012): 채점 설정이 있으면 채점하고, 없으면 제출만 받는다.
127
167
  * - pattern: 정답 정규식(문자열 하나)이 답 문자열 전체와 맞으면 100, 아니면 0
168
+ * - partial_pattern: answer[i]를 answer_key[i]에 맞춰 맞은 문항의 scores[i]를 더함 (최대 100, 100점만 정답).
169
+ * 없는 문항은 0점, 남는 답은 무시. 문항별 맞음 answerCorrectness도 (submit · 제출 기록에는 그 밖의 방식이면 [])
128
170
  * - rubric: 바로 80점으로 흉내, 통과로 봄 (통과 기준 pass_threshold는 정해지지 않음)
129
171
  * - 채점 설정 없음: 점수 없음 `{ isCorrect: null, score: null }`
172
+ * 맨 앞 (?i)는 서버(Python re)처럼 대소문자 무시
130
173
  * @param {object | null} grading settings.grading
131
174
  * @param {unknown} answer
132
175
  */
133
176
  export function gradeLocally(grading, answer) {
134
177
  const g = normalizeGradingSettings(grading);
135
178
  if (g?.type === 'pattern') {
136
- let ok = false;
137
- try {
138
- ok =
139
- typeof g.answer_key === 'string' &&
140
- new RegExp(`^(?:${g.answer_key})$`).test(answerText(answer));
141
- } catch {
142
- ok = false;
143
- }
179
+ const ok = fullMatch(g.answer_key, answerText(answer));
144
180
  return { isCorrect: ok, score: ok ? 100 : 0 };
145
181
  }
182
+ if (g?.type === 'partial_pattern') {
183
+ const items = Array.isArray(answer) ? answer : [];
184
+ const answerCorrectness = g.answer_key.map((key, i) => typeof items[i] === 'string' && fullMatch(key, items[i]));
185
+ const total = answerCorrectness.reduce((sum, ok, i) => sum + (ok ? (g.scores[i] ?? 0) : 0), 0);
186
+ const score = Math.min(100, total);
187
+ return { isCorrect: score === 100, score, answerCorrectness };
188
+ }
146
189
  if (g?.type === 'rubric') return { isCorrect: true, score: RUBRIC_MOCK_SCORE };
147
190
  return { isCorrect: null, score: null };
148
191
  }
@@ -178,6 +221,7 @@ export class MockEliceCDK {
178
221
  /** draft의 제출은 실제 SDK처럼 메모리에만 */
179
222
  #draftSubmissions = [];
180
223
  #navigation;
224
+ #assets;
181
225
 
182
226
  /** @param {MockOptions} [options] */
183
227
  constructor(options = {}) {
@@ -206,6 +250,15 @@ export class MockEliceCDK {
206
250
  return false;
207
251
  },
208
252
  });
253
+ this.#assets = Object.freeze({
254
+ // There is no storage locally, so nothing is uploaded.
255
+ post: async (_file, _options) => {
256
+ this.#assertReady();
257
+ this.#assertScreen('edit');
258
+ throw new EliceCDKError(ErrorCode.RequestFailed, 'Uploads are not available in the mock.');
259
+ },
260
+ get: async (_id) => null,
261
+ });
209
262
  }
210
263
 
211
264
  get account() {
@@ -236,6 +289,20 @@ export class MockEliceCDK {
236
289
  get navigation() {
237
290
  return this.#navigation;
238
291
  }
292
+ /** Uploads and reads files. The mock uploads nothing and has no files to read. */
293
+ get assets() {
294
+ return this.#assets;
295
+ }
296
+ get accessToken() {
297
+ return null;
298
+ }
299
+ get videoPlayerUrl() {
300
+ return null;
301
+ }
302
+ /** No new token ever arrives in the mock. */
303
+ onAccessTokenChange(_listener) {
304
+ return () => {};
305
+ }
239
306
  get material() {
240
307
  if (!this.initialized) return null;
241
308
  // 서버처럼 학생 · 튜터 · 교육자(learn scope)에게는 settings.grading(정답)을 빼고 준다
@@ -344,7 +411,12 @@ export class MockEliceCDK {
344
411
  throw new EliceCDKError(ErrorCode.InvalidInput, 'Answer is over 64KB.');
345
412
  await this.#delay();
346
413
 
347
- const res = gradeLocally(this.#effectiveGrading(), answer);
414
+ const shapeError = answerShapeError(this.#effectiveGrading(), answer);
415
+ // 실제 SDK는 서버 422(VALIDATION_ERROR)를 RequestFailed로 던진다
416
+ if (shapeError) throw new EliceCDKError(ErrorCode.RequestFailed, `${shapeError} (mock 422).`);
417
+ // 서버처럼 문항별 맞음은 늘 준다: partial_pattern이 아니면 []
418
+ const graded = gradeLocally(this.#effectiveGrading(), answer);
419
+ const res = { ...graded, answerCorrectness: graded.answerCorrectness ?? [] };
348
420
  if (this.#isDraft) this.#draftSubmissions.unshift(this.#submission(answer, res, 'preview'));
349
421
  else if (this.#viewer === 'student') this.#record(res, answer);
350
422
  return res;
@@ -444,6 +516,7 @@ export class MockEliceCDK {
444
516
  answer,
445
517
  isCorrect: res.isCorrect,
446
518
  score: res.score,
519
+ answerCorrectness: res.answerCorrectness ?? [],
447
520
  };
448
521
  }
449
522