@interlacejs/quiz 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +262 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +262 -32
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/quiz-editor.ts","../src/tokens.ts","../src/quiz-player.ts","../src/validate.ts","../src/quiz-content-type.ts"],"sourcesContent":["import { ContentType, ensureInterlaceStyles } from \"@interlacejs/core\";\nimport { renderQuizPlayback, unmountQuizPlayback } from \"./quiz-player\";\nimport { COLORS, FONTS, RADIUS, SPACE, TYPE } from \"./tokens\";\nimport type {\n QuizData,\n QuizMediaRef,\n QuizOption,\n QuizQuestionSpec,\n} from \"./schema\";\nimport { getQuizAuthoringIssues } from \"./validate\";\n\ninterface QuizEditorController {\n syncTo(data: QuizData, onChange: (next: QuizData) => void): void;\n}\n\n/**\n * Controllers are stashed per container so the slot can hand the same\n * controller back across the mount/update lifecycle. The slot always passes\n * the same container element to `renderEditor`/`updateEditor`/`unmount`.\n */\nconst quizEditorControllers = new WeakMap<HTMLElement, QuizEditorController>();\n\n/** Gives each mounted editor unique element ids and radio group names. */\nlet editorInstanceCount = 0;\n\n/** Fewest options a question may be reduced to via the remove buttons. */\nconst MIN_OPTIONS = 2;\n\n/** Builds a media ref from src/alt text; `undefined` when src is blank. */\nfunction buildMediaRef(src: string, alt: string): QuizMediaRef | undefined {\n if (src.length === 0) return undefined;\n return alt.length > 0 ? { src, alt } : { src };\n}\n\n/** Creates a preview `<img>` for a media ref, or `null` when src is blank. */\nfunction createPreview(\n media: QuizMediaRef | undefined,\n className: string,\n): HTMLImageElement | null {\n if (!media || media.src.length === 0) return null;\n const img = document.createElement(\"img\");\n img.className = className;\n img.src = media.src;\n img.style.maxWidth = \"100%\";\n img.style.maxHeight = \"160px\";\n img.style.height = \"auto\";\n img.style.borderRadius = `${RADIUS.sm}`;\n img.style.marginTop = `${SPACE[1]}px`;\n if (media.alt) img.alt = media.alt;\n return img;\n}\n\n/** Renders `media` into `slot`, replacing any previous preview. */\nfunction syncPreview(\n slot: HTMLElement,\n media: QuizMediaRef | undefined,\n className: string,\n): void {\n slot.innerHTML = \"\";\n const img = createPreview(media, className);\n if (img) slot.appendChild(img);\n}\n\n/** Generates an option id that does not collide with existing ids. */\nfunction nextOptionId(options: QuizOption[], index: number): string {\n const base = `opt-${index}`;\n if (!options.some((option) => option.id === base)) return base;\n let candidate = index + 1;\n while (options.some((option) => option.id === `opt-${candidate}`)) {\n candidate += 1;\n }\n return `opt-${candidate}`;\n}\n\n/** Generates a question id that does not collide with existing ids. */\nfunction nextQuestionId(questions: QuizQuestionSpec[], index: number): string {\n const base = `q-${index}`;\n if (!questions.some((question) => question.id === base)) return base;\n let candidate = index + 1;\n while (questions.some((question) => question.id === `q-${candidate}`)) {\n candidate += 1;\n }\n return `q-${candidate}`;\n}\n\n/** An empty question stub so the form is never without a question. */\n/** A new question starts with the minimum of two options, the first correct. */\nfunction emptyQuestion(id: string): QuizQuestionSpec {\n return {\n id,\n text: \"\",\n options: [\n { id: `${id}-a`, text: \"\" },\n { id: `${id}-b`, text: \"\" },\n ],\n correctOptionId: `${id}-a`,\n };\n}\n\n/**\n * Shows or hides an element. Uses inline `display` rather than `hidden`\n * because the shared `interlace-*` rules set `display` and would override\n * the user-agent `[hidden]` rule.\n */\nfunction setShown(el: HTMLElement, shown: boolean, display = \"\"): void {\n el.style.display = shown ? display : \"none\";\n}\n\n/** Sets an input's value only when it differs, so the caret is not moved. */\nfunction setValue(input: HTMLInputElement, value: string): void {\n if (input.value !== value) input.value = value;\n}\n\nfunction createButton(\n text: string,\n variant: \"primary\" | \"secondary\" | \"ghost\",\n className: string,\n): HTMLButtonElement {\n const button = document.createElement(\"button\");\n button.type = \"button\";\n button.className = `interlace-btn interlace-btn--${variant} ${className}`;\n button.textContent = text;\n return button;\n}\n\n/** A quiet \"×\" icon button for per-row remove actions. */\nfunction createRemoveButton(className: string): HTMLButtonElement {\n const button = createButton(\"×\", \"ghost\", `interlace-btn--icon ${className}`);\n button.style.fontSize = `${TYPE.lg}px`;\n button.style.lineHeight = \"1\";\n return button;\n}\n\n/** Enables a remove button, or disables it with `reason` as its tooltip. */\nfunction setRemoveAllowed(\n button: HTMLButtonElement,\n allowed: boolean,\n reason: string,\n): void {\n button.disabled = !allowed;\n if (allowed) button.removeAttribute(\"title\");\n else button.title = reason;\n}\n\nfunction createInput(\n className: string,\n id: string,\n placeholder?: string,\n): HTMLInputElement {\n const input = document.createElement(\"input\");\n input.type = \"text\";\n input.id = id;\n input.className = `interlace-input ${className}`;\n input.style.width = \"100%\";\n input.style.boxSizing = \"border-box\";\n if (placeholder) input.placeholder = placeholder;\n return input;\n}\n\nfunction createLabel(text: string, forId: string): HTMLLabelElement {\n const label = document.createElement(\"label\");\n label.className = \"interlace-label\";\n label.htmlFor = forId;\n label.textContent = text;\n label.style.fontSize = `${TYPE.sm}px`;\n label.style.fontWeight = \"600\";\n return label;\n}\n\n/** A labelled field (label above input) wrapped in `interlace-field`. */\nfunction createField(\n labelText: string,\n input: HTMLInputElement,\n): HTMLDivElement {\n const field = document.createElement(\"div\");\n field.className = \"interlace-field\";\n field.style.display = \"flex\";\n field.style.flexDirection = \"column\";\n field.style.gap = `${SPACE[1]}px`;\n field.append(createLabel(labelText, input.id), input);\n return field;\n}\n\n/** An inline error message element, hidden until a message is set. */\nfunction createErrorText(id: string, className: string): HTMLParagraphElement {\n const error = document.createElement(\"p\");\n error.id = id;\n error.className = `interlace-hint quiz-field-error ${className}`;\n error.style.margin = \"0\";\n error.style.fontSize = `${TYPE.sm}px`;\n error.style.color = COLORS.errorText;\n setShown(error, false);\n return error;\n}\n\n/** Shows `message` for `input` (with aria wiring), or clears it on `null`. */\nfunction setFieldError(\n input: HTMLInputElement,\n error: HTMLElement,\n message: string | null,\n): void {\n if (message) {\n error.textContent = message;\n setShown(error, true);\n input.setAttribute(\"aria-invalid\", \"true\");\n input.setAttribute(\"aria-describedby\", error.id);\n } else {\n error.textContent = \"\";\n setShown(error, false);\n input.removeAttribute(\"aria-invalid\");\n input.removeAttribute(\"aria-describedby\");\n }\n}\n\ninterface MediaEditor {\n root: HTMLDivElement;\n srcInput: HTMLInputElement;\n altInput: HTMLInputElement;\n previewSlot: HTMLDivElement;\n /** Patches values/preview in place and shows or collapses the panel. */\n sync(media: QuizMediaRef | undefined, expanded: boolean): void;\n}\n\ninterface MediaEditorOptions {\n /** Class prefix, e.g. `quiz-question-media` → `quiz-question-media-src`. */\n classPrefix: string;\n idPrefix: string;\n /** Accessible name of the \"Add image\" button. */\n addLabel: string;\n previewSlotClass: string;\n previewClass: string;\n /** The author edited the URL or alt text. */\n onEdit(media: QuizMediaRef | undefined): void;\n /** The author expanded the panel via \"Add image\". */\n onExpand(): void;\n /** The author removed the image (fields are already cleared). */\n onRemove(): void;\n}\n\n/**\n * Image URL + alt fields tucked behind a ghost \"Add image\" button. The\n * panel opens on demand (or automatically when media exists, via `sync`)\n * and \"Remove image\" clears both fields and collapses it again.\n */\nfunction createMediaEditor(options: MediaEditorOptions): MediaEditor {\n const { classPrefix, idPrefix } = options;\n const root = document.createElement(\"div\");\n root.className = classPrefix;\n\n const addButton = createButton(\"+ Add image\", \"ghost\", `${classPrefix}-add`);\n addButton.setAttribute(\"aria-label\", options.addLabel);\n addButton.setAttribute(\"aria-controls\", `${idPrefix}-panel`);\n addButton.style.paddingLeft = `${SPACE[2]}px`;\n addButton.style.paddingRight = `${SPACE[2]}px`;\n\n const panel = document.createElement(\"div\");\n panel.id = `${idPrefix}-panel`;\n panel.className = `${classPrefix}-panel`;\n panel.style.flexDirection = \"column\";\n panel.style.gap = `${SPACE[2]}px`;\n panel.style.padding = `${SPACE[3]}px`;\n panel.style.backgroundColor = COLORS.surfaceRaised;\n panel.style.border = `1px solid ${COLORS.border}`;\n panel.style.borderRadius = `${RADIUS.md}`;\n\n const srcInput = createInput(\n `${classPrefix}-src`,\n `${idPrefix}-src`,\n \"https://example.com/image.png\",\n );\n const altInput = createInput(\n `${classPrefix}-alt`,\n `${idPrefix}-alt`,\n \"Describe the image for screen readers\",\n );\n const previewSlot = document.createElement(\"div\");\n previewSlot.className = options.previewSlotClass;\n\n const removeButton = createButton(\n \"Remove image\",\n \"ghost\",\n `${classPrefix}-remove`,\n );\n removeButton.style.alignSelf = \"flex-start\";\n\n panel.append(\n createField(\"Image URL\", srcInput),\n createField(\"Image description (alt text)\", altInput),\n previewSlot,\n removeButton,\n );\n root.append(addButton, panel);\n\n const setExpanded = (expanded: boolean): void => {\n setShown(panel, expanded, \"flex\");\n setShown(addButton, !expanded);\n addButton.setAttribute(\"aria-expanded\", String(expanded));\n };\n setExpanded(false);\n\n const handleEdit = (): void => {\n const media = buildMediaRef(srcInput.value, altInput.value);\n syncPreview(previewSlot, media, options.previewClass);\n options.onEdit(media);\n };\n srcInput.addEventListener(\"input\", handleEdit);\n altInput.addEventListener(\"input\", handleEdit);\n\n addButton.addEventListener(\"click\", () => {\n setExpanded(true);\n options.onExpand();\n srcInput.focus();\n });\n removeButton.addEventListener(\"click\", () => {\n srcInput.value = \"\";\n altInput.value = \"\";\n syncPreview(previewSlot, undefined, options.previewClass);\n setExpanded(false);\n options.onRemove();\n addButton.focus();\n });\n\n const sync = (media: QuizMediaRef | undefined, expanded: boolean): void => {\n setValue(srcInput, media?.src ?? \"\");\n setValue(altInput, media?.alt ?? \"\");\n syncPreview(previewSlot, media, options.previewClass);\n setExpanded(expanded);\n };\n\n return { root, srcInput, altInput, previewSlot, sync };\n}\n\ninterface OptionRow {\n row: HTMLDivElement;\n radio: HTMLInputElement;\n textInput: HTMLInputElement;\n error: HTMLParagraphElement;\n media: MediaEditor;\n}\n\n/**\n * Builds the quiz authoring form once and returns a controller whose\n * `syncTo` patches inputs in place (preserving focus) instead of rebuilding\n * the DOM on every keystroke. The form has a question tab list (add,\n * select); the ACTIVE question's text, image and options are edited in the\n * tab panel below it, with the correct answer chosen by a radio on each\n * option row. Switching the selected question rebuilds that question's\n * option rows (an explicit action); within the active question, edits patch\n * in place. All edits emit canonical multi-question {@link QuizData}.\n */\nfunction createQuizEditorController(\n container: HTMLElement,\n data: QuizData,\n onChange: (next: QuizData) => void,\n): QuizEditorController {\n ensureInterlaceStyles(container.ownerDocument);\n editorInstanceCount += 1;\n const uid = `quiz-editor-${editorInstanceCount}`;\n\n container.innerHTML = \"\";\n const root = document.createElement(\"div\");\n root.className = \"quiz-editor\";\n root.style.fontFamily = FONTS.body;\n root.style.color = COLORS.text;\n root.style.lineHeight = \"1.5\";\n root.style.display = \"flex\";\n root.style.flexDirection = \"column\";\n root.style.gap = `${SPACE[3]}px`;\n\n let currentData: QuizData = data;\n let currentOnChange = onChange;\n let selectedIndex = 0;\n let bodyQuestionIndex = -1;\n let optionRows: OptionRow[] = [];\n let tabButtons: HTMLButtonElement[] = [];\n /** Fields the author has blurred; errors only show for these. */\n const touched = new Set<string>();\n /** Media panels the author opened (kept open even while empty). */\n const expandedMedia = new Set<string>();\n\n const emit = (questions: QuizQuestionSpec[]): void => {\n currentOnChange({ questions });\n };\n\n /** Applies `mutate` to the active question and emits the canonical list. */\n const patchActiveQuestion = (\n mutate: (question: QuizQuestionSpec) => QuizQuestionSpec,\n ): void => {\n const active = currentData.questions[selectedIndex];\n if (!active) return;\n const questions = currentData.questions.slice();\n questions[selectedIndex] = mutate(active);\n emit(questions);\n };\n\n /** Stable state key for the active question (or one of its options). */\n const activeKey = (optionIndex?: number): string => {\n const active = currentData.questions[selectedIndex];\n const questionKey = active?.id ?? `#${selectedIndex}`;\n if (optionIndex === undefined) return questionKey;\n return `${questionKey}/${active?.options[optionIndex]?.id ?? `#${optionIndex}`}`;\n };\n\n // --- Question tabs ---\n const questionsHeader = document.createElement(\"div\");\n questionsHeader.id = `${uid}-questions-label`;\n questionsHeader.className = \"interlace-label\";\n questionsHeader.textContent = \"Questions\";\n questionsHeader.style.fontSize = `${TYPE.sm}px`;\n questionsHeader.style.fontWeight = \"600\";\n questionsHeader.style.color = COLORS.textMuted;\n\n const tabsRow = document.createElement(\"div\");\n tabsRow.style.display = \"flex\";\n tabsRow.style.flexWrap = \"wrap\";\n tabsRow.style.alignItems = \"center\";\n tabsRow.style.gap = `${SPACE[2]}px`;\n\n const tabsBar = document.createElement(\"div\");\n tabsBar.className = \"quiz-question-tabs\";\n tabsBar.setAttribute(\"role\", \"tablist\");\n tabsBar.setAttribute(\"aria-labelledby\", questionsHeader.id);\n tabsBar.style.display = \"flex\";\n tabsBar.style.flexWrap = \"wrap\";\n tabsBar.style.gap = `${SPACE[2]}px`;\n\n const addQuestionButton = createButton(\n \"+ Add question\",\n \"secondary\",\n \"quiz-add-question\",\n );\n addQuestionButton.addEventListener(\"click\", () => {\n const id = nextQuestionId(\n currentData.questions,\n currentData.questions.length,\n );\n const questions = [...currentData.questions, emptyQuestion(id)];\n currentData = { questions };\n selectedIndex = questions.length - 1;\n emit(questions);\n bodyQuestionIndex = -1;\n renderTabs();\n syncActiveBody();\n });\n tabsRow.append(tabsBar, addQuestionButton);\n root.append(questionsHeader, tabsRow);\n\n // --- Active question panel ---\n const body = document.createElement(\"div\");\n body.id = `${uid}-panel`;\n body.className = \"quiz-editor-body\";\n body.setAttribute(\"role\", \"tabpanel\");\n body.style.display = \"flex\";\n body.style.flexDirection = \"column\";\n body.style.gap = `${SPACE[4]}px`;\n body.style.padding = `${SPACE[4]}px`;\n body.style.backgroundColor = COLORS.surface;\n body.style.border = `1px solid ${COLORS.border}`;\n body.style.borderRadius = `${RADIUS.md}`;\n root.appendChild(body);\n\n // Question text: label above, remove-question action on the same line.\n const questionInput = createInput(\n \"quiz-question\",\n `${uid}-question`,\n \"Type your question\",\n );\n questionInput.style.fontSize = `${TYPE.md}px`;\n const questionError = createErrorText(\n `${uid}-question-error`,\n \"quiz-question-error\",\n );\n const refreshQuestionError = (): void => {\n const show =\n touched.has(`text:${activeKey()}`) &&\n questionInput.value.trim().length === 0;\n setFieldError(\n questionInput,\n questionError,\n show ? \"Add the question text\" : null,\n );\n };\n questionInput.addEventListener(\"input\", () => {\n patchActiveQuestion((question) => ({\n ...question,\n text: questionInput.value,\n }));\n refreshQuestionError();\n });\n questionInput.addEventListener(\"blur\", () => {\n touched.add(`text:${activeKey()}`);\n refreshQuestionError();\n });\n\n const removeQuestionButton = createRemoveButton(\"quiz-question-remove\");\n removeQuestionButton.addEventListener(\"click\", () =>\n removeQuestion(selectedIndex),\n );\n\n const questionHeader = document.createElement(\"div\");\n questionHeader.style.display = \"flex\";\n questionHeader.style.alignItems = \"center\";\n questionHeader.style.justifyContent = \"space-between\";\n questionHeader.style.gap = `${SPACE[2]}px`;\n questionHeader.append(\n createLabel(\"Question\", questionInput.id),\n removeQuestionButton,\n );\n\n const questionField = document.createElement(\"div\");\n questionField.className = \"interlace-field\";\n questionField.style.display = \"flex\";\n questionField.style.flexDirection = \"column\";\n questionField.style.gap = `${SPACE[1]}px`;\n questionField.append(questionHeader, questionInput, questionError);\n\n const questionMedia = createMediaEditor({\n classPrefix: \"quiz-question-media\",\n idPrefix: `${uid}-question-media`,\n addLabel: \"Add image to question\",\n previewSlotClass: \"quiz-question-media-preview-slot\",\n previewClass: \"quiz-question-media-preview\",\n onEdit: (media) => {\n expandedMedia.add(activeKey());\n patchActiveQuestion((question) => ({ ...question, media }));\n },\n onExpand: () => expandedMedia.add(activeKey()),\n onRemove: () => {\n expandedMedia.delete(activeKey());\n patchActiveQuestion((question) => ({ ...question, media: undefined }));\n },\n });\n questionField.appendChild(questionMedia.root);\n body.appendChild(questionField);\n\n // Options: heading + hint, then one row per option with a correct radio.\n const optionsSection = document.createElement(\"div\");\n optionsSection.style.display = \"flex\";\n optionsSection.style.flexDirection = \"column\";\n optionsSection.style.gap = `${SPACE[2]}px`;\n\n const optionsHeading = document.createElement(\"div\");\n optionsHeading.id = `${uid}-options-label`;\n optionsHeading.className = \"interlace-label quiz-options-heading\";\n optionsHeading.textContent = \"Options\";\n optionsHeading.style.fontSize = `${TYPE.sm}px`;\n optionsHeading.style.fontWeight = \"600\";\n\n const optionsHint = document.createElement(\"p\");\n optionsHint.id = `${uid}-options-hint`;\n optionsHint.className = \"interlace-hint quiz-options-hint\";\n optionsHint.textContent = \"Select the correct answer.\";\n optionsHint.style.margin = \"0\";\n optionsHint.style.fontSize = `${TYPE.sm}px`;\n optionsHint.style.color = COLORS.textMuted;\n\n const optionsContainer = document.createElement(\"div\");\n optionsContainer.className = \"quiz-options\";\n optionsContainer.setAttribute(\"role\", \"radiogroup\");\n optionsContainer.setAttribute(\"aria-labelledby\", optionsHeading.id);\n optionsContainer.setAttribute(\"aria-describedby\", optionsHint.id);\n optionsContainer.style.display = \"flex\";\n optionsContainer.style.flexDirection = \"column\";\n optionsContainer.style.gap = `${SPACE[2]}px`;\n\n const addOptionButton = createButton(\n \"+ Add option\",\n \"secondary\",\n \"quiz-add-option\",\n );\n addOptionButton.style.alignSelf = \"flex-start\";\n addOptionButton.addEventListener(\"click\", () => {\n patchActiveQuestion((question) => {\n const nextOptions: QuizOption[] = [\n ...question.options,\n {\n id: nextOptionId(question.options, question.options.length),\n text: \"\",\n },\n ];\n // Adding the first option defaults it to correct (ported behavior).\n const nextCorrectOptionId =\n question.options.length === 0\n ? nextOptions[0]!.id\n : question.correctOptionId;\n return {\n ...question,\n options: nextOptions,\n correctOptionId: nextCorrectOptionId,\n };\n });\n });\n\n optionsSection.append(\n optionsHeading,\n optionsHint,\n optionsContainer,\n addOptionButton,\n );\n body.appendChild(optionsSection);\n\n container.appendChild(root);\n\n const createOptionRow = (\n option: QuizOption,\n optionIndex: number,\n optionCount: number,\n ): OptionRow => {\n const number = optionIndex + 1;\n const idPrefix = `${uid}-q${selectedIndex}-opt${optionIndex}`;\n\n // Grid: [radio] [label / input / error + image] [remove].\n const row = document.createElement(\"div\");\n row.className = \"quiz-option-row interlace-choice\";\n row.style.display = \"grid\";\n row.style.gridTemplateColumns = \"auto minmax(0, 1fr) auto\";\n row.style.alignItems = \"center\";\n row.style.columnGap = `${SPACE[2]}px`;\n row.style.rowGap = `${SPACE[1]}px`;\n row.style.cursor = \"default\";\n // The inputs draw their own focus rings; skip the card's focus-within ring.\n row.style.outline = \"none\";\n\n const radio = document.createElement(\"input\");\n radio.type = \"radio\";\n radio.name = `${uid}-correct-${selectedIndex}`;\n radio.className = \"quiz-option-correct\";\n radio.value = option.id;\n radio.checked =\n option.id === currentData.questions[selectedIndex]?.correctOptionId;\n radio.setAttribute(\"aria-label\", `Mark option ${number} as correct`);\n radio.style.width = \"18px\";\n radio.style.height = \"18px\";\n radio.style.margin = \"0\";\n radio.style.accentColor = COLORS.accent;\n radio.style.cursor = \"pointer\";\n radio.style.gridColumn = \"1\";\n radio.style.gridRow = \"2\";\n radio.addEventListener(\"change\", () => {\n if (!radio.checked) return;\n patchActiveQuestion((question) => ({\n ...question,\n correctOptionId: question.options[optionIndex]?.id ?? null,\n }));\n });\n\n const textInput = createInput(\n \"quiz-option-text\",\n `${idPrefix}-text`,\n \"Option text\",\n );\n textInput.value = option.text;\n textInput.style.gridColumn = \"2\";\n textInput.style.gridRow = \"2\";\n const label = createLabel(`Option ${number}`, textInput.id);\n label.style.gridColumn = \"2\";\n label.style.gridRow = \"1\";\n\n const error = createErrorText(`${idPrefix}-error`, \"quiz-option-error\");\n const refreshError = (): void => {\n const show =\n touched.has(`opt:${activeKey(optionIndex)}`) &&\n textInput.value.trim().length === 0;\n setFieldError(\n textInput,\n error,\n show ? `Option ${number} needs text` : null,\n );\n };\n textInput.addEventListener(\"input\", () => {\n patchActiveQuestion((question) => {\n const nextOptions = question.options.slice();\n nextOptions[optionIndex] = {\n ...nextOptions[optionIndex]!,\n text: textInput.value,\n };\n return { ...question, options: nextOptions };\n });\n refreshError();\n });\n textInput.addEventListener(\"blur\", () => {\n touched.add(`opt:${activeKey(optionIndex)}`);\n refreshError();\n });\n\n const patchOptionMedia = (media: QuizMediaRef | undefined): void => {\n patchActiveQuestion((question) => {\n const nextOptions = question.options.slice();\n nextOptions[optionIndex] = { ...nextOptions[optionIndex]!, media };\n return { ...question, options: nextOptions };\n });\n };\n const media = createMediaEditor({\n classPrefix: \"quiz-option-media\",\n idPrefix: `${idPrefix}-media`,\n addLabel: `Add image to option ${number}`,\n previewSlotClass: \"quiz-option-media-preview\",\n previewClass: \"quiz-option-thumb\",\n onEdit: (next) => {\n expandedMedia.add(activeKey(optionIndex));\n patchOptionMedia(next);\n },\n onExpand: () => expandedMedia.add(activeKey(optionIndex)),\n onRemove: () => {\n expandedMedia.delete(activeKey(optionIndex));\n patchOptionMedia(undefined);\n },\n });\n\n const details = document.createElement(\"div\");\n details.style.gridColumn = \"2\";\n details.style.gridRow = \"3\";\n details.style.display = \"flex\";\n details.style.flexDirection = \"column\";\n details.style.alignItems = \"flex-start\";\n details.style.gap = `${SPACE[1]}px`;\n media.root.style.alignSelf = \"stretch\";\n details.append(error, media.root);\n\n const remove = createRemoveButton(\"quiz-option-remove\");\n remove.setAttribute(\"aria-label\", `Remove option ${number}`);\n remove.style.gridColumn = \"3\";\n remove.style.gridRow = \"2\";\n setRemoveAllowed(\n remove,\n optionCount > MIN_OPTIONS,\n `A question needs at least ${MIN_OPTIONS} options`,\n );\n remove.addEventListener(\"click\", () => {\n patchActiveQuestion((question) => {\n const removed = question.options[optionIndex];\n const nextOptions = question.options.filter(\n (_, i) => i !== optionIndex,\n );\n return {\n ...question,\n options: nextOptions,\n // Removing the correct option clears correctness; do not shift it.\n correctOptionId:\n removed && removed.id === question.correctOptionId\n ? null\n : question.correctOptionId,\n };\n });\n });\n\n row.append(label, radio, textInput, remove, details);\n optionsContainer.appendChild(row);\n return { row, radio, textInput, error, media };\n };\n\n const selectQuestion = (index: number): void => {\n selectedIndex = index;\n bodyQuestionIndex = -1;\n renderTabs();\n syncActiveBody();\n };\n\n const removeQuestion = (index: number): void => {\n const next = currentData.questions.filter((_, i) => i !== index);\n const questions =\n next.length > 0 ? next : [emptyQuestion(nextQuestionId([], 0))];\n if (selectedIndex === index) {\n selectedIndex = 0; // removing the selected question selects the first remaining\n } else if (index < selectedIndex) {\n selectedIndex -= 1;\n }\n currentData = { questions };\n emit(questions);\n bodyQuestionIndex = -1;\n renderTabs();\n syncActiveBody();\n };\n\n const renderTabs = (): void => {\n tabsBar.innerHTML = \"\";\n const count = currentData.questions.length;\n tabButtons = currentData.questions.map((_, index) => {\n const selected = index === selectedIndex;\n const tab = createButton(\n `Question ${index + 1}`,\n selected ? \"primary\" : \"secondary\",\n \"quiz-question-tab\",\n );\n tab.id = `${uid}-tab-${index}`;\n tab.setAttribute(\"role\", \"tab\");\n tab.setAttribute(\"aria-selected\", String(selected));\n tab.setAttribute(\"aria-controls\", body.id);\n tab.tabIndex = selected ? 0 : -1;\n tab.addEventListener(\"click\", () => selectQuestion(index));\n tab.addEventListener(\"keydown\", (event) => {\n let target = -1;\n if (event.key === \"ArrowRight\") target = (index + 1) % count;\n else if (event.key === \"ArrowLeft\")\n target = (index - 1 + count) % count;\n else if (event.key === \"Home\") target = 0;\n else if (event.key === \"End\") target = count - 1;\n if (target < 0) return;\n event.preventDefault();\n selectQuestion(target);\n tabButtons[target]?.focus();\n });\n tabsBar.appendChild(tab);\n return tab;\n });\n\n body.setAttribute(\"aria-labelledby\", `${uid}-tab-${selectedIndex}`);\n removeQuestionButton.setAttribute(\n \"aria-label\",\n `Remove question ${selectedIndex + 1}`,\n );\n setRemoveAllowed(\n removeQuestionButton,\n count > 1,\n \"A quiz needs at least one question\",\n );\n };\n\n const syncActiveBody = (): void => {\n const active = currentData.questions[selectedIndex];\n if (!active) return;\n\n setValue(questionInput, active.text);\n questionMedia.sync(\n active.media,\n !!active.media || expandedMedia.has(activeKey()),\n );\n refreshQuestionError();\n\n const options = active.options;\n if (\n bodyQuestionIndex !== selectedIndex ||\n optionRows.length !== options.length\n ) {\n // Question switch or option count change: rebuild the active question's rows.\n optionsContainer.innerHTML = \"\";\n optionRows = options.map((option, optionIndex) =>\n createOptionRow(option, optionIndex, options.length),\n );\n bodyQuestionIndex = selectedIndex;\n }\n // Patch values in place, preserving input focus.\n optionRows.forEach((row, optionIndex) => {\n const option = options[optionIndex]!;\n setValue(row.textInput, option.text);\n row.radio.value = option.id;\n row.radio.checked = option.id === active.correctOptionId;\n row.media.sync(\n option.media,\n !!option.media || expandedMedia.has(activeKey(optionIndex)),\n );\n const show =\n touched.has(`opt:${activeKey(optionIndex)}`) &&\n option.text.trim().length === 0;\n setFieldError(\n row.textInput,\n row.error,\n show ? `Option ${optionIndex + 1} needs text` : null,\n );\n });\n };\n\n const syncTo = (\n nextData: QuizData,\n nextOnChange: (next: QuizData) => void,\n ): void => {\n currentData = nextData;\n currentOnChange = nextOnChange;\n if (currentData.questions.length === 0) {\n currentData = { questions: [emptyQuestion(\"q-0\")] };\n }\n if (selectedIndex >= currentData.questions.length) {\n selectedIndex = 0;\n }\n renderTabs();\n syncActiveBody();\n };\n\n renderTabs();\n syncActiveBody();\n\n return { syncTo };\n}\n\nfunction getOrCreateQuizEditorController(\n container: HTMLElement,\n data: QuizData,\n onChange: (next: QuizData) => void,\n): QuizEditorController {\n let controller = quizEditorControllers.get(container);\n if (!controller) {\n controller = createQuizEditorController(container, data, onChange);\n quizEditorControllers.set(container, controller);\n }\n return controller;\n}\n\n/** Tears down the editor controller mounted in `container`, if any. */\nexport function unmountQuizEditor(container: HTMLElement): void {\n quizEditorControllers.delete(container);\n container.innerHTML = \"\";\n}\n\n/**\n * Built-in Quiz editor content type. Authors the canonical multi-question\n * {@link QuizData} shape with rich media (the single supported format).\n * Registered id is `quiz-editor`, matching the player's built-in quiz\n * content type.\n */\nexport const QuizEditorType: ContentType<QuizData> = {\n getId: () => \"quiz-editor\",\n getVersion: () => 1,\n getDisplayName: () => \"Quiz\",\n getDescription: () => \"Multiple-choice questions that check understanding\",\n\n validate(data: QuizData): string[] {\n return getQuizAuthoringIssues(data);\n },\n\n getMaximumScore(data): number | undefined {\n return data.questions.length;\n },\n\n async preload(): Promise<void> {\n // No preload needed for quiz content.\n },\n\n renderEditor(\n container: HTMLElement,\n data: QuizData,\n onChange: (newData: QuizData) => void,\n ): void {\n getOrCreateQuizEditorController(container, data, onChange).syncTo(\n data,\n onChange,\n );\n },\n\n updateEditor(\n container: HTMLElement,\n data: QuizData,\n onChange: (newData: QuizData) => void,\n ): void {\n getOrCreateQuizEditorController(container, data, onChange).syncTo(\n data,\n onChange,\n );\n },\n\n renderPlayback(\n container: HTMLElement,\n data: QuizData,\n callbacks: { onComplete(score?: number): void },\n ): void {\n renderQuizPlayback(container, data, callbacks);\n },\n\n unmountPlayback(container: HTMLElement): void {\n unmountQuizPlayback(container);\n },\n\n unmount(container: HTMLElement): void {\n unmountQuizEditor(container);\n },\n};\n","/**\n * Interlace design tokens, re-exported from `@interlacejs/core` so every\n * package shares one themeable set (CSS custom properties with defaults).\n */\nexport {\n COLORS,\n CONTROL_HEIGHT,\n FOCUS_RING,\n FONTS,\n RADIUS,\n SHADOWS,\n SPACE,\n TYPE,\n} from \"@interlacejs/core\";\n","import type { QuizData, QuizOption } from \"./schema\";\nimport { COLORS, FONTS, RADIUS, SPACE, TYPE } from \"./tokens\";\n\nexport interface QuizPlaybackCallbacks {\n onComplete(score?: number): void;\n}\n\ninterface QuizPlaybackSession {\n destroy: () => void;\n}\n\ninterface OptionEntry {\n button: HTMLButtonElement;\n option: QuizOption;\n statusGlyph: HTMLSpanElement;\n statusLabel: HTMLSpanElement;\n}\n\n/**\n * Per-container playback sessions, so `unmountQuizPlayback` can tear down\n * the listeners built by `renderQuizPlayback`.\n */\nconst quizPlaybackSessions = new WeakMap<HTMLElement, QuizPlaybackSession>();\n\n/** Creates a playback media `<img>`, or `null` when src is blank. */\nfunction createMediaImage(\n className: string,\n src: string,\n alt: string | undefined,\n): HTMLImageElement | null {\n if (src.length === 0) return null;\n const img = document.createElement(\"img\");\n img.className = className;\n img.src = src;\n img.style.maxWidth = \"100%\";\n img.style.height = \"auto\";\n img.style.borderRadius = `${RADIUS.sm}`;\n img.style.marginBottom = `${SPACE[2]}px`;\n if (alt) img.alt = alt;\n return img;\n}\n\n/** Locks an option button so it can no longer be clicked. */\nfunction lockOption(button: HTMLButtonElement): void {\n button.disabled = true;\n button.style.cursor = \"default\";\n}\n\n/** Reveals the correct-answer state on an option button. */\nfunction revealCorrect(\n button: HTMLButtonElement,\n glyph: HTMLSpanElement,\n label: HTMLSpanElement,\n): void {\n button.classList.add(\"quiz-playback-option-correct\");\n button.style.backgroundColor = COLORS.correctBg;\n button.style.borderColor = COLORS.correctBg;\n button.style.color = COLORS.correctText;\n glyph.textContent = \"✓\";\n label.textContent = \"Correct\";\n glyph.style.opacity = \"1\";\n label.style.opacity = \"1\";\n}\n\n/** Reveals the wrong-answer state on the selected option button. */\nfunction revealIncorrect(\n button: HTMLButtonElement,\n glyph: HTMLSpanElement,\n label: HTMLSpanElement,\n): void {\n button.classList.add(\"quiz-playback-option-incorrect\");\n button.style.backgroundColor = COLORS.incorrectBg;\n button.style.borderColor = COLORS.incorrectBorder;\n button.style.color = COLORS.incorrectText;\n glyph.textContent = \"✕\";\n label.textContent = \"Incorrect\";\n glyph.style.opacity = \"1\";\n label.style.opacity = \"1\";\n}\n\n/**\n * Renders a multi-question quiz into `container`: one question at a time\n * with a \"Question i of n\" indicator, per-question media and option buttons,\n * and an explicit navigation footer. Answering a question reveals\n * correctness and locks its options; the user then advances with **Next**.\n * On the final question, clicking **Next** reports the per-question\n * correct count (`onComplete(correctCount)`, one point per question) ONCE,\n * as the click handler's final statement. **Previous** returns to an\n * answered question in its locked, review-only state. The document is the\n * canonical single-format {@link QuizData} shape.\n */\nexport function renderQuizPlayback(\n container: HTMLElement,\n data: QuizData,\n callbacks: QuizPlaybackCallbacks,\n): void {\n // Destroy any session already mounted in this container: the overlay\n // lifecycle may re-render without an intervening unmount, and overwriting\n // the WeakMap entry would leak the first root (and its click listeners).\n unmountQuizPlayback(container);\n\n const total = data.questions.length;\n // Per-question recorded selections; back-navigation and the final\n // aggregate both read from here, and reveal locks make it stable.\n const answers: (string | null)[] = data.questions.map(() => null);\n let currentIndex = 0;\n let completed = false;\n\n const root = document.createElement(\"div\");\n root.className = \"quiz-playback\";\n root.style.fontFamily = FONTS.body;\n root.style.color = COLORS.text;\n root.style.lineHeight = \"1.5\";\n\n const indicator = document.createElement(\"div\");\n indicator.className = \"quiz-playback-indicator\";\n indicator.style.fontSize = `${TYPE.xs}px`;\n indicator.style.fontWeight = \"600\";\n indicator.style.color = COLORS.textMuted;\n indicator.style.marginBottom = `${SPACE[2]}px`;\n indicator.style.textTransform = \"uppercase\";\n indicator.style.letterSpacing = \"0.06em\";\n root.appendChild(indicator);\n\n const question = document.createElement(\"p\");\n question.className = \"quiz-playback-question\";\n question.style.margin = `0 0 ${SPACE[2]}px 0`;\n question.style.fontFamily = FONTS.display;\n question.style.fontSize = `${TYPE.lg}px`;\n question.style.fontWeight = \"600\";\n root.appendChild(question);\n\n const questionMediaSlot = document.createElement(\"div\");\n root.appendChild(questionMediaSlot);\n\n const optionsBox = document.createElement(\"div\");\n optionsBox.className = \"quiz-playback-options\";\n optionsBox.style.display = \"flex\";\n optionsBox.style.flexDirection = \"column\";\n optionsBox.style.gap = `${SPACE[2]}px`;\n root.appendChild(optionsBox);\n\n // Navigation footer: Previous (review-only back) and Next. The final\n // question uses the same Next label; clicking it aggregates the score\n // and fires onComplete once.\n const navFooter = document.createElement(\"div\");\n navFooter.className = \"quiz-playback-nav\";\n navFooter.style.display = \"flex\";\n navFooter.style.justifyContent = \"flex-end\";\n navFooter.style.gap = `${SPACE[2]}px`;\n navFooter.style.marginTop = `${SPACE[4]}px`;\n root.appendChild(navFooter);\n\n const prevButton = document.createElement(\"button\");\n prevButton.type = \"button\";\n prevButton.className = \"quiz-playback-prev\";\n prevButton.textContent = \"Previous\";\n prevButton.style.padding = `${SPACE[2]}px ${SPACE[4]}px`;\n prevButton.style.backgroundColor = COLORS.surface;\n prevButton.style.border = `1px solid ${COLORS.borderStrong}`;\n prevButton.style.borderRadius = `${RADIUS.md}`;\n prevButton.style.color = COLORS.text;\n prevButton.style.cursor = \"pointer\";\n prevButton.style.fontSize = `${TYPE.base}px`;\n prevButton.style.fontWeight = \"600\";\n prevButton.style.transition = \"background-color 150ms ease\";\n prevButton.addEventListener(\"click\", () => {\n if (currentIndex > 0) {\n renderQuestion(currentIndex - 1);\n }\n });\n navFooter.appendChild(prevButton);\n\n const nextButton = document.createElement(\"button\");\n nextButton.type = \"button\";\n nextButton.className = \"quiz-playback-next\";\n nextButton.textContent = \"Next\";\n nextButton.disabled = true;\n nextButton.style.padding = `${SPACE[2]}px ${SPACE[4]}px`;\n nextButton.style.backgroundColor = COLORS.accent;\n nextButton.style.border = \"none\";\n nextButton.style.borderRadius = `${RADIUS.md}`;\n nextButton.style.color = COLORS.accentContrast;\n nextButton.style.cursor = \"pointer\";\n nextButton.style.fontSize = `${TYPE.base}px`;\n nextButton.style.fontWeight = \"600\";\n nextButton.style.transition =\n \"background-color 150ms ease, opacity 150ms ease\";\n nextButton.addEventListener(\"click\", () => {\n if (completed) return;\n if (currentIndex < total - 1) {\n renderQuestion(currentIndex + 1);\n } else {\n // Final question: aggregate the per-question answers.\n completed = true;\n const correctCount = data.questions.reduce(\n (count, questionSpec, questionIndex) =>\n count +\n (answers[questionIndex] !== null &&\n answers[questionIndex] === questionSpec.correctOptionId\n ? 1\n : 0),\n 0,\n );\n nextButton.disabled = true;\n nextButton.style.opacity = \"0.55\";\n callbacks.onComplete(correctCount);\n }\n });\n navFooter.appendChild(nextButton);\n\n container.appendChild(root);\n\n let optionEntries: OptionEntry[] = [];\n\n const syncFooter = (index: number): void => {\n prevButton.style.display = index > 0 ? \"block\" : \"none\";\n nextButton.textContent = \"Next\";\n const answered = answers[index] !== null;\n nextButton.disabled = completed || !answered;\n nextButton.style.opacity = nextButton.disabled ? \"0.55\" : \"1\";\n };\n\n const createOptionButton = (\n option: QuizOption,\n isReview: boolean,\n ): OptionEntry => {\n const button = document.createElement(\"button\");\n button.type = \"button\";\n button.className = \"quiz-playback-option\";\n button.style.display = \"flex\";\n button.style.alignItems = \"center\";\n button.style.gap = `${SPACE[2]}px`;\n button.style.width = \"100%\";\n button.style.padding = `${SPACE[3]}px ${SPACE[4]}px`;\n button.style.backgroundColor = COLORS.surface;\n button.style.border = `1px solid ${COLORS.borderStrong}`;\n button.style.borderRadius = `${RADIUS.md}`;\n button.style.cursor = \"pointer\";\n button.style.fontSize = `${TYPE.base}px`;\n button.style.color = COLORS.text;\n button.style.textAlign = \"left\";\n button.style.transition =\n \"background-color 150ms ease, border-color 150ms ease, color 150ms ease\";\n\n const text = document.createElement(\"span\");\n text.className = \"quiz-playback-option-text\";\n text.textContent = option.text;\n text.style.flex = \"1\";\n button.appendChild(text);\n\n const thumbnail = createMediaImage(\n \"quiz-playback-option-media\",\n option.media?.src ?? \"\",\n option.media?.alt,\n );\n if (thumbnail) button.appendChild(thumbnail);\n\n const status = document.createElement(\"span\");\n status.style.display = \"flex\";\n status.style.alignItems = \"center\";\n status.style.gap = `${SPACE[1]}px`;\n status.style.marginLeft = \"auto\";\n status.style.transition = \"opacity 150ms ease\";\n\n const glyph = document.createElement(\"span\");\n glyph.style.fontWeight = \"700\";\n glyph.style.fontSize = `${TYPE.md}px`;\n glyph.style.lineHeight = \"1\";\n status.appendChild(glyph);\n\n const label = document.createElement(\"span\");\n label.style.fontWeight = \"600\";\n label.style.fontSize = `${TYPE.sm}px`;\n label.style.letterSpacing = \"0.04em\";\n status.appendChild(label);\n\n button.appendChild(status);\n\n if (isReview) {\n lockOption(button);\n }\n\n return { button, option, statusGlyph: glyph, statusLabel: label };\n };\n\n const revealQuestion = (\n questionIndex: number,\n selectedOptionId: string,\n ): void => {\n const spec = data.questions[questionIndex]!;\n const correctOptionId = spec.correctOptionId;\n\n optionEntries.forEach((entry) => {\n lockOption(entry.button);\n if (entry.option.id === correctOptionId) {\n revealCorrect(entry.button, entry.statusGlyph, entry.statusLabel);\n }\n if (\n entry.option.id === selectedOptionId &&\n selectedOptionId !== correctOptionId\n ) {\n revealIncorrect(entry.button, entry.statusGlyph, entry.statusLabel);\n }\n });\n };\n\n const renderQuestion = (index: number): void => {\n currentIndex = index;\n const spec = data.questions[index]!;\n const correctOptionId = spec.correctOptionId;\n const answered = answers[index] ?? null;\n\n indicator.textContent = `Question ${index + 1} of ${total}`;\n question.textContent = spec.text;\n questionMediaSlot.innerHTML = \"\";\n const questionMedia = createMediaImage(\n \"quiz-playback-question-media\",\n spec.media?.src ?? \"\",\n spec.media?.alt,\n );\n if (questionMedia) questionMediaSlot.appendChild(questionMedia);\n\n optionsBox.innerHTML = \"\";\n optionEntries = spec.options.map((option) => {\n const isReview = answered !== null;\n const entry = createOptionButton(option, isReview);\n\n if (isReview) {\n if (option.id === correctOptionId) {\n revealCorrect(entry.button, entry.statusGlyph, entry.statusLabel);\n }\n if (option.id === answered && answered !== correctOptionId) {\n revealIncorrect(entry.button, entry.statusGlyph, entry.statusLabel);\n }\n } else {\n entry.button.addEventListener(\"click\", () => {\n if (completed) return;\n answers[index] = option.id;\n // Reveal correctness and lock this question's options. No\n // auto-advance and no auto-complete: the footer gates progress.\n revealQuestion(index, option.id);\n syncFooter(index);\n });\n }\n\n optionsBox.appendChild(entry.button);\n return entry;\n });\n\n syncFooter(index);\n };\n\n renderQuestion(0);\n\n quizPlaybackSessions.set(container, {\n destroy: () => {\n root.remove();\n },\n });\n}\n\n/** Cleans up the playback session mounted in `container`, if any. */\nexport function unmountQuizPlayback(container: HTMLElement): void {\n quizPlaybackSessions.get(container)?.destroy();\n quizPlaybackSessions.delete(container);\n}\n","import type { QuizData } from \"./schema\";\n\n/**\n * Validates canonical quiz data, returning human-readable error strings\n * indexed per question. An empty array means the document is valid.\n *\n * The legacy flat input format was removed; only the canonical\n * multi-question `QuizData` shape is accepted.\n */\nexport function validateQuizData(data: QuizData): string[] {\n const errors: string[] = [];\n\n if (data.questions.length === 0) {\n errors.push(\"at least one question is required\");\n return errors;\n }\n\n data.questions.forEach((question, index) => {\n if (question.text.trim().length === 0) {\n errors.push(`questions[${index}].text must be a non-empty string`);\n }\n\n if (question.options.length === 0) {\n errors.push(`questions[${index}].at least one option is required`);\n } else {\n question.options.forEach((option, optionIndex) => {\n if (option.text.trim().length === 0) {\n errors.push(\n `questions[${index}].options[${optionIndex}].text must be a non-empty string`,\n );\n }\n });\n }\n\n if (question.correctOptionId === null) {\n errors.push(\n `questions[${index}].exactly one correct option must be resolvable`,\n );\n }\n });\n\n return errors;\n}\n/**\n * Author-facing readiness check for quiz data, used by the content type's\n * `validate`. Returns friendly messages (e.g. \"Question 1 needs text\"); an\n * empty array means the quiz is ready to save.\n */\nexport function getQuizAuthoringIssues(data: QuizData): string[] {\n if (data.questions.length === 0) return [\"Add at least one question\"];\n\n const issues: string[] = [];\n data.questions.forEach((question, index) => {\n const label = `Question ${index + 1}`;\n if (question.text.trim().length === 0) {\n issues.push(`${label} needs text`);\n }\n if (question.options.length < 2) {\n issues.push(`${label} needs at least 2 options`);\n }\n question.options.forEach((option, optionIndex) => {\n if (option.text.trim().length === 0) {\n issues.push(`${label}, option ${optionIndex + 1} needs text`);\n }\n });\n const hasCorrect = question.options.some(\n (option) => option.id === question.correctOptionId,\n );\n if (!hasCorrect) issues.push(`${label} needs a correct answer`);\n });\n return issues;\n}\n","import { ContentType } from \"@interlacejs/core\";\nimport { QuizEditorType, unmountQuizEditor } from \"./quiz-editor\";\nimport { renderQuizPlayback, unmountQuizPlayback } from \"./quiz-player\";\nimport type { QuizData } from \"./schema\";\nimport { getQuizAuthoringIssues } from \"./validate\";\n\n/**\n * Built-in Quiz content type for Interlace. Authors the canonical\n * {@link QuizData} shape with rich media and plays it back with immediate\n * scoring. Registered id is `quiz-editor` — the id the editor's built-in\n * quiz type authors with — so authored documents resolve without extra\n * registry wiring.\n */\nexport const QuizContentType: ContentType<QuizData> = {\n getId: () => \"quiz-editor\",\n getVersion: () => 1,\n getDisplayName: () => \"Quiz\",\n getDescription: () => \"Multiple-choice questions that check understanding\",\n\n validate(data: QuizData): string[] {\n return getQuizAuthoringIssues(data);\n },\n\n getMaximumScore(data): number | undefined {\n return data.questions.length;\n },\n\n async preload(): Promise<void> {\n // No preload needed for quiz content.\n },\n\n renderEditor(\n container: HTMLElement,\n data: QuizData,\n onChange: (newData: QuizData) => void,\n ): void {\n QuizEditorType.renderEditor(container, data, onChange);\n },\n\n updateEditor(\n container: HTMLElement,\n data: QuizData,\n onChange: (newData: QuizData) => void,\n ): void {\n QuizEditorType.updateEditor?.(container, data, onChange);\n },\n\n renderPlayback(\n container: HTMLElement,\n data: QuizData,\n callbacks: { onComplete(score?: number): void },\n ): void {\n renderQuizPlayback(container, data, callbacks);\n },\n\n unmountPlayback(container: HTMLElement): void {\n unmountQuizPlayback(container);\n },\n\n unmount(container: HTMLElement): void {\n unmountQuizEditor(container);\n },\n};\n"],"mappings":";AAAA,SAAsB,6BAA6B;;;ACInD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;ACSP,IAAM,uBAAuB,oBAAI,QAA0C;AAG3E,SAAS,iBACP,WACA,KACA,KACyB;AACzB,MAAI,IAAI,WAAW,EAAG,QAAO;AAC7B,QAAM,MAAM,SAAS,cAAc,KAAK;AACxC,MAAI,YAAY;AAChB,MAAI,MAAM;AACV,MAAI,MAAM,WAAW;AACrB,MAAI,MAAM,SAAS;AACnB,MAAI,MAAM,eAAe,GAAG,OAAO,EAAE;AACrC,MAAI,MAAM,eAAe,GAAG,MAAM,CAAC,CAAC;AACpC,MAAI,IAAK,KAAI,MAAM;AACnB,SAAO;AACT;AAGA,SAAS,WAAW,QAAiC;AACnD,SAAO,WAAW;AAClB,SAAO,MAAM,SAAS;AACxB;AAGA,SAAS,cACP,QACA,OACA,OACM;AACN,SAAO,UAAU,IAAI,8BAA8B;AACnD,SAAO,MAAM,kBAAkB,OAAO;AACtC,SAAO,MAAM,cAAc,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8B;AACpC,sBAAkB,SAAS;AAAA,EAC7B;AACF;","names":["media"]}
|
|
1
|
+
{"version":3,"sources":["../src/quiz-editor.ts","../src/tokens.ts","../src/quiz-player.ts","../src/validate.ts","../src/image-file.ts","../src/quiz-content-type.ts"],"sourcesContent":["import { ContentType, ensureInterlaceStyles } from \"@interlacejs/core\";\nimport { renderQuizPlayback, unmountQuizPlayback } from \"./quiz-player\";\nimport { COLORS, FONTS, RADIUS, SPACE, TYPE } from \"./tokens\";\nimport type {\n QuizData,\n QuizMediaRef,\n QuizOption,\n QuizQuestionSpec,\n} from \"./schema\";\nimport { getQuizAuthoringIssues } from \"./validate\";\nimport { imageFileToDataUrl, MAX_IMAGE_UPLOAD_MB } from \"./image-file\";\n\ninterface QuizEditorController {\n syncTo(data: QuizData, onChange: (next: QuizData) => void): void;\n}\n\n/**\n * Controllers are stashed per container so the slot can hand the same\n * controller back across the mount/update lifecycle. The slot always passes\n * the same container element to `renderEditor`/`updateEditor`/`unmount`.\n */\nconst quizEditorControllers = new WeakMap<HTMLElement, QuizEditorController>();\n\n/** Gives each mounted editor unique element ids and radio group names. */\nlet editorInstanceCount = 0;\n\n/** Fewest options a question may be reduced to via the remove buttons. */\nconst MIN_OPTIONS = 2;\n\n/** Builds a media ref from src/alt text; `undefined` when src is blank. */\nfunction buildMediaRef(src: string, alt: string): QuizMediaRef | undefined {\n if (src.length === 0) return undefined;\n return alt.length > 0 ? { src, alt } : { src };\n}\n\n/** Creates a preview `<img>` for a media ref, or `null` when src is blank. */\nfunction createPreview(\n media: QuizMediaRef | undefined,\n className: string,\n): HTMLImageElement | null {\n if (!media || media.src.length === 0) return null;\n const img = document.createElement(\"img\");\n img.className = className;\n img.src = media.src;\n img.style.maxWidth = \"100%\";\n img.style.maxHeight = \"100%\";\n img.style.objectFit = \"contain\";\n if (media.alt) img.alt = media.alt;\n return img;\n}\n\n/** Renders `media` into `slot`, replacing any previous preview. */\nfunction syncPreview(\n slot: HTMLElement,\n media: QuizMediaRef | undefined,\n className: string,\n): void {\n slot.innerHTML = \"\";\n const img = createPreview(media, className);\n if (img) slot.appendChild(img);\n}\n\n/** Generates an option id that does not collide with existing ids. */\nfunction nextOptionId(options: QuizOption[], index: number): string {\n const base = `opt-${index}`;\n if (!options.some((option) => option.id === base)) return base;\n let candidate = index + 1;\n while (options.some((option) => option.id === `opt-${candidate}`)) {\n candidate += 1;\n }\n return `opt-${candidate}`;\n}\n\n/** Generates a question id that does not collide with existing ids. */\nfunction nextQuestionId(questions: QuizQuestionSpec[], index: number): string {\n const base = `q-${index}`;\n if (!questions.some((question) => question.id === base)) return base;\n let candidate = index + 1;\n while (questions.some((question) => question.id === `q-${candidate}`)) {\n candidate += 1;\n }\n return `q-${candidate}`;\n}\n\n/** An empty question stub so the form is never without a question. */\n/** A new question starts with the minimum of two options, the first correct. */\nfunction emptyQuestion(id: string): QuizQuestionSpec {\n return {\n id,\n text: \"\",\n options: [\n { id: `${id}-a`, text: \"\" },\n { id: `${id}-b`, text: \"\" },\n ],\n correctOptionId: `${id}-a`,\n };\n}\n\n/**\n * Shows or hides an element. Uses inline `display` rather than `hidden`\n * because the shared `interlace-*` rules set `display` and would override\n * the user-agent `[hidden]` rule.\n */\nfunction setShown(el: HTMLElement, shown: boolean, display = \"\"): void {\n el.style.display = shown ? display : \"none\";\n}\n\n/** Sets an input's value only when it differs, so the caret is not moved. */\nfunction setValue(input: HTMLInputElement, value: string): void {\n if (input.value !== value) input.value = value;\n}\n\nfunction createButton(\n text: string,\n variant: \"primary\" | \"secondary\" | \"ghost\",\n className: string,\n): HTMLButtonElement {\n const button = document.createElement(\"button\");\n button.type = \"button\";\n button.className = `interlace-btn interlace-btn--${variant} ${className}`;\n button.textContent = text;\n return button;\n}\n\n/** A quiet \"×\" icon button for per-row remove actions. */\nfunction createRemoveButton(className: string): HTMLButtonElement {\n const button = createButton(\"×\", \"ghost\", `interlace-btn--icon ${className}`);\n button.style.fontSize = `${TYPE.lg}px`;\n button.style.lineHeight = \"1\";\n return button;\n}\n\n/** Enables a remove button, or disables it with `reason` as its tooltip. */\nfunction setRemoveAllowed(\n button: HTMLButtonElement,\n allowed: boolean,\n reason: string,\n): void {\n button.disabled = !allowed;\n if (allowed) button.removeAttribute(\"title\");\n else button.title = reason;\n}\n\nfunction createInput(\n className: string,\n id: string,\n placeholder?: string,\n): HTMLInputElement {\n const input = document.createElement(\"input\");\n input.type = \"text\";\n input.id = id;\n input.className = `interlace-input ${className}`;\n input.style.width = \"100%\";\n input.style.boxSizing = \"border-box\";\n if (placeholder) input.placeholder = placeholder;\n return input;\n}\n\nfunction createLabel(text: string, forId: string): HTMLLabelElement {\n const label = document.createElement(\"label\");\n label.className = \"interlace-label\";\n label.htmlFor = forId;\n label.textContent = text;\n label.style.fontSize = `${TYPE.sm}px`;\n label.style.fontWeight = \"600\";\n return label;\n}\n\n/** A labelled field (label above input) wrapped in `interlace-field`. */\nfunction createField(\n labelText: string,\n input: HTMLInputElement,\n): HTMLDivElement {\n const field = document.createElement(\"div\");\n field.className = \"interlace-field\";\n field.style.display = \"flex\";\n field.style.flexDirection = \"column\";\n field.style.gap = `${SPACE[1]}px`;\n field.append(createLabel(labelText, input.id), input);\n return field;\n}\n\n/** An inline error message element, hidden until a message is set. */\nfunction createErrorText(id: string, className: string): HTMLParagraphElement {\n const error = document.createElement(\"p\");\n error.id = id;\n error.className = `interlace-hint quiz-field-error ${className}`;\n error.style.margin = \"0\";\n error.style.fontSize = `${TYPE.sm}px`;\n error.style.color = COLORS.errorText;\n setShown(error, false);\n return error;\n}\n\n/** Shows `message` for `input` (with aria wiring), or clears it on `null`. */\nfunction setFieldError(\n input: HTMLInputElement,\n error: HTMLElement,\n message: string | null,\n): void {\n if (message) {\n error.textContent = message;\n setShown(error, true);\n input.setAttribute(\"aria-invalid\", \"true\");\n input.setAttribute(\"aria-describedby\", error.id);\n } else {\n error.textContent = \"\";\n setShown(error, false);\n input.removeAttribute(\"aria-invalid\");\n input.removeAttribute(\"aria-describedby\");\n }\n}\n\ninterface MediaEditor {\n root: HTMLDivElement;\n /** The URL field (empty while the image is an upload). */\n srcInput: HTMLInputElement;\n altInput: HTMLInputElement;\n previewSlot: HTMLDivElement;\n /** Patches values/preview in place and shows or collapses the panel. */\n sync(media: QuizMediaRef | undefined, expanded: boolean): void;\n}\n\ninterface MediaEditorOptions {\n /** Class prefix, e.g. `quiz-question-media` → `quiz-question-media-src`. */\n classPrefix: string;\n idPrefix: string;\n /** Accessible name of the \"Add image\" button. */\n addLabel: string;\n previewSlotClass: string;\n previewClass: string;\n /** The author uploaded an image, or edited the URL or alt text. */\n onEdit(media: QuizMediaRef | undefined): void;\n /** The author expanded the panel via \"Add image\". */\n onExpand(): void;\n /** The author removed the image (fields are already cleared). */\n onRemove(): void;\n}\n\n/** Uploaded images are stored in the quiz as data URLs. */\nfunction isDataUrl(src: string): boolean {\n return src.startsWith(\"data:\");\n}\n\n/** A quiet text-style button for secondary actions (\"Use a URL instead\"). */\nfunction createLinkButton(text: string, className: string): HTMLButtonElement {\n const button = createButton(text, \"ghost\", className);\n button.style.padding = `0 ${SPACE[1]}px`;\n button.style.minHeight = \"0\";\n button.style.height = \"auto\";\n button.style.color = COLORS.accent;\n button.style.fontSize = `${TYPE.sm}px`;\n return button;\n}\n\n/**\n * An image picker tucked behind a ghost \"Add image\" button.\n *\n * - No image yet: a drop zone (drag an image in, or browse), or, after\n * \"Use an image URL instead\", a URL field. Uploads are stored in the quiz\n * as data URLs (large ones are made smaller first).\n * - With an image: a thumbnail beside its alt text, with Replace and Remove.\n * A URL image keeps its URL field, so it can be edited in place.\n *\n * The panel opens on demand (or automatically when media exists, via\n * `sync`); Remove clears the image and collapses it again.\n */\nfunction createMediaEditor(options: MediaEditorOptions): MediaEditor {\n const { classPrefix, idPrefix } = options;\n const root = document.createElement(\"div\");\n root.className = classPrefix;\n\n const addButton = createButton(\"+ Add image\", \"ghost\", `${classPrefix}-add`);\n addButton.setAttribute(\"aria-label\", options.addLabel);\n addButton.setAttribute(\"aria-controls\", `${idPrefix}-panel`);\n addButton.style.paddingLeft = `${SPACE[2]}px`;\n addButton.style.paddingRight = `${SPACE[2]}px`;\n\n const panel = document.createElement(\"div\");\n panel.id = `${idPrefix}-panel`;\n panel.className = `${classPrefix}-panel`;\n panel.style.flexDirection = \"column\";\n panel.style.gap = `${SPACE[2]}px`;\n\n const fileInput = document.createElement(\"input\");\n fileInput.type = \"file\";\n fileInput.accept = \"image/*\";\n fileInput.className = `${classPrefix}-file`;\n fileInput.tabIndex = -1;\n fileInput.setAttribute(\"aria-hidden\", \"true\");\n setShown(fileInput, false);\n\n // ── Drop zone (no image yet) ──\n const dropzone = document.createElement(\"div\");\n dropzone.className = `${classPrefix}-dropzone`;\n dropzone.style.flexDirection = \"column\";\n dropzone.style.alignItems = \"center\";\n dropzone.style.gap = `${SPACE[1]}px`;\n dropzone.style.padding = `${SPACE[4]}px ${SPACE[3]}px`;\n dropzone.style.border = `1px dashed ${COLORS.borderStrong}`;\n dropzone.style.borderRadius = `${RADIUS.md}`;\n dropzone.style.backgroundColor = COLORS.surfaceRaised;\n dropzone.style.textAlign = \"center\";\n dropzone.style.cursor = \"pointer\";\n dropzone.style.transition = \"border-color 120ms, background-color 120ms\";\n const dropText = document.createElement(\"p\");\n dropText.style.margin = \"0\";\n dropText.style.fontSize = `${TYPE.sm}px`;\n dropText.style.color = COLORS.text;\n const uploadButton = createLinkButton(\"browse\", `${classPrefix}-upload`);\n uploadButton.style.textDecoration = \"underline\";\n uploadButton.style.fontWeight = \"600\";\n dropText.append(\"Drag an image here, or \", uploadButton);\n const dropHint = document.createElement(\"p\");\n dropHint.className = \"interlace-hint\";\n dropHint.style.margin = \"0\";\n dropHint.textContent = `JPG, PNG, GIF, WebP or SVG, up to ${MAX_IMAGE_UPLOAD_MB} MB`;\n const busyText = document.createElement(\"p\");\n busyText.className = \"interlace-hint\";\n busyText.style.margin = \"0\";\n busyText.textContent = \"Adding image…\";\n busyText.setAttribute(\"role\", \"status\");\n setShown(busyText, false);\n dropzone.append(dropText, dropHint, busyText);\n\n // ── Card: thumbnail beside the URL (URL images), alt text and actions.\n // Shown for an image, or to type a URL (the thumbnail fills in as it\n // loads). The URL field never moves, so typing keeps focus. ──\n const srcInput = createInput(\n `${classPrefix}-src`,\n `${idPrefix}-src`,\n \"https://example.com/image.png\",\n );\n const urlField = createField(\"Image URL\", srcInput);\n const card = document.createElement(\"div\");\n card.className = `${classPrefix}-card`;\n card.style.gap = `${SPACE[3]}px`;\n card.style.alignItems = \"flex-start\";\n card.style.padding = `${SPACE[2]}px`;\n card.style.border = `1px solid ${COLORS.border}`;\n card.style.borderRadius = `${RADIUS.md}`;\n card.style.backgroundColor = COLORS.surfaceRaised;\n const previewSlot = document.createElement(\"div\");\n previewSlot.className = options.previewSlotClass;\n previewSlot.style.flex = \"0 0 auto\";\n previewSlot.style.width = \"112px\";\n previewSlot.style.height = \"84px\";\n previewSlot.style.display = \"flex\";\n previewSlot.style.alignItems = \"center\";\n previewSlot.style.justifyContent = \"center\";\n previewSlot.style.overflow = \"hidden\";\n previewSlot.style.borderRadius = `${RADIUS.sm}`;\n previewSlot.style.backgroundColor = COLORS.surface;\n previewSlot.style.border = `1px solid ${COLORS.border}`;\n previewSlot.style.color = COLORS.textMuted;\n previewSlot.style.fontSize = `${TYPE.sm}px`;\n previewSlot.style.textAlign = \"center\";\n const altInput = createInput(\n `${classPrefix}-alt`,\n `${idPrefix}-alt`,\n \"Describe the image for screen readers\",\n );\n const replaceButton = createLinkButton(\"Replace\", `${classPrefix}-replace`);\n const removeButton = createLinkButton(\"Remove\", `${classPrefix}-remove`);\n removeButton.style.color = COLORS.errorText;\n const actions = document.createElement(\"div\");\n actions.style.display = \"flex\";\n actions.style.gap = `${SPACE[2]}px`;\n actions.append(replaceButton, removeButton);\n const details = document.createElement(\"div\");\n details.style.flex = \"1 1 auto\";\n details.style.minWidth = \"0\";\n details.style.display = \"flex\";\n details.style.flexDirection = \"column\";\n details.style.gap = `${SPACE[1]}px`;\n const altField = createField(\"Alt text\", altInput);\n details.append(urlField, altField, actions);\n card.append(previewSlot, details);\n\n const uploadError = createErrorText(\n `${idPrefix}-upload-error`,\n `${classPrefix}-upload-error`,\n );\n uploadError.setAttribute(\"role\", \"alert\");\n\n // ── Links under the empty state ──\n const modeButton = createLinkButton(\"\", `${classPrefix}-mode`);\n const cancelButton = createLinkButton(\"Cancel\", `${classPrefix}-cancel`);\n cancelButton.style.color = COLORS.textMuted;\n const links = document.createElement(\"div\");\n links.style.justifyContent = \"space-between\";\n links.append(modeButton, cancelButton);\n\n panel.append(fileInput, dropzone, card, uploadError, links);\n root.append(addButton, panel);\n\n // The image's src: the URL typed, or an uploaded image's data URL (which\n // the URL field doesn't show).\n let src = \"\";\n let urlMode = false;\n\n /** Shows the parts that fit the current image and mode. */\n const render = (): void => {\n const hasImage = src.length > 0;\n const img = previewSlot.querySelector(\"img\");\n if (!img) previewSlot.textContent = \"Preview\";\n else\n img.onerror = () => {\n previewSlot.textContent = \"Can't load this image\";\n };\n setShown(dropzone, !hasImage && !urlMode, \"flex\");\n setShown(card, hasImage || urlMode, \"flex\");\n setShown(urlField, urlMode || (hasImage && !isDataUrl(src)), \"flex\");\n setShown(altField, hasImage, \"flex\");\n setShown(actions, hasImage, \"flex\");\n setShown(links, !hasImage, \"flex\");\n modeButton.textContent = urlMode\n ? \"Upload an image instead\"\n : \"Use an image URL instead\";\n };\n\n const setExpanded = (expanded: boolean): void => {\n setShown(panel, expanded, \"flex\");\n setShown(addButton, !expanded);\n addButton.setAttribute(\"aria-expanded\", String(expanded));\n };\n setExpanded(false);\n render();\n\n const setUploadError = (message: string | null): void => {\n uploadError.textContent = message ?? \"\";\n setShown(uploadError, message !== null);\n };\n\n const emit = (): void => {\n const media = buildMediaRef(src, altInput.value);\n syncPreview(previewSlot, media, options.previewClass);\n render();\n options.onEdit(media);\n };\n\n srcInput.addEventListener(\"input\", () => {\n src = srcInput.value;\n setUploadError(null);\n emit();\n });\n altInput.addEventListener(\"input\", emit);\n\n const useFile = async (file: File | undefined): Promise<void> => {\n if (!file) return;\n setUploadError(null);\n setShown(busyText, true);\n try {\n src = await imageFileToDataUrl(file);\n urlMode = false;\n srcInput.value = \"\";\n emit();\n } catch (error) {\n setUploadError(\n error instanceof Error ? error.message : \"Couldn't use that image.\",\n );\n } finally {\n setShown(busyText, false);\n }\n };\n\n fileInput.addEventListener(\"change\", () => {\n const file = fileInput.files?.[0];\n fileInput.value = \"\";\n void useFile(file);\n });\n dropzone.addEventListener(\"click\", () => fileInput.click());\n uploadButton.addEventListener(\"click\", (event) => {\n event.stopPropagation();\n fileInput.click();\n });\n replaceButton.addEventListener(\"click\", () => fileInput.click());\n\n const setDragOver = (over: boolean): void => {\n dropzone.style.borderColor = over ? COLORS.accent : COLORS.borderStrong;\n dropzone.style.backgroundColor = over\n ? COLORS.accentLighter\n : COLORS.surfaceRaised;\n };\n dropzone.addEventListener(\"dragover\", (event) => {\n event.preventDefault();\n setDragOver(true);\n });\n dropzone.addEventListener(\"dragleave\", () => setDragOver(false));\n dropzone.addEventListener(\"drop\", (event) => {\n event.preventDefault();\n setDragOver(false);\n void useFile(event.dataTransfer?.files?.[0]);\n });\n\n modeButton.addEventListener(\"click\", () => {\n urlMode = !urlMode;\n setUploadError(null);\n render();\n if (urlMode) srcInput.focus();\n else uploadButton.focus();\n });\n\n const clear = (): void => {\n src = \"\";\n urlMode = false;\n srcInput.value = \"\";\n altInput.value = \"\";\n setUploadError(null);\n syncPreview(previewSlot, undefined, options.previewClass);\n render();\n setExpanded(false);\n addButton.focus();\n };\n cancelButton.addEventListener(\"click\", clear);\n removeButton.addEventListener(\"click\", () => {\n clear();\n options.onRemove();\n });\n\n addButton.addEventListener(\"click\", () => {\n setExpanded(true);\n options.onExpand();\n uploadButton.focus();\n });\n\n const sync = (media: QuizMediaRef | undefined, expanded: boolean): void => {\n src = media?.src ?? \"\";\n setValue(srcInput, isDataUrl(src) ? \"\" : src);\n setValue(altInput, media?.alt ?? \"\");\n syncPreview(previewSlot, media, options.previewClass);\n // A URL image stays in URL mode, so clearing its URL keeps the field.\n urlMode = src.length > 0 && !isDataUrl(src);\n render();\n setExpanded(expanded);\n };\n\n return { root, srcInput, altInput, previewSlot, sync };\n}\n\ninterface OptionRow {\n row: HTMLDivElement;\n radio: HTMLInputElement;\n textInput: HTMLInputElement;\n error: HTMLParagraphElement;\n media: MediaEditor;\n}\n\n/**\n * Builds the quiz authoring form once and returns a controller whose\n * `syncTo` patches inputs in place (preserving focus) instead of rebuilding\n * the DOM on every keystroke. The form has a question tab list (add,\n * select); the ACTIVE question's text, image and options are edited in the\n * tab panel below it, with the correct answer chosen by a radio on each\n * option row. Switching the selected question rebuilds that question's\n * option rows (an explicit action); within the active question, edits patch\n * in place. All edits emit canonical multi-question {@link QuizData}.\n */\nfunction createQuizEditorController(\n container: HTMLElement,\n data: QuizData,\n onChange: (next: QuizData) => void,\n): QuizEditorController {\n ensureInterlaceStyles(container.ownerDocument);\n editorInstanceCount += 1;\n const uid = `quiz-editor-${editorInstanceCount}`;\n\n container.innerHTML = \"\";\n const root = document.createElement(\"div\");\n root.className = \"quiz-editor\";\n root.style.fontFamily = FONTS.body;\n root.style.color = COLORS.text;\n root.style.lineHeight = \"1.5\";\n root.style.display = \"flex\";\n root.style.flexDirection = \"column\";\n root.style.gap = `${SPACE[3]}px`;\n\n let currentData: QuizData = data;\n let currentOnChange = onChange;\n let selectedIndex = 0;\n let bodyQuestionIndex = -1;\n let optionRows: OptionRow[] = [];\n let tabButtons: HTMLButtonElement[] = [];\n /** Fields the author has blurred; errors only show for these. */\n const touched = new Set<string>();\n /** Media panels the author opened (kept open even while empty). */\n const expandedMedia = new Set<string>();\n\n const emit = (questions: QuizQuestionSpec[]): void => {\n currentOnChange({ questions });\n };\n\n /** Applies `mutate` to the active question and emits the canonical list. */\n const patchActiveQuestion = (\n mutate: (question: QuizQuestionSpec) => QuizQuestionSpec,\n ): void => {\n const active = currentData.questions[selectedIndex];\n if (!active) return;\n const questions = currentData.questions.slice();\n questions[selectedIndex] = mutate(active);\n emit(questions);\n };\n\n /** Stable state key for the active question (or one of its options). */\n const activeKey = (optionIndex?: number): string => {\n const active = currentData.questions[selectedIndex];\n const questionKey = active?.id ?? `#${selectedIndex}`;\n if (optionIndex === undefined) return questionKey;\n return `${questionKey}/${active?.options[optionIndex]?.id ?? `#${optionIndex}`}`;\n };\n\n // --- Question tabs ---\n const questionsHeader = document.createElement(\"div\");\n questionsHeader.id = `${uid}-questions-label`;\n questionsHeader.className = \"interlace-label\";\n questionsHeader.textContent = \"Questions\";\n questionsHeader.style.fontSize = `${TYPE.sm}px`;\n questionsHeader.style.fontWeight = \"600\";\n questionsHeader.style.color = COLORS.textMuted;\n\n const tabsRow = document.createElement(\"div\");\n tabsRow.style.display = \"flex\";\n tabsRow.style.flexWrap = \"wrap\";\n tabsRow.style.alignItems = \"center\";\n tabsRow.style.gap = `${SPACE[2]}px`;\n\n const tabsBar = document.createElement(\"div\");\n tabsBar.className = \"quiz-question-tabs\";\n tabsBar.setAttribute(\"role\", \"tablist\");\n tabsBar.setAttribute(\"aria-labelledby\", questionsHeader.id);\n tabsBar.style.display = \"flex\";\n tabsBar.style.flexWrap = \"wrap\";\n tabsBar.style.gap = `${SPACE[2]}px`;\n\n const addQuestionButton = createButton(\n \"+ Add question\",\n \"secondary\",\n \"quiz-add-question\",\n );\n addQuestionButton.addEventListener(\"click\", () => {\n const id = nextQuestionId(\n currentData.questions,\n currentData.questions.length,\n );\n const questions = [...currentData.questions, emptyQuestion(id)];\n currentData = { questions };\n selectedIndex = questions.length - 1;\n emit(questions);\n bodyQuestionIndex = -1;\n renderTabs();\n syncActiveBody();\n });\n tabsRow.append(tabsBar, addQuestionButton);\n root.append(questionsHeader, tabsRow);\n\n // --- Active question panel ---\n const body = document.createElement(\"div\");\n body.id = `${uid}-panel`;\n body.className = \"quiz-editor-body\";\n body.setAttribute(\"role\", \"tabpanel\");\n body.style.display = \"flex\";\n body.style.flexDirection = \"column\";\n body.style.gap = `${SPACE[4]}px`;\n body.style.padding = `${SPACE[4]}px`;\n body.style.backgroundColor = COLORS.surface;\n body.style.border = `1px solid ${COLORS.border}`;\n body.style.borderRadius = `${RADIUS.md}`;\n root.appendChild(body);\n\n // Question text: label above, remove-question action on the same line.\n const questionInput = createInput(\n \"quiz-question\",\n `${uid}-question`,\n \"Type your question\",\n );\n questionInput.style.fontSize = `${TYPE.md}px`;\n const questionError = createErrorText(\n `${uid}-question-error`,\n \"quiz-question-error\",\n );\n const refreshQuestionError = (): void => {\n const show =\n touched.has(`text:${activeKey()}`) &&\n questionInput.value.trim().length === 0;\n setFieldError(\n questionInput,\n questionError,\n show ? \"Add the question text\" : null,\n );\n };\n questionInput.addEventListener(\"input\", () => {\n patchActiveQuestion((question) => ({\n ...question,\n text: questionInput.value,\n }));\n refreshQuestionError();\n });\n questionInput.addEventListener(\"blur\", () => {\n touched.add(`text:${activeKey()}`);\n refreshQuestionError();\n });\n\n const removeQuestionButton = createRemoveButton(\"quiz-question-remove\");\n removeQuestionButton.addEventListener(\"click\", () =>\n removeQuestion(selectedIndex),\n );\n\n const questionHeader = document.createElement(\"div\");\n questionHeader.style.display = \"flex\";\n questionHeader.style.alignItems = \"center\";\n questionHeader.style.justifyContent = \"space-between\";\n questionHeader.style.gap = `${SPACE[2]}px`;\n questionHeader.append(\n createLabel(\"Question\", questionInput.id),\n removeQuestionButton,\n );\n\n const questionField = document.createElement(\"div\");\n questionField.className = \"interlace-field\";\n questionField.style.display = \"flex\";\n questionField.style.flexDirection = \"column\";\n questionField.style.gap = `${SPACE[1]}px`;\n questionField.append(questionHeader, questionInput, questionError);\n\n const questionMedia = createMediaEditor({\n classPrefix: \"quiz-question-media\",\n idPrefix: `${uid}-question-media`,\n addLabel: \"Add image to question\",\n previewSlotClass: \"quiz-question-media-preview-slot\",\n previewClass: \"quiz-question-media-preview\",\n onEdit: (media) => {\n expandedMedia.add(activeKey());\n patchActiveQuestion((question) => ({ ...question, media }));\n },\n onExpand: () => expandedMedia.add(activeKey()),\n onRemove: () => {\n expandedMedia.delete(activeKey());\n patchActiveQuestion((question) => ({ ...question, media: undefined }));\n },\n });\n questionField.appendChild(questionMedia.root);\n body.appendChild(questionField);\n\n // Options: heading + hint, then one row per option with a correct radio.\n const optionsSection = document.createElement(\"div\");\n optionsSection.style.display = \"flex\";\n optionsSection.style.flexDirection = \"column\";\n optionsSection.style.gap = `${SPACE[2]}px`;\n\n const optionsHeading = document.createElement(\"div\");\n optionsHeading.id = `${uid}-options-label`;\n optionsHeading.className = \"interlace-label quiz-options-heading\";\n optionsHeading.textContent = \"Options\";\n optionsHeading.style.fontSize = `${TYPE.sm}px`;\n optionsHeading.style.fontWeight = \"600\";\n\n const optionsHint = document.createElement(\"p\");\n optionsHint.id = `${uid}-options-hint`;\n optionsHint.className = \"interlace-hint quiz-options-hint\";\n optionsHint.textContent = \"Select the correct answer.\";\n optionsHint.style.margin = \"0\";\n optionsHint.style.fontSize = `${TYPE.sm}px`;\n optionsHint.style.color = COLORS.textMuted;\n\n const optionsContainer = document.createElement(\"div\");\n optionsContainer.className = \"quiz-options\";\n optionsContainer.setAttribute(\"role\", \"radiogroup\");\n optionsContainer.setAttribute(\"aria-labelledby\", optionsHeading.id);\n optionsContainer.setAttribute(\"aria-describedby\", optionsHint.id);\n optionsContainer.style.display = \"flex\";\n optionsContainer.style.flexDirection = \"column\";\n optionsContainer.style.gap = `${SPACE[2]}px`;\n\n const addOptionButton = createButton(\n \"+ Add option\",\n \"secondary\",\n \"quiz-add-option\",\n );\n addOptionButton.style.alignSelf = \"flex-start\";\n addOptionButton.addEventListener(\"click\", () => {\n patchActiveQuestion((question) => {\n const nextOptions: QuizOption[] = [\n ...question.options,\n {\n id: nextOptionId(question.options, question.options.length),\n text: \"\",\n },\n ];\n // Adding the first option defaults it to correct (ported behavior).\n const nextCorrectOptionId =\n question.options.length === 0\n ? nextOptions[0]!.id\n : question.correctOptionId;\n return {\n ...question,\n options: nextOptions,\n correctOptionId: nextCorrectOptionId,\n };\n });\n });\n\n optionsSection.append(\n optionsHeading,\n optionsHint,\n optionsContainer,\n addOptionButton,\n );\n body.appendChild(optionsSection);\n\n container.appendChild(root);\n\n const createOptionRow = (\n option: QuizOption,\n optionIndex: number,\n optionCount: number,\n ): OptionRow => {\n const number = optionIndex + 1;\n const idPrefix = `${uid}-q${selectedIndex}-opt${optionIndex}`;\n\n // Grid: [radio] [label / input / error + image] [remove].\n const row = document.createElement(\"div\");\n row.className = \"quiz-option-row interlace-choice\";\n row.style.display = \"grid\";\n row.style.gridTemplateColumns = \"auto minmax(0, 1fr) auto\";\n row.style.alignItems = \"center\";\n row.style.columnGap = `${SPACE[2]}px`;\n row.style.rowGap = `${SPACE[1]}px`;\n row.style.cursor = \"default\";\n // The inputs draw their own focus rings; skip the card's focus-within ring.\n row.style.outline = \"none\";\n\n const radio = document.createElement(\"input\");\n radio.type = \"radio\";\n radio.name = `${uid}-correct-${selectedIndex}`;\n radio.className = \"quiz-option-correct\";\n radio.value = option.id;\n radio.checked =\n option.id === currentData.questions[selectedIndex]?.correctOptionId;\n radio.setAttribute(\"aria-label\", `Mark option ${number} as correct`);\n radio.style.width = \"18px\";\n radio.style.height = \"18px\";\n radio.style.margin = \"0\";\n radio.style.accentColor = COLORS.accent;\n radio.style.cursor = \"pointer\";\n radio.style.gridColumn = \"1\";\n radio.style.gridRow = \"2\";\n radio.addEventListener(\"change\", () => {\n if (!radio.checked) return;\n patchActiveQuestion((question) => ({\n ...question,\n correctOptionId: question.options[optionIndex]?.id ?? null,\n }));\n });\n\n const textInput = createInput(\n \"quiz-option-text\",\n `${idPrefix}-text`,\n \"Option text\",\n );\n textInput.value = option.text;\n textInput.style.gridColumn = \"2\";\n textInput.style.gridRow = \"2\";\n const label = createLabel(`Option ${number}`, textInput.id);\n label.style.gridColumn = \"2\";\n label.style.gridRow = \"1\";\n\n const error = createErrorText(`${idPrefix}-error`, \"quiz-option-error\");\n const refreshError = (): void => {\n const show =\n touched.has(`opt:${activeKey(optionIndex)}`) &&\n textInput.value.trim().length === 0;\n setFieldError(\n textInput,\n error,\n show ? `Option ${number} needs text` : null,\n );\n };\n textInput.addEventListener(\"input\", () => {\n patchActiveQuestion((question) => {\n const nextOptions = question.options.slice();\n nextOptions[optionIndex] = {\n ...nextOptions[optionIndex]!,\n text: textInput.value,\n };\n return { ...question, options: nextOptions };\n });\n refreshError();\n });\n textInput.addEventListener(\"blur\", () => {\n touched.add(`opt:${activeKey(optionIndex)}`);\n refreshError();\n });\n\n const patchOptionMedia = (media: QuizMediaRef | undefined): void => {\n patchActiveQuestion((question) => {\n const nextOptions = question.options.slice();\n nextOptions[optionIndex] = { ...nextOptions[optionIndex]!, media };\n return { ...question, options: nextOptions };\n });\n };\n const media = createMediaEditor({\n classPrefix: \"quiz-option-media\",\n idPrefix: `${idPrefix}-media`,\n addLabel: `Add image to option ${number}`,\n previewSlotClass: \"quiz-option-media-preview\",\n previewClass: \"quiz-option-thumb\",\n onEdit: (next) => {\n expandedMedia.add(activeKey(optionIndex));\n patchOptionMedia(next);\n },\n onExpand: () => expandedMedia.add(activeKey(optionIndex)),\n onRemove: () => {\n expandedMedia.delete(activeKey(optionIndex));\n patchOptionMedia(undefined);\n },\n });\n\n const details = document.createElement(\"div\");\n details.style.gridColumn = \"2\";\n details.style.gridRow = \"3\";\n details.style.display = \"flex\";\n details.style.flexDirection = \"column\";\n details.style.alignItems = \"flex-start\";\n details.style.gap = `${SPACE[1]}px`;\n media.root.style.alignSelf = \"stretch\";\n details.append(error, media.root);\n\n const remove = createRemoveButton(\"quiz-option-remove\");\n remove.setAttribute(\"aria-label\", `Remove option ${number}`);\n remove.style.gridColumn = \"3\";\n remove.style.gridRow = \"2\";\n setRemoveAllowed(\n remove,\n optionCount > MIN_OPTIONS,\n `A question needs at least ${MIN_OPTIONS} options`,\n );\n remove.addEventListener(\"click\", () => {\n patchActiveQuestion((question) => {\n const removed = question.options[optionIndex];\n const nextOptions = question.options.filter(\n (_, i) => i !== optionIndex,\n );\n return {\n ...question,\n options: nextOptions,\n // Removing the correct option clears correctness; do not shift it.\n correctOptionId:\n removed && removed.id === question.correctOptionId\n ? null\n : question.correctOptionId,\n };\n });\n });\n\n row.append(label, radio, textInput, remove, details);\n optionsContainer.appendChild(row);\n return { row, radio, textInput, error, media };\n };\n\n const selectQuestion = (index: number): void => {\n selectedIndex = index;\n bodyQuestionIndex = -1;\n renderTabs();\n syncActiveBody();\n };\n\n const removeQuestion = (index: number): void => {\n const next = currentData.questions.filter((_, i) => i !== index);\n const questions =\n next.length > 0 ? next : [emptyQuestion(nextQuestionId([], 0))];\n if (selectedIndex === index) {\n selectedIndex = 0; // removing the selected question selects the first remaining\n } else if (index < selectedIndex) {\n selectedIndex -= 1;\n }\n currentData = { questions };\n emit(questions);\n bodyQuestionIndex = -1;\n renderTabs();\n syncActiveBody();\n };\n\n const renderTabs = (): void => {\n tabsBar.innerHTML = \"\";\n const count = currentData.questions.length;\n tabButtons = currentData.questions.map((_, index) => {\n const selected = index === selectedIndex;\n const tab = createButton(\n `Question ${index + 1}`,\n selected ? \"primary\" : \"secondary\",\n \"quiz-question-tab\",\n );\n tab.id = `${uid}-tab-${index}`;\n tab.setAttribute(\"role\", \"tab\");\n tab.setAttribute(\"aria-selected\", String(selected));\n tab.setAttribute(\"aria-controls\", body.id);\n tab.tabIndex = selected ? 0 : -1;\n tab.addEventListener(\"click\", () => selectQuestion(index));\n tab.addEventListener(\"keydown\", (event) => {\n let target = -1;\n if (event.key === \"ArrowRight\") target = (index + 1) % count;\n else if (event.key === \"ArrowLeft\")\n target = (index - 1 + count) % count;\n else if (event.key === \"Home\") target = 0;\n else if (event.key === \"End\") target = count - 1;\n if (target < 0) return;\n event.preventDefault();\n selectQuestion(target);\n tabButtons[target]?.focus();\n });\n tabsBar.appendChild(tab);\n return tab;\n });\n\n body.setAttribute(\"aria-labelledby\", `${uid}-tab-${selectedIndex}`);\n removeQuestionButton.setAttribute(\n \"aria-label\",\n `Remove question ${selectedIndex + 1}`,\n );\n setRemoveAllowed(\n removeQuestionButton,\n count > 1,\n \"A quiz needs at least one question\",\n );\n };\n\n const syncActiveBody = (): void => {\n const active = currentData.questions[selectedIndex];\n if (!active) return;\n\n setValue(questionInput, active.text);\n questionMedia.sync(\n active.media,\n !!active.media || expandedMedia.has(activeKey()),\n );\n refreshQuestionError();\n\n const options = active.options;\n if (\n bodyQuestionIndex !== selectedIndex ||\n optionRows.length !== options.length\n ) {\n // Question switch or option count change: rebuild the active question's rows.\n optionsContainer.innerHTML = \"\";\n optionRows = options.map((option, optionIndex) =>\n createOptionRow(option, optionIndex, options.length),\n );\n bodyQuestionIndex = selectedIndex;\n }\n // Patch values in place, preserving input focus.\n optionRows.forEach((row, optionIndex) => {\n const option = options[optionIndex]!;\n setValue(row.textInput, option.text);\n row.radio.value = option.id;\n row.radio.checked = option.id === active.correctOptionId;\n row.media.sync(\n option.media,\n !!option.media || expandedMedia.has(activeKey(optionIndex)),\n );\n const show =\n touched.has(`opt:${activeKey(optionIndex)}`) &&\n option.text.trim().length === 0;\n setFieldError(\n row.textInput,\n row.error,\n show ? `Option ${optionIndex + 1} needs text` : null,\n );\n });\n };\n\n const syncTo = (\n nextData: QuizData,\n nextOnChange: (next: QuizData) => void,\n ): void => {\n currentData = nextData;\n currentOnChange = nextOnChange;\n if (currentData.questions.length === 0) {\n currentData = { questions: [emptyQuestion(\"q-0\")] };\n }\n if (selectedIndex >= currentData.questions.length) {\n selectedIndex = 0;\n }\n renderTabs();\n syncActiveBody();\n };\n\n renderTabs();\n syncActiveBody();\n\n return { syncTo };\n}\n\nfunction getOrCreateQuizEditorController(\n container: HTMLElement,\n data: QuizData,\n onChange: (next: QuizData) => void,\n): QuizEditorController {\n let controller = quizEditorControllers.get(container);\n if (!controller) {\n controller = createQuizEditorController(container, data, onChange);\n quizEditorControllers.set(container, controller);\n }\n return controller;\n}\n\n/** Tears down the editor controller mounted in `container`, if any. */\nexport function unmountQuizEditor(container: HTMLElement): void {\n quizEditorControllers.delete(container);\n container.innerHTML = \"\";\n}\n\n/**\n * Built-in Quiz editor content type. Authors the canonical multi-question\n * {@link QuizData} shape with rich media (the single supported format).\n * Registered id is `quiz-editor`, matching the player's built-in quiz\n * content type.\n */\nexport const QuizEditorType: ContentType<QuizData> = {\n getId: () => \"quiz-editor\",\n getVersion: () => 1,\n getDisplayName: () => \"Quiz\",\n getDescription: () => \"Multiple-choice questions that check understanding\",\n\n validate(data: QuizData): string[] {\n return getQuizAuthoringIssues(data);\n },\n\n getMaximumScore(data): number | undefined {\n return data.questions.length;\n },\n\n async preload(): Promise<void> {\n // No preload needed for quiz content.\n },\n\n renderEditor(\n container: HTMLElement,\n data: QuizData,\n onChange: (newData: QuizData) => void,\n ): void {\n getOrCreateQuizEditorController(container, data, onChange).syncTo(\n data,\n onChange,\n );\n },\n\n updateEditor(\n container: HTMLElement,\n data: QuizData,\n onChange: (newData: QuizData) => void,\n ): void {\n getOrCreateQuizEditorController(container, data, onChange).syncTo(\n data,\n onChange,\n );\n },\n\n renderPlayback(\n container: HTMLElement,\n data: QuizData,\n callbacks: { onComplete(score?: number): void },\n ): void {\n renderQuizPlayback(container, data, callbacks);\n },\n\n unmountPlayback(container: HTMLElement): void {\n unmountQuizPlayback(container);\n },\n\n unmount(container: HTMLElement): void {\n unmountQuizEditor(container);\n },\n};\n","/**\n * Interlace design tokens, re-exported from `@interlacejs/core` so every\n * package shares one themeable set (CSS custom properties with defaults).\n */\nexport {\n COLORS,\n CONTROL_HEIGHT,\n FOCUS_RING,\n FONTS,\n RADIUS,\n SHADOWS,\n SPACE,\n TYPE,\n} from \"@interlacejs/core\";\n","import type { QuizData, QuizOption } from \"./schema\";\nimport { COLORS, FONTS, RADIUS, SPACE, TYPE } from \"./tokens\";\n\nexport interface QuizPlaybackCallbacks {\n onComplete(score?: number): void;\n}\n\ninterface QuizPlaybackSession {\n destroy: () => void;\n}\n\ninterface OptionEntry {\n button: HTMLButtonElement;\n option: QuizOption;\n statusGlyph: HTMLSpanElement;\n statusLabel: HTMLSpanElement;\n}\n\n/**\n * Per-container playback sessions, so `unmountQuizPlayback` can tear down\n * the listeners built by `renderQuizPlayback`.\n */\nconst quizPlaybackSessions = new WeakMap<HTMLElement, QuizPlaybackSession>();\n\n/** Creates a playback media `<img>`, or `null` when src is blank. */\nfunction createMediaImage(\n className: string,\n src: string,\n alt: string | undefined,\n): HTMLImageElement | null {\n if (src.length === 0) return null;\n const img = document.createElement(\"img\");\n img.className = className;\n img.src = src;\n img.style.maxWidth = \"100%\";\n img.style.height = \"auto\";\n img.style.borderRadius = `${RADIUS.sm}`;\n img.style.marginBottom = `${SPACE[2]}px`;\n if (alt) img.alt = alt;\n return img;\n}\n\n/** Locks an option button so it can no longer be clicked. */\nfunction lockOption(button: HTMLButtonElement): void {\n button.disabled = true;\n button.style.cursor = \"default\";\n}\n\n/** Reveals the correct-answer state on an option button. */\nfunction revealCorrect(\n button: HTMLButtonElement,\n glyph: HTMLSpanElement,\n label: HTMLSpanElement,\n): void {\n button.classList.add(\"quiz-playback-option-correct\");\n button.style.backgroundColor = COLORS.correctBg;\n button.style.borderColor = COLORS.correctBg;\n button.style.color = COLORS.correctText;\n glyph.textContent = \"✓\";\n label.textContent = \"Correct\";\n glyph.style.opacity = \"1\";\n label.style.opacity = \"1\";\n}\n\n/** Reveals the wrong-answer state on the selected option button. */\nfunction revealIncorrect(\n button: HTMLButtonElement,\n glyph: HTMLSpanElement,\n label: HTMLSpanElement,\n): void {\n button.classList.add(\"quiz-playback-option-incorrect\");\n button.style.backgroundColor = COLORS.incorrectBg;\n button.style.borderColor = COLORS.incorrectBorder;\n button.style.color = COLORS.incorrectText;\n glyph.textContent = \"✕\";\n label.textContent = \"Incorrect\";\n glyph.style.opacity = \"1\";\n label.style.opacity = \"1\";\n}\n\n/**\n * Renders a multi-question quiz into `container`: one question at a time\n * with a \"Question i of n\" indicator, per-question media and option buttons,\n * and an explicit navigation footer. Answering a question reveals\n * correctness and locks its options; the user then advances with **Next**.\n * On the final question, clicking **Next** reports the per-question\n * correct count (`onComplete(correctCount)`, one point per question) ONCE,\n * as the click handler's final statement. **Previous** returns to an\n * answered question in its locked, review-only state. The document is the\n * canonical single-format {@link QuizData} shape.\n */\nexport function renderQuizPlayback(\n container: HTMLElement,\n data: QuizData,\n callbacks: QuizPlaybackCallbacks,\n): void {\n // Destroy any session already mounted in this container: the overlay\n // lifecycle may re-render without an intervening unmount, and overwriting\n // the WeakMap entry would leak the first root (and its click listeners).\n unmountQuizPlayback(container);\n\n const total = data.questions.length;\n // Per-question recorded selections; back-navigation and the final\n // aggregate both read from here, and reveal locks make it stable.\n const answers: (string | null)[] = data.questions.map(() => null);\n let currentIndex = 0;\n let completed = false;\n\n const root = document.createElement(\"div\");\n root.className = \"quiz-playback\";\n root.style.fontFamily = FONTS.body;\n root.style.color = COLORS.text;\n root.style.lineHeight = \"1.5\";\n\n const indicator = document.createElement(\"div\");\n indicator.className = \"quiz-playback-indicator\";\n indicator.style.fontSize = `${TYPE.xs}px`;\n indicator.style.fontWeight = \"600\";\n indicator.style.color = COLORS.textMuted;\n indicator.style.marginBottom = `${SPACE[2]}px`;\n indicator.style.textTransform = \"uppercase\";\n indicator.style.letterSpacing = \"0.06em\";\n root.appendChild(indicator);\n\n const question = document.createElement(\"p\");\n question.className = \"quiz-playback-question\";\n question.style.margin = `0 0 ${SPACE[2]}px 0`;\n question.style.fontFamily = FONTS.display;\n question.style.fontSize = `${TYPE.lg}px`;\n question.style.fontWeight = \"600\";\n root.appendChild(question);\n\n const questionMediaSlot = document.createElement(\"div\");\n root.appendChild(questionMediaSlot);\n\n const optionsBox = document.createElement(\"div\");\n optionsBox.className = \"quiz-playback-options\";\n optionsBox.style.display = \"flex\";\n optionsBox.style.flexDirection = \"column\";\n optionsBox.style.gap = `${SPACE[2]}px`;\n root.appendChild(optionsBox);\n\n // Navigation footer: Previous (review-only back) and Next. The final\n // question uses the same Next label; clicking it aggregates the score\n // and fires onComplete once.\n const navFooter = document.createElement(\"div\");\n navFooter.className = \"quiz-playback-nav\";\n navFooter.style.display = \"flex\";\n navFooter.style.justifyContent = \"flex-end\";\n navFooter.style.gap = `${SPACE[2]}px`;\n navFooter.style.marginTop = `${SPACE[4]}px`;\n root.appendChild(navFooter);\n\n const prevButton = document.createElement(\"button\");\n prevButton.type = \"button\";\n prevButton.className = \"quiz-playback-prev\";\n prevButton.textContent = \"Previous\";\n prevButton.style.padding = `${SPACE[2]}px ${SPACE[4]}px`;\n prevButton.style.backgroundColor = COLORS.surface;\n prevButton.style.border = `1px solid ${COLORS.borderStrong}`;\n prevButton.style.borderRadius = `${RADIUS.md}`;\n prevButton.style.color = COLORS.text;\n prevButton.style.cursor = \"pointer\";\n prevButton.style.fontSize = `${TYPE.base}px`;\n prevButton.style.fontWeight = \"600\";\n prevButton.style.transition = \"background-color 150ms ease\";\n prevButton.addEventListener(\"click\", () => {\n if (currentIndex > 0) {\n renderQuestion(currentIndex - 1);\n }\n });\n navFooter.appendChild(prevButton);\n\n const nextButton = document.createElement(\"button\");\n nextButton.type = \"button\";\n nextButton.className = \"quiz-playback-next\";\n nextButton.textContent = \"Next\";\n nextButton.disabled = true;\n nextButton.style.padding = `${SPACE[2]}px ${SPACE[4]}px`;\n nextButton.style.backgroundColor = COLORS.accent;\n nextButton.style.border = \"none\";\n nextButton.style.borderRadius = `${RADIUS.md}`;\n nextButton.style.color = COLORS.accentContrast;\n nextButton.style.cursor = \"pointer\";\n nextButton.style.fontSize = `${TYPE.base}px`;\n nextButton.style.fontWeight = \"600\";\n nextButton.style.transition =\n \"background-color 150ms ease, opacity 150ms ease\";\n nextButton.addEventListener(\"click\", () => {\n if (completed) return;\n if (currentIndex < total - 1) {\n renderQuestion(currentIndex + 1);\n } else {\n // Final question: aggregate the per-question answers.\n completed = true;\n const correctCount = data.questions.reduce(\n (count, questionSpec, questionIndex) =>\n count +\n (answers[questionIndex] !== null &&\n answers[questionIndex] === questionSpec.correctOptionId\n ? 1\n : 0),\n 0,\n );\n nextButton.disabled = true;\n nextButton.style.opacity = \"0.55\";\n callbacks.onComplete(correctCount);\n }\n });\n navFooter.appendChild(nextButton);\n\n container.appendChild(root);\n\n let optionEntries: OptionEntry[] = [];\n\n const syncFooter = (index: number): void => {\n prevButton.style.display = index > 0 ? \"block\" : \"none\";\n nextButton.textContent = \"Next\";\n const answered = answers[index] !== null;\n nextButton.disabled = completed || !answered;\n nextButton.style.opacity = nextButton.disabled ? \"0.55\" : \"1\";\n };\n\n const createOptionButton = (\n option: QuizOption,\n isReview: boolean,\n ): OptionEntry => {\n const button = document.createElement(\"button\");\n button.type = \"button\";\n button.className = \"quiz-playback-option\";\n button.style.display = \"flex\";\n button.style.alignItems = \"center\";\n button.style.gap = `${SPACE[2]}px`;\n button.style.width = \"100%\";\n button.style.padding = `${SPACE[3]}px ${SPACE[4]}px`;\n button.style.backgroundColor = COLORS.surface;\n button.style.border = `1px solid ${COLORS.borderStrong}`;\n button.style.borderRadius = `${RADIUS.md}`;\n button.style.cursor = \"pointer\";\n button.style.fontSize = `${TYPE.base}px`;\n button.style.color = COLORS.text;\n button.style.textAlign = \"left\";\n button.style.transition =\n \"background-color 150ms ease, border-color 150ms ease, color 150ms ease\";\n\n const text = document.createElement(\"span\");\n text.className = \"quiz-playback-option-text\";\n text.textContent = option.text;\n text.style.flex = \"1\";\n button.appendChild(text);\n\n const thumbnail = createMediaImage(\n \"quiz-playback-option-media\",\n option.media?.src ?? \"\",\n option.media?.alt,\n );\n if (thumbnail) button.appendChild(thumbnail);\n\n const status = document.createElement(\"span\");\n status.style.display = \"flex\";\n status.style.alignItems = \"center\";\n status.style.gap = `${SPACE[1]}px`;\n status.style.marginLeft = \"auto\";\n status.style.transition = \"opacity 150ms ease\";\n\n const glyph = document.createElement(\"span\");\n glyph.style.fontWeight = \"700\";\n glyph.style.fontSize = `${TYPE.md}px`;\n glyph.style.lineHeight = \"1\";\n status.appendChild(glyph);\n\n const label = document.createElement(\"span\");\n label.style.fontWeight = \"600\";\n label.style.fontSize = `${TYPE.sm}px`;\n label.style.letterSpacing = \"0.04em\";\n status.appendChild(label);\n\n button.appendChild(status);\n\n if (isReview) {\n lockOption(button);\n }\n\n return { button, option, statusGlyph: glyph, statusLabel: label };\n };\n\n const revealQuestion = (\n questionIndex: number,\n selectedOptionId: string,\n ): void => {\n const spec = data.questions[questionIndex]!;\n const correctOptionId = spec.correctOptionId;\n\n optionEntries.forEach((entry) => {\n lockOption(entry.button);\n if (entry.option.id === correctOptionId) {\n revealCorrect(entry.button, entry.statusGlyph, entry.statusLabel);\n }\n if (\n entry.option.id === selectedOptionId &&\n selectedOptionId !== correctOptionId\n ) {\n revealIncorrect(entry.button, entry.statusGlyph, entry.statusLabel);\n }\n });\n };\n\n const renderQuestion = (index: number): void => {\n currentIndex = index;\n const spec = data.questions[index]!;\n const correctOptionId = spec.correctOptionId;\n const answered = answers[index] ?? null;\n\n indicator.textContent = `Question ${index + 1} of ${total}`;\n question.textContent = spec.text;\n questionMediaSlot.innerHTML = \"\";\n const questionMedia = createMediaImage(\n \"quiz-playback-question-media\",\n spec.media?.src ?? \"\",\n spec.media?.alt,\n );\n if (questionMedia) questionMediaSlot.appendChild(questionMedia);\n\n optionsBox.innerHTML = \"\";\n optionEntries = spec.options.map((option) => {\n const isReview = answered !== null;\n const entry = createOptionButton(option, isReview);\n\n if (isReview) {\n if (option.id === correctOptionId) {\n revealCorrect(entry.button, entry.statusGlyph, entry.statusLabel);\n }\n if (option.id === answered && answered !== correctOptionId) {\n revealIncorrect(entry.button, entry.statusGlyph, entry.statusLabel);\n }\n } else {\n entry.button.addEventListener(\"click\", () => {\n if (completed) return;\n answers[index] = option.id;\n // Reveal correctness and lock this question's options. No\n // auto-advance and no auto-complete: the footer gates progress.\n revealQuestion(index, option.id);\n syncFooter(index);\n });\n }\n\n optionsBox.appendChild(entry.button);\n return entry;\n });\n\n syncFooter(index);\n };\n\n renderQuestion(0);\n\n quizPlaybackSessions.set(container, {\n destroy: () => {\n root.remove();\n },\n });\n}\n\n/** Cleans up the playback session mounted in `container`, if any. */\nexport function unmountQuizPlayback(container: HTMLElement): void {\n quizPlaybackSessions.get(container)?.destroy();\n quizPlaybackSessions.delete(container);\n}\n","import type { QuizData } from \"./schema\";\n\n/**\n * Validates canonical quiz data, returning human-readable error strings\n * indexed per question. An empty array means the document is valid.\n *\n * The legacy flat input format was removed; only the canonical\n * multi-question `QuizData` shape is accepted.\n */\nexport function validateQuizData(data: QuizData): string[] {\n const errors: string[] = [];\n\n if (data.questions.length === 0) {\n errors.push(\"at least one question is required\");\n return errors;\n }\n\n data.questions.forEach((question, index) => {\n if (question.text.trim().length === 0) {\n errors.push(`questions[${index}].text must be a non-empty string`);\n }\n\n if (question.options.length === 0) {\n errors.push(`questions[${index}].at least one option is required`);\n } else {\n question.options.forEach((option, optionIndex) => {\n if (option.text.trim().length === 0) {\n errors.push(\n `questions[${index}].options[${optionIndex}].text must be a non-empty string`,\n );\n }\n });\n }\n\n if (question.correctOptionId === null) {\n errors.push(\n `questions[${index}].exactly one correct option must be resolvable`,\n );\n }\n });\n\n return errors;\n}\n/**\n * Author-facing readiness check for quiz data, used by the content type's\n * `validate`. Returns friendly messages (e.g. \"Question 1 needs text\"); an\n * empty array means the quiz is ready to save.\n */\nexport function getQuizAuthoringIssues(data: QuizData): string[] {\n if (data.questions.length === 0) return [\"Add at least one question\"];\n\n const issues: string[] = [];\n data.questions.forEach((question, index) => {\n const label = `Question ${index + 1}`;\n if (question.text.trim().length === 0) {\n issues.push(`${label} needs text`);\n }\n if (question.options.length < 2) {\n issues.push(`${label} needs at least 2 options`);\n }\n question.options.forEach((option, optionIndex) => {\n if (option.text.trim().length === 0) {\n issues.push(`${label}, option ${optionIndex + 1} needs text`);\n }\n });\n const hasCorrect = question.options.some(\n (option) => option.id === question.correctOptionId,\n );\n if (!hasCorrect) issues.push(`${label} needs a correct answer`);\n });\n return issues;\n}\n","/**\n * Turns an image the author uploads into a data URL stored in the quiz\n * itself, so quizzes need no image hosting. Large images are scaled down\n * and re-encoded to keep documents small.\n */\n\n/** Largest file an author may choose. */\nexport const MAX_IMAGE_UPLOAD_MB = 10;\n\n/** Images up to this size are kept as they are (keeps GIF animation). */\nconst KEEP_AS_IS_BYTES = 200 * 1024;\n\n/** Larger images are scaled to fit within this many pixels. */\nconst MAX_DIMENSION = 1280;\n\n/** Longest data URL we embed (about 1 MB of image). */\nconst MAX_DATA_URL_LENGTH = 1.4 * 1024 * 1024;\n\nconst TOO_LARGE = \"This image is too large. Try a smaller one, or use a URL.\";\n\nexport async function imageFileToDataUrl(file: File): Promise<string> {\n if (!file.type.startsWith(\"image/\")) {\n throw new Error(\"Choose an image file.\");\n }\n if (file.size > MAX_IMAGE_UPLOAD_MB * 1024 * 1024) {\n throw new Error(`The image must be ${MAX_IMAGE_UPLOAD_MB} MB or smaller.`);\n }\n\n let url: string;\n if (file.size <= KEEP_AS_IS_BYTES || file.type === \"image/svg+xml\") {\n url = await readAsDataUrl(file);\n } else {\n url = await resize(file);\n }\n if (url.length > MAX_DATA_URL_LENGTH) throw new Error(TOO_LARGE);\n return url;\n}\n\nfunction readAsDataUrl(file: File): Promise<string> {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(String(reader.result));\n reader.onerror = () => reject(new Error(\"Couldn't read that image.\"));\n reader.readAsDataURL(file);\n });\n}\n\nasync function resize(file: File): Promise<string> {\n const image = await loadImage(file);\n const longest = Math.max(image.naturalWidth, image.naturalHeight);\n const scale = Math.min(1, MAX_DIMENSION / longest);\n const canvas = document.createElement(\"canvas\");\n canvas.width = Math.max(1, Math.round(image.naturalWidth * scale));\n canvas.height = Math.max(1, Math.round(image.naturalHeight * scale));\n const context = canvas.getContext(\"2d\");\n if (!context) throw new Error(\"Couldn't read that image.\");\n context.drawImage(image, 0, 0, canvas.width, canvas.height);\n\n // WebP keeps transparency; browsers that can't encode it give PNG.\n const type = file.type === \"image/jpeg\" ? \"image/jpeg\" : \"image/webp\";\n const url = canvas.toDataURL(type, 0.85);\n return url.length <= MAX_DATA_URL_LENGTH\n ? url\n : canvas.toDataURL(\"image/jpeg\", 0.8);\n}\n\nfunction loadImage(file: File): Promise<HTMLImageElement> {\n return new Promise((resolve, reject) => {\n const objectUrl = URL.createObjectURL(file);\n const image = new Image();\n image.onload = () => {\n URL.revokeObjectURL(objectUrl);\n resolve(image);\n };\n image.onerror = () => {\n URL.revokeObjectURL(objectUrl);\n reject(new Error(\"Couldn't read that image.\"));\n };\n image.src = objectUrl;\n });\n}\n","import { ContentType } from \"@interlacejs/core\";\nimport { QuizEditorType, unmountQuizEditor } from \"./quiz-editor\";\nimport { renderQuizPlayback, unmountQuizPlayback } from \"./quiz-player\";\nimport type { QuizData } from \"./schema\";\nimport { getQuizAuthoringIssues } from \"./validate\";\n\n/**\n * Built-in Quiz content type for Interlace. Authors the canonical\n * {@link QuizData} shape with rich media and plays it back with immediate\n * scoring. Registered id is `quiz-editor` — the id the editor's built-in\n * quiz type authors with — so authored documents resolve without extra\n * registry wiring.\n */\nexport const QuizContentType: ContentType<QuizData> = {\n getId: () => \"quiz-editor\",\n getVersion: () => 1,\n getDisplayName: () => \"Quiz\",\n getDescription: () => \"Multiple-choice questions that check understanding\",\n\n validate(data: QuizData): string[] {\n return getQuizAuthoringIssues(data);\n },\n\n getMaximumScore(data): number | undefined {\n return data.questions.length;\n },\n\n async preload(): Promise<void> {\n // No preload needed for quiz content.\n },\n\n renderEditor(\n container: HTMLElement,\n data: QuizData,\n onChange: (newData: QuizData) => void,\n ): void {\n QuizEditorType.renderEditor(container, data, onChange);\n },\n\n updateEditor(\n container: HTMLElement,\n data: QuizData,\n onChange: (newData: QuizData) => void,\n ): void {\n QuizEditorType.updateEditor?.(container, data, onChange);\n },\n\n renderPlayback(\n container: HTMLElement,\n data: QuizData,\n callbacks: { onComplete(score?: number): void },\n ): void {\n renderQuizPlayback(container, data, callbacks);\n },\n\n unmountPlayback(container: HTMLElement): void {\n unmountQuizPlayback(container);\n },\n\n unmount(container: HTMLElement): void {\n unmountQu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AS;AAAA,EAC/C;AAAA,EAEA,gBAAgB,WAA8B;AAC5C,wBAAoB,SAAS;AAAA,EAC/B;AAAA,EAEA,QAAQ,WAA8B;AACpC,sBAAkB,SAAS;AAAA,EAC7B;AACF;","names":["media"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interlacejs/quiz",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Interlace quiz content type: data schema, validation, and playback contract.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"vitest": "^2.1.9"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@interlacejs/core": "0.
|
|
44
|
+
"@interlacejs/core": "0.3.0"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "tsup",
|