@pie-element/inline-dropdown 11.0.8-next.20261024044430 → 11.0.8-next.20261024053312
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/browser/author/index.js +1 -1
- package/dist/browser/controller/index.js +1 -1
- package/dist/browser/controller/index.js.map +1 -1
- package/dist/browser/delivery/index.js +1 -1
- package/dist/browser/editor-runtime/author/index.js +1 -1
- package/dist/browser/editor-runtime/controller/index.js +1 -1
- package/dist/browser/editor-runtime/controller/index.js.map +1 -1
- package/dist/browser/editor-runtime/delivery/index.js +1 -1
- package/dist/schemas/configuration.schema.json +1 -1
- package/dist/schemas/model.schema.json +1 -1
- package/dist/schemas/session.schema.json +1 -1
- package/package.json +9 -9
|
@@ -44971,7 +44971,7 @@ var MG = Fe, NG = MG.default, PG = NG && typeof NG == "object" ? NG : MG, FG = j
|
|
|
44971
44971
|
}
|
|
44972
44972
|
}, DK = Object.freeze({
|
|
44973
44973
|
name: "@pie-element/inline-dropdown",
|
|
44974
|
-
version: "11.0.8-next.
|
|
44974
|
+
version: "11.0.8-next.20261024053312"
|
|
44975
44975
|
});
|
|
44976
44976
|
//#endregion
|
|
44977
44977
|
export { EK as default, DK as piePackage };
|
|
@@ -193,7 +193,7 @@ var x = (e, t) => new Promise((n) => {
|
|
|
193
193
|
}), o;
|
|
194
194
|
}, w = Object.freeze({
|
|
195
195
|
name: "@pie-element/inline-dropdown",
|
|
196
|
-
version: "11.0.8-next.
|
|
196
|
+
version: "11.0.8-next.20261024053312"
|
|
197
197
|
});
|
|
198
198
|
//#endregion
|
|
199
199
|
export { x as createCorrectResponseSession, y as getLogTrace, v as getScore, _ as model, g as normalize, b as outcome, w as piePackage, C as validate };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["defaults","reduce","map","lockChoices","getShuffledChoices","isEmpty","partialScoring","Gn","hn","An","e","t","r","i","n","a","s","o","c","defaults_default","getAllCorrectResponses","correctAnswers","choices","key","respArea","choice","alternateResponse","getFeedback","correct","normalize","question","model","normalizedQuestion","session","area","obj","feedback","env","allCorrectResponses","respAreaLength","correctResponses","result","answer","value","correctChoice","isCorrect","shuffledValues","keys","us","part","update","resolve","storedValues","Cn","updateSession","teacherInstructions","rationale","choicesWillNullRationales","currentValue","acc","getScore","maxScore","config","correctCount","total","str","getLogTrace","traceLog","responseAreaKeys","totalAreas","selectedAreas","val","studentSelection","areaKey","correctOptions","opt","partialScoringEnabled","score","outcome","createCorrectResponseSession","correctChoices","getContent","html","validate","errors","field","nbOfResponseAreas","markup","maxResponseAreas","allChoices","choiceKey","maxResponseAreaChoices","piePackage","\"name\"","\"version\""],"sources":["../../../../../shared/controller-utils/dist/index.js","../../../src/controller/defaults.ts","../../../src/controller/utils.ts","../../../src/controller/index.ts"],"sourcesContent":["//#region \\0rolldown/runtime.js\nvar e = Object.defineProperty, t = (t, n) => {\n\tlet r = {};\n\tfor (var i in t) e(r, i, {\n\t\tget: t[i],\n\t\tenumerable: !0\n\t});\n\treturn n || e(r, Symbol.toStringTag, { value: \"Module\" }), r;\n};\n//#endregion\n//#region src/persistence.ts\nfunction n(e) {\n\treturn Array.isArray(e) ? e.filter((e) => e != null) : [];\n}\nfunction r(e) {\n\tlet t = [...e];\n\tfor (let e = t.length - 1; e > 0; e--) {\n\t\tlet n = Math.floor(Math.random() * (e + 1));\n\t\t[t[e], t[n]] = [t[n], t[e]];\n\t}\n\treturn t;\n}\nfunction i(e) {\n\treturn e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == \"object\" && Object.keys(e).length === 0;\n}\nasync function a(e, t, a, o = \"value\") {\n\tlet s = n(t?.data?.shuffledValues ?? t?.shuffledValues ?? []);\n\tif (!t) {\n\t\tconsole.warn(\"Unable to save shuffled choices because there's no session.\");\n\t\treturn;\n\t}\n\tif (!i(s)) return n(s.map((t) => e.find((e) => e[o] === t)));\n\tlet c = r(e);\n\tif (a && typeof a == \"function\") try {\n\t\tlet e = n(c.map((e) => e[o]));\n\t\ti(e) ? console.error(`shuffledValues is an empty array - refusing to call updateSession. shuffledChoices: ${JSON.stringify(c)}, key: ${o}`) : await a(t.id, t.element, { shuffledValues: e });\n\t} catch (e) {\n\t\tconsole.warn(\"Unable to save shuffled order for choices\"), console.error(e);\n\t}\n\telse console.warn(\"Unable to save shuffled choices, shuffle will happen every time.\");\n\treturn c;\n}\nfunction o(e, t, n) {\n\treturn !!(e.lockChoiceOrder || n?.[\"@pie-element\"]?.lockChoiceOrder);\n}\n//#endregion\n//#region src/partial-scoring.ts\nvar s = /* @__PURE__ */ t({ enabled: () => c });\nfunction c(e, t, n) {\n\treturn e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n != \"boolean\" || n;\n}\n//#endregion\nexport { a as getShuffledChoices, o as lockChoices, s as partialScoring };\n","import type { InlineDropdownModel } from '../types.js';\n\nexport default {\n alternateResponse: {},\n choiceRationaleEnabled: true,\n choices: {},\n disabled: false,\n displayType: 'block',\n markup: '',\n mode: 'gather',\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n shuffle: true,\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n} satisfies Omit<InlineDropdownModel, 'id' | 'element'>;\n","import { forEach } from '@pie-element/shared-lodash';\nimport type { Choice, InlineDropdownModel } from '../types.js';\n\nexport const getAllCorrectResponses = ({\n choices,\n alternateResponse,\n}: Partial<Pick<InlineDropdownModel, 'choices' | 'alternateResponse'>>) => {\n alternateResponse = alternateResponse || {};\n const correctAnswers: Record<string, string[]> = {};\n\n forEach<Choice[]>(choices, (respArea, key) => {\n if (!correctAnswers[key]) {\n correctAnswers[key] = [];\n }\n\n if (respArea) {\n respArea.forEach((choice) => {\n if (choice.correct) {\n correctAnswers[key].push(choice.value);\n\n if (alternateResponse[key]) {\n correctAnswers[key] = [...correctAnswers[key], ...alternateResponse[key]];\n }\n }\n });\n }\n });\n\n return correctAnswers;\n};\n","import { isEmpty, map, reduce } from '@pie-element/shared-lodash';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-element/shared-controller-utils';\nimport type { PieEnvironment, PieUpdateSession } from '@pie-element/shared-types';\nimport defaults from './defaults.js';\n\nimport { getAllCorrectResponses } from './utils.js';\nimport type {\n Choice,\n Choices,\n InlineDropdownConfiguration,\n InlineDropdownModel,\n InlineDropdownSession,\n} from '../types.js';\n\n/** Errors `validate()` reports, keyed by field. */\nexport type InlineDropdownValidationErrors = {\n teacherInstructions?: string;\n prompt?: string;\n rationale?: string;\n responseAreasError?: string;\n responseAreaChoicesError?: string;\n};\n\n/** A choice as the controller hands it to the delivery: rationales are `null` unless the instructor sees them */\ntype DeliveryChoice = Omit<Choice, 'rationale'> & { rationale?: string | null };\n\nconst getFeedback = (correct: unknown) => {\n if (correct) {\n return 'correct';\n }\n\n return 'incorrect';\n};\n\nexport const normalize = (question: InlineDropdownModel) => ({ ...defaults, ...question });\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(\n question: InlineDropdownModel,\n session: InlineDropdownSession | null | undefined,\n env: PieEnvironment,\n updateSession?: PieUpdateSession,\n) {\n const normalizedQuestion = normalize(question);\n const { value = {} } = session || {};\n let choices = reduce<Choice[], Record<string, DeliveryChoice[] | undefined>>(\n normalizedQuestion.choices,\n (obj, area, key) => {\n obj[key] = map(area, (choice) => choice);\n\n return obj;\n },\n {},\n );\n\n let feedback: Record<string, string> = {};\n\n if (env.mode === 'evaluate') {\n const allCorrectResponses = getAllCorrectResponses(normalizedQuestion);\n const respAreaLength = Object.keys(allCorrectResponses).length;\n let correctResponses = 0;\n\n for (let i = 0; i < respAreaLength; i++) {\n const result = reduce<string[], { correctResponses: number; feedback: Record<string, string> }>(\n allCorrectResponses,\n (obj, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n const isCorrect = answer && correctChoice && correctChoice === answer;\n\n obj.feedback[key] = getFeedback(isCorrect);\n\n if (isCorrect) {\n obj.correctResponses += 1;\n }\n\n return obj;\n },\n { correctResponses: 0, feedback: {} },\n );\n\n if (result.correctResponses >= correctResponses) {\n correctResponses = result.correctResponses;\n feedback = result.feedback;\n }\n\n if (result.correctResponses === respAreaLength) {\n break;\n }\n }\n }\n\n // `lockChoices` ignores the session, so the per-area `shuffledValues` shape does not matter to it.\n const lockChoiceOrder = lockChoices(normalizedQuestion, session as Parameters<typeof lockChoices>[1], env);\n\n if (!lockChoiceOrder) {\n const shuffledValues: Record<string, string[]> = {};\n const keys = Object.keys(choices);\n\n const us =\n (part: string): PieUpdateSession =>\n (_id, _element, update) => {\n return new Promise((resolve) => {\n shuffledValues[part] = update.shuffledValues as string[];\n resolve();\n });\n };\n\n let i;\n\n for (i = 0; i < keys.length; i++) {\n const key = keys[i];\n const storedValues = (session?.shuffledValues as Record<string, string[]> | undefined)?.[key];\n\n choices[key] = await getShuffledChoices(\n choices[key] as DeliveryChoice[],\n // the shuffledValues structure was updated to an object like { choice_key: [] }\n // and we need to override shuffledValues if it's not an array\n { shuffledValues: Array.isArray(storedValues) ? storedValues : [] },\n us(key),\n 'value',\n );\n }\n\n if (!isEmpty(shuffledValues)) {\n if (session && updateSession && typeof updateSession === 'function') {\n updateSession(session.id as string, session.element as string, {\n shuffledValues,\n }).catch((e) => {\n // eslint-disable-next-line no-console\n console.error('update session failed', e);\n });\n }\n }\n }\n\n let teacherInstructions: string | null | undefined = null;\n let rationale: string | null | undefined = null;\n\n const choicesWillNullRationales = (Object.keys(choices) || []).reduce<Record<string, DeliveryChoice[]>>((acc, currentValue) => {\n acc[currentValue] = (choices[currentValue] || []).map((choice) => ({\n ...choice,\n rationale: null,\n }));\n\n return acc;\n }, {});\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n\n choices = normalizedQuestion.choiceRationaleEnabled ? normalizedQuestion.choices : choicesWillNullRationales;\n } else {\n rationale = null;\n teacherInstructions = null;\n choices = choicesWillNullRationales;\n }\n\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n displayType: normalizedQuestion.displayType,\n markup: normalizedQuestion.markup,\n choices,\n feedback,\n\n responseCorrect: env.mode === 'evaluate' ? getScore(normalizedQuestion, session) === 1 : undefined,\n rationale,\n teacherInstructions,\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n\n return out;\n}\n\nexport const getScore = (\n config: Partial<Pick<InlineDropdownModel, 'choices' | 'alternateResponse'>>,\n session: InlineDropdownSession | null | undefined,\n) => {\n const { value = {} } = session || {};\n const maxScore = config && config.choices ? Object.keys(config.choices).length : 0;\n const allCorrectResponses = getAllCorrectResponses(config);\n let correctCount = 0;\n\n for (let i = 0; i < maxScore; i++) {\n const result = reduce<string[], number>(\n allCorrectResponses,\n (total, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n\n if (correctChoice && answer && correctChoice === answer) {\n return total;\n }\n\n return total - 1;\n },\n maxScore,\n );\n\n if (result > correctCount) {\n correctCount = result;\n }\n\n if (result === maxScore) {\n break;\n }\n }\n\n const str = (correctCount / maxScore).toFixed(2);\n\n return parseFloat(str);\n};\n\n/**\n * Generates detailed trace log for scoring evaluation\n * @param {Object} model - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array} traceLog - array of trace messages\n */\nexport const getLogTrace = (\n model: InlineDropdownModel,\n session: InlineDropdownSession | null | undefined,\n env: Partial<PieEnvironment>,\n) => {\n const traceLog: string[] = [];\n const { value = {} } = session || {};\n const allCorrectResponses = getAllCorrectResponses(model);\n const responseAreaKeys = Object.keys(allCorrectResponses);\n const totalAreas = responseAreaKeys.length;\n \n traceLog.push(`${totalAreas} dropdown response area(s) defined in this question.`);\n \n if (value && Object.keys(value).length > 0) {\n const selectedAreas = Object.entries(value).filter(([, val]) => val && val.trim()).length;\n traceLog.push(`Student selected options in ${selectedAreas} out of ${totalAreas} dropdown(s).`);\n \n responseAreaKeys.forEach((areaKey) => {\n const studentSelection = (value && value[areaKey]) || '';\n const correctOptions = allCorrectResponses[areaKey] || [];\n \n if (studentSelection.trim()) {\n traceLog.push(`Dropdown ${parseInt(areaKey) + 1}: student selected '${studentSelection}' (correct options: [${correctOptions.map(opt => `'${opt}'`).join(', ')}]).`);\n } else {\n traceLog.push(`Dropdown ${parseInt(areaKey) + 1}: no selection made (correct options: [${correctOptions.map(opt => `'${opt}'`).join(', ')}]).`);\n }\n });\n } else {\n traceLog.push('Student did not make any selections in the dropdowns.');\n }\n\n const partialScoringEnabled = partialScoring.enabled(model, env);\n traceLog.push(\n `Scoring method: ${\n partialScoringEnabled ? 'partial scoring' : 'all-or-nothing scoring'\n }.`\n );\n\n const score = getScore(model, session);\n traceLog.push(`Final score: ${score}.`);\n\n return traceLog;\n}\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring =\n * false. the value in `env` will override the value in `model`.\n * @param {Object} model - the main model\n * @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)\n * @param {*} session\n * @param {Object} env\n * @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides\n * `model.partialScoring`.\n */\nexport function outcome(\n model: InlineDropdownModel,\n session: InlineDropdownSession | null | undefined,\n env: Partial<PieEnvironment> = {},\n) {\n return new Promise<{ score: number; empty: boolean; traceLog: string[] }>((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ \n score: 0, \n empty: true, \n traceLog: ['Student did not make any selections in the dropdowns. Score is 0.'] \n });\n } else {\n const traceLog = getLogTrace(model, session, env);\n const score = getScore(model, session);\n const partialScoringEnabled = partialScoring.enabled(model, env);\n\n resolve({\n score: partialScoringEnabled ? score : Math.floor(score),\n empty: false,\n traceLog\n });\n }\n });\n}\n\nexport const createCorrectResponseSession = (question: InlineDropdownModel, env: PieEnvironment) => {\n return new Promise<InlineDropdownSession | null>((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { choices } = question;\n const value: Record<string, string> = {};\n\n if (choices) {\n Object.keys(choices).forEach((key, i) => {\n const correctChoices = choices[key] && choices[key].filter((c) => c.correct);\n\n value[i] = correctChoices && correctChoices[0].value;\n });\n }\n\n resolve({\n id: '1',\n value,\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html: string | undefined) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (\n model: Partial<InlineDropdownModel> = {},\n config: InlineDropdownConfiguration = {},\n) => {\n const { markup, choices } = model;\n const { maxResponseAreas, maxResponseAreaChoices } = config;\n const errors: InlineDropdownValidationErrors = {};\n\n (['teacherInstructions', 'prompt', 'rationale'] as const).forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const nbOfResponseAreas = ((markup || '').match(/\\{\\{(\\d+)\\}\\}/g) || []).length;\n\n if (maxResponseAreas !== undefined && nbOfResponseAreas > maxResponseAreas) {\n errors.responseAreasError = `No more than ${maxResponseAreas} response areas should be defined.`;\n } else if (nbOfResponseAreas < 1) {\n errors.responseAreasError = 'There should be defined at least 1 response area.';\n }\n\n // `Object.keys` throws when the model has no `choices`.\n const allChoices = choices as Choices;\n\n (Object.keys(allChoices) || []).forEach((choiceKey) => {\n if (\n allChoices[choiceKey] &&\n maxResponseAreaChoices !== undefined &&\n allChoices[choiceKey].length > maxResponseAreaChoices\n ) {\n errors.responseAreaChoicesError = `No more than ${maxResponseAreaChoices} choices per response area should be defined.`;\n }\n });\n\n return errors;\n};\n"],"mappings":";;AACA,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EAAe,EAAE,CAAC;EACjD,CAAC,GAGH7B,EAAQ;GACN,IAAI;GACJ;EACF,CAAC;CACH,OACE,EAAQ,IAAI;AAEhB,CAAC,GAIG8B,KAAc,OAA8BC,KAAQ,GAAA,CAAI,QAAQ,sCAAsC,EAAE,GAEjGC,KACX,IAAsC,CAAC,GACvC,IAAsC,CAAC,MACpC;CACH,IAAM,EAAE,WAAQ,eAAYpD,GACtB,EAAE,qBAAkB,8BAA2B+B,GAC/CsB,IAAyC,CAAC;CAEhD;EAAE;EAAuB;EAAU;CAAW,CAAC,CAAW,SAAS,MAAU;EAC3E,AAAItB,EAAOuB,EAAM,EAAE,YAAY,CAACJ,EAAWlD,EAAMsD,EAAM,MACrD,EAAOA,KAAS;CAEpB,CAAC;CAED,IAAMC,MAAsBC,KAAU,GAAA,CAAI,MAAM,gBAAgB,KAAK,CAAC,EAAA,CAAG;CAEzE,AAAIC,MAAqB,KAAA,KAAaF,IAAoBE,IACxD,EAAO,qBAAqB,gBAAgBA,EAAiB,sCACpDF,IAAoB,MAC7B,EAAO,qBAAqB;CAI9B,IAAMG,IAAanE;CAYnB,QAVC,OAAO,KAAKmE,CAAU,KAAK,CAAC,EAAA,CAAG,SAAS,MAAc;EACrD,AACEA,EAAWC,MACXC,MAA2B,KAAA,KAC3BF,EAAWC,EAAU,CAAC,SAASC,MAE/B,EAAO,2BAA2B,gBAAgBA,EAAuB;CAE7E,CAAC,GAEMP;AACT,G"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["defaults","reduce","map","lockChoices","getShuffledChoices","isEmpty","partialScoring","Gn","hn","An","e","t","r","i","n","a","s","o","c","defaults_default","getAllCorrectResponses","correctAnswers","choices","key","respArea","choice","alternateResponse","getFeedback","correct","normalize","question","model","normalizedQuestion","session","area","obj","feedback","env","allCorrectResponses","respAreaLength","correctResponses","result","answer","value","correctChoice","isCorrect","shuffledValues","keys","us","part","update","resolve","storedValues","Cn","updateSession","teacherInstructions","rationale","choicesWillNullRationales","currentValue","acc","getScore","maxScore","config","correctCount","total","str","getLogTrace","traceLog","responseAreaKeys","totalAreas","selectedAreas","val","studentSelection","areaKey","correctOptions","opt","partialScoringEnabled","score","outcome","createCorrectResponseSession","correctChoices","getContent","html","validate","errors","field","nbOfResponseAreas","markup","maxResponseAreas","allChoices","choiceKey","maxResponseAreaChoices","piePackage","\"name\"","\"version\""],"sources":["../../../../../shared/controller-utils/dist/index.js","../../../src/controller/defaults.ts","../../../src/controller/utils.ts","../../../src/controller/index.ts"],"sourcesContent":["//#region \\0rolldown/runtime.js\nvar e = Object.defineProperty, t = (t, n) => {\n\tlet r = {};\n\tfor (var i in t) e(r, i, {\n\t\tget: t[i],\n\t\tenumerable: !0\n\t});\n\treturn n || e(r, Symbol.toStringTag, { value: \"Module\" }), r;\n};\n//#endregion\n//#region src/persistence.ts\nfunction n(e) {\n\treturn Array.isArray(e) ? e.filter((e) => e != null) : [];\n}\nfunction r(e) {\n\tlet t = [...e];\n\tfor (let e = t.length - 1; e > 0; e--) {\n\t\tlet n = Math.floor(Math.random() * (e + 1));\n\t\t[t[e], t[n]] = [t[n], t[e]];\n\t}\n\treturn t;\n}\nfunction i(e) {\n\treturn e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == \"object\" && Object.keys(e).length === 0;\n}\nasync function a(e, t, a, o = \"value\") {\n\tlet s = n(t?.data?.shuffledValues ?? t?.shuffledValues ?? []);\n\tif (!t) {\n\t\tconsole.warn(\"Unable to save shuffled choices because there's no session.\");\n\t\treturn;\n\t}\n\tif (!i(s)) return n(s.map((t) => e.find((e) => e[o] === t)));\n\tlet c = r(e);\n\tif (a && typeof a == \"function\") try {\n\t\tlet e = n(c.map((e) => e[o]));\n\t\ti(e) ? console.error(`shuffledValues is an empty array - refusing to call updateSession. shuffledChoices: ${JSON.stringify(c)}, key: ${o}`) : await a(t.id, t.element, { shuffledValues: e });\n\t} catch (e) {\n\t\tconsole.warn(\"Unable to save shuffled order for choices\"), console.error(e);\n\t}\n\telse console.warn(\"Unable to save shuffled choices, shuffle will happen every time.\");\n\treturn c;\n}\nfunction o(e, t, n) {\n\treturn !!(e.lockChoiceOrder || n?.[\"@pie-element\"]?.lockChoiceOrder);\n}\n//#endregion\n//#region src/partial-scoring.ts\nvar s = /* @__PURE__ */ t({ enabled: () => c });\nfunction c(e, t, n) {\n\treturn e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n != \"boolean\" || n;\n}\n//#endregion\n//#region src/response-normalizer.ts\nvar l = /[\\u061C\\u200E\\u200F\\u202A-\\u202E\\u2066-\\u2069\\u0640]/g, u = /[\\uFB50-\\uFDFF\\uFE70-\\uFEFC]+/g, d = /\\p{Nd}/u, f = /(?![0-9])\\p{Nd}/gu, p = /\\u066B/g, m = /\\u066C/g, h = /[\\u0622\\u0623\\u0625\\u0671]/g, g = /[\\u064B-\\u065F\\u0670]/g, _ = /* @__PURE__ */ new Map(), v = (e) => {\n\tlet t = _.get(e);\n\tif (t !== void 0) return t;\n\tlet n = 0;\n\tfor (; d.test(String.fromCodePoint(e - n - 1));) n++;\n\tlet r = n % 10;\n\treturn _.set(e, r), r;\n}, y = (e) => e.replace(f, (e) => String(v(e.codePointAt(0)))), b = {\n\tdecimal: \".\",\n\tgroup: \",\"\n}, x = /* @__PURE__ */ new Map(), S = (e) => {\n\tif (!e) return b;\n\tlet t = x.get(e);\n\tif (t) return t;\n\tlet n = b;\n\ttry {\n\t\tif (Intl.NumberFormat.supportedLocalesOf(e).length > 0) {\n\t\t\tlet t = new Intl.NumberFormat(e, { numberingSystem: \"latn\" }).formatToParts(12345.6);\n\t\t\tn = {\n\t\t\t\tdecimal: t.find((e) => e.type === \"decimal\")?.value ?? \".\",\n\t\t\t\tgroup: t.find((e) => e.type === \"group\")?.value ?? \",\"\n\t\t\t};\n\t\t}\n\t} catch {}\n\treturn x.set(e, n), n;\n}, C = (e, t) => {\n\tlet n = [e?.language, t?.locale];\n\tfor (let e of n) if (typeof e == \"string\" && e.trim()) return e.trim().replace(/_/g, \"-\");\n}, w = /^(tr|az)(-|$)/i, T = (e, t) => {\n\tif (!t || !w.test(t)) return e.toLowerCase();\n\ttry {\n\t\treturn e.toLocaleLowerCase(t);\n\t} catch {\n\t\treturn e.toLowerCase();\n\t}\n}, E = (e, t = {}) => {\n\tlet n = S(t.language), r = (t.ignoreCase ? T(e, t.language) : e).replace(l, \"\").replace(u, (e) => e.normalize(\"NFKC\")).normalize(\"NFC\");\n\treturn r = y(r).replace(p, n.decimal).replace(m, n.group), t.foldLetterVariants && (r = r.replace(g, \"\").replace(h, \"ا\").replace(/\\u0629/g, \"ه\").replace(/\\u0649/g, \"ي\")), r;\n};\n//#endregion\nexport { C as contentLanguage, T as foldCase, y as foldDigits, a as getShuffledChoices, o as lockChoices, E as normalizeResponse, s as partialScoring };\n","import type { InlineDropdownModel } from '../types.js';\n\nexport default {\n alternateResponse: {},\n choiceRationaleEnabled: true,\n choices: {},\n disabled: false,\n displayType: 'block',\n markup: '',\n mode: 'gather',\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n shuffle: true,\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n} satisfies Omit<InlineDropdownModel, 'id' | 'element'>;\n","import { forEach } from '@pie-element/shared-lodash';\nimport type { Choice, InlineDropdownModel } from '../types.js';\n\nexport const getAllCorrectResponses = ({\n choices,\n alternateResponse,\n}: Partial<Pick<InlineDropdownModel, 'choices' | 'alternateResponse'>>) => {\n alternateResponse = alternateResponse || {};\n const correctAnswers: Record<string, string[]> = {};\n\n forEach<Choice[]>(choices, (respArea, key) => {\n if (!correctAnswers[key]) {\n correctAnswers[key] = [];\n }\n\n if (respArea) {\n respArea.forEach((choice) => {\n if (choice.correct) {\n correctAnswers[key].push(choice.value);\n\n if (alternateResponse[key]) {\n correctAnswers[key] = [...correctAnswers[key], ...alternateResponse[key]];\n }\n }\n });\n }\n });\n\n return correctAnswers;\n};\n","import { isEmpty, map, reduce } from '@pie-element/shared-lodash';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-element/shared-controller-utils';\nimport type { PieEnvironment, PieUpdateSession } from '@pie-element/shared-types';\nimport defaults from './defaults.js';\n\nimport { getAllCorrectResponses } from './utils.js';\nimport type {\n Choice,\n Choices,\n InlineDropdownConfiguration,\n InlineDropdownModel,\n InlineDropdownSession,\n} from '../types.js';\n\n/** Errors `validate()` reports, keyed by field. */\nexport type InlineDropdownValidationErrors = {\n teacherInstructions?: string;\n prompt?: string;\n rationale?: string;\n responseAreasError?: string;\n responseAreaChoicesError?: string;\n};\n\n/** A choice as the controller hands it to the delivery: rationales are `null` unless the instructor sees them */\ntype DeliveryChoice = Omit<Choice, 'rationale'> & { rationale?: string | null };\n\nconst getFeedback = (correct: unknown) => {\n if (correct) {\n return 'correct';\n }\n\n return 'incorrect';\n};\n\nexport const normalize = (question: InlineDropdownModel) => ({ ...defaults, ...question });\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(\n question: InlineDropdownModel,\n session: InlineDropdownSession | null | undefined,\n env: PieEnvironment,\n updateSession?: PieUpdateSession,\n) {\n const normalizedQuestion = normalize(question);\n const { value = {} } = session || {};\n let choices = reduce<Choice[], Record<string, DeliveryChoice[] | undefined>>(\n normalizedQuestion.choices,\n (obj, area, key) => {\n obj[key] = map(area, (choice) => choice);\n\n return obj;\n },\n {},\n );\n\n let feedback: Record<string, string> = {};\n\n if (env.mode === 'evaluate') {\n const allCorrectResponses = getAllCorrectResponses(normalizedQuestion);\n const respAreaLength = Object.keys(allCorrectResponses).length;\n let correctResponses = 0;\n\n for (let i = 0; i < respAreaLength; i++) {\n const result = reduce<string[], { correctResponses: number; feedback: Record<string, string> }>(\n allCorrectResponses,\n (obj, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n const isCorrect = answer && correctChoice && correctChoice === answer;\n\n obj.feedback[key] = getFeedback(isCorrect);\n\n if (isCorrect) {\n obj.correctResponses += 1;\n }\n\n return obj;\n },\n { correctResponses: 0, feedback: {} },\n );\n\n if (result.correctResponses >= correctResponses) {\n correctResponses = result.correctResponses;\n feedback = result.feedback;\n }\n\n if (result.correctResponses === respAreaLength) {\n break;\n }\n }\n }\n\n // `lockChoices` ignores the session, so the per-area `shuffledValues` shape does not matter to it.\n const lockChoiceOrder = lockChoices(normalizedQuestion, session as Parameters<typeof lockChoices>[1], env);\n\n if (!lockChoiceOrder) {\n const shuffledValues: Record<string, string[]> = {};\n const keys = Object.keys(choices);\n\n const us =\n (part: string): PieUpdateSession =>\n (_id, _element, update) => {\n return new Promise((resolve) => {\n shuffledValues[part] = update.shuffledValues as string[];\n resolve();\n });\n };\n\n let i;\n\n for (i = 0; i < keys.length; i++) {\n const key = keys[i];\n const storedValues = (session?.shuffledValues as Record<string, string[]> | undefined)?.[key];\n\n choices[key] = await getShuffledChoices(\n choices[key] as DeliveryChoice[],\n // the shuffledValues structure was updated to an object like { choice_key: [] }\n // and we need to override shuffledValues if it's not an array\n { shuffledValues: Array.isArray(storedValues) ? storedValues : [] },\n us(key),\n 'value',\n );\n }\n\n if (!isEmpty(shuffledValues)) {\n if (session && updateSession && typeof updateSession === 'function') {\n updateSession(session.id as string, session.element as string, {\n shuffledValues,\n }).catch((e) => {\n // eslint-disable-next-line no-console\n console.error('update session failed', e);\n });\n }\n }\n }\n\n let teacherInstructions: string | null | undefined = null;\n let rationale: string | null | undefined = null;\n\n const choicesWillNullRationales = (Object.keys(choices) || []).reduce<Record<string, DeliveryChoice[]>>((acc, currentValue) => {\n acc[currentValue] = (choices[currentValue] || []).map((choice) => ({\n ...choice,\n rationale: null,\n }));\n\n return acc;\n }, {});\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n\n choices = normalizedQuestion.choiceRationaleEnabled ? normalizedQuestion.choices : choicesWillNullRationales;\n } else {\n rationale = null;\n teacherInstructions = null;\n choices = choicesWillNullRationales;\n }\n\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n displayType: normalizedQuestion.displayType,\n markup: normalizedQuestion.markup,\n choices,\n feedback,\n\n responseCorrect: env.mode === 'evaluate' ? getScore(normalizedQuestion, session) === 1 : undefined,\n rationale,\n teacherInstructions,\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n\n return out;\n}\n\nexport const getScore = (\n config: Partial<Pick<InlineDropdownModel, 'choices' | 'alternateResponse'>>,\n session: InlineDropdownSession | null | undefined,\n) => {\n const { value = {} } = session || {};\n const maxScore = config && config.choices ? Object.keys(config.choices).length : 0;\n const allCorrectResponses = getAllCorrectResponses(config);\n let correctCount = 0;\n\n for (let i = 0; i < maxScore; i++) {\n const result = reduce<string[], number>(\n allCorrectResponses,\n (total, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n\n if (correctChoice && answer && correctChoice === answer) {\n return total;\n }\n\n return total - 1;\n },\n maxScore,\n );\n\n if (result > correctCount) {\n correctCount = result;\n }\n\n if (result === maxScore) {\n break;\n }\n }\n\n const str = (correctCount / maxScore).toFixed(2);\n\n return parseFloat(str);\n};\n\n/**\n * Generates detailed trace log for scoring evaluation\n * @param {Object} model - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array} traceLog - array of trace messages\n */\nexport const getLogTrace = (\n model: InlineDropdownModel,\n session: InlineDropdownSession | null | undefined,\n env: Partial<PieEnvironment>,\n) => {\n const traceLog: string[] = [];\n const { value = {} } = session || {};\n const allCorrectResponses = getAllCorrectResponses(model);\n const responseAreaKeys = Object.keys(allCorrectResponses);\n const totalAreas = responseAreaKeys.length;\n \n traceLog.push(`${totalAreas} dropdown response area(s) defined in this question.`);\n \n if (value && Object.keys(value).length > 0) {\n const selectedAreas = Object.entries(value).filter(([, val]) => val && val.trim()).length;\n traceLog.push(`Student selected options in ${selectedAreas} out of ${totalAreas} dropdown(s).`);\n \n responseAreaKeys.forEach((areaKey) => {\n const studentSelection = (value && value[areaKey]) || '';\n const correctOptions = allCorrectResponses[areaKey] || [];\n \n if (studentSelection.trim()) {\n traceLog.push(`Dropdown ${parseInt(areaKey) + 1}: student selected '${studentSelection}' (correct options: [${correctOptions.map(opt => `'${opt}'`).join(', ')}]).`);\n } else {\n traceLog.push(`Dropdown ${parseInt(areaKey) + 1}: no selection made (correct options: [${correctOptions.map(opt => `'${opt}'`).join(', ')}]).`);\n }\n });\n } else {\n traceLog.push('Student did not make any selections in the dropdowns.');\n }\n\n const partialScoringEnabled = partialScoring.enabled(model, env);\n traceLog.push(\n `Scoring method: ${\n partialScoringEnabled ? 'partial scoring' : 'all-or-nothing scoring'\n }.`\n );\n\n const score = getScore(model, session);\n traceLog.push(`Final score: ${score}.`);\n\n return traceLog;\n}\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring =\n * false. the value in `env` will override the value in `model`.\n * @param {Object} model - the main model\n * @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)\n * @param {*} session\n * @param {Object} env\n * @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides\n * `model.partialScoring`.\n */\nexport function outcome(\n model: InlineDropdownModel,\n session: InlineDropdownSession | null | undefined,\n env: Partial<PieEnvironment> = {},\n) {\n return new Promise<{ score: number; empty: boolean; traceLog: string[] }>((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ \n score: 0, \n empty: true, \n traceLog: ['Student did not make any selections in the dropdowns. Score is 0.'] \n });\n } else {\n const traceLog = getLogTrace(model, session, env);\n const score = getScore(model, session);\n const partialScoringEnabled = partialScoring.enabled(model, env);\n\n resolve({\n score: partialScoringEnabled ? score : Math.floor(score),\n empty: false,\n traceLog\n });\n }\n });\n}\n\nexport const createCorrectResponseSession = (question: InlineDropdownModel, env: PieEnvironment) => {\n return new Promise<InlineDropdownSession | null>((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { choices } = question;\n const value: Record<string, string> = {};\n\n if (choices) {\n Object.keys(choices).forEach((key, i) => {\n const correctChoices = choices[key] && choices[key].filter((c) => c.correct);\n\n value[i] = correctChoices && correctChoices[0].value;\n });\n }\n\n resolve({\n id: '1',\n value,\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html: string | undefined) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (\n model: Partial<InlineDropdownModel> = {},\n config: InlineDropdownConfiguration = {},\n) => {\n const { markup, choices } = model;\n const { maxResponseAreas, maxResponseAreaChoices } = config;\n const errors: InlineDropdownValidationErrors = {};\n\n (['teacherInstructions', 'prompt', 'rationale'] as const).forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const nbOfResponseAreas = ((markup || '').match(/\\{\\{(\\d+)\\}\\}/g) || []).length;\n\n if (maxResponseAreas !== undefined && nbOfResponseAreas > maxResponseAreas) {\n errors.responseAreasError = `No more than ${maxResponseAreas} response areas should be defined.`;\n } else if (nbOfResponseAreas < 1) {\n errors.responseAreasError = 'There should be defined at least 1 response area.';\n }\n\n // `Object.keys` throws when the model has no `choices`.\n const allChoices = choices as Choices;\n\n (Object.keys(allChoices) || []).forEach((choiceKey) => {\n if (\n allChoices[choiceKey] &&\n maxResponseAreaChoices !== undefined &&\n allChoices[choiceKey].length > maxResponseAreaChoices\n ) {\n errors.responseAreaChoicesError = `No more than ${maxResponseAreaChoices} choices per response area should be defined.`;\n }\n });\n\n return errors;\n};\n"],"mappings":";;AACA,IAAIU,IAAI,OAAO,gBAA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CAAC,GAGH7B,EAAQ;GACN,IAAI;GACJ;EACF,CAAC;CACH,OACE,EAAQ,IAAI;AAEhB,CAAC,GAIG8B,KAAc,OAA8BC,KAAQ,GAAA,CAAI,QAAQ,sCAAsC,EAAE,GAEjGC,KACX,IAAsC,CAAC,GACvC,IAAsC,CAAC,MACpC;CACH,IAAM,EAAE,WAAQ,eAAYpD,GACtB,EAAE,qBAAkB,8BAA2B+B,GAC/CsB,IAAyC,CAAC;CAEhD;EAAE;EAAuB;EAAU;CAAW,CAAC,CAAW,SAAS,MAAU;EAC3E,AAAItB,EAAOuB,EAAM,EAAE,YAAY,CAACJ,EAAWlD,EAAMsD,EAAM,MACrD,EAAOA,KAAS;CAEpB,CAAC;CAED,IAAMC,MAAsBC,KAAU,GAAA,CAAI,MAAM,gBAAgB,KAAK,CAAC,EAAA,CAAG;CAEzE,AAAIC,MAAqB,KAAA,KAAaF,IAAoBE,IACxD,EAAO,qBAAqB,gBAAgBA,EAAiB,sCACpDF,IAAoB,MAC7B,EAAO,qBAAqB;CAI9B,IAAMG,IAAanE;CAYnB,QAVC,OAAO,KAAKmE,CAAU,KAAK,CAAC,EAAA,CAAG,SAAS,MAAc;EACrD,AACEA,EAAWC,MACXC,MAA2B,KAAA,KAC3BF,EAAWC,EAAU,CAAC,SAASC,MAE/B,EAAO,2BAA2B,gBAAgBA,EAAuB;CAE7E,CAAC,GAEMP;AACT,G"}
|
|
@@ -1359,7 +1359,7 @@ var Dt = x, X = Dt.default, Z = X && typeof X == "object" ? X : Dt, Ot = Y(i, "U
|
|
|
1359
1359
|
}
|
|
1360
1360
|
}, zt = Object.freeze({
|
|
1361
1361
|
name: "@pie-element/inline-dropdown",
|
|
1362
|
-
version: "11.0.8-next.
|
|
1362
|
+
version: "11.0.8-next.20261024053312"
|
|
1363
1363
|
});
|
|
1364
1364
|
//#endregion
|
|
1365
1365
|
export { Rt as default, zt as piePackage };
|
|
@@ -28451,7 +28451,7 @@ var Gw = Ne, Kw = Gw.default, qw = Kw && typeof Kw == "object" ? Kw : Gw, Jw = W
|
|
|
28451
28451
|
}
|
|
28452
28452
|
}, BT = Object.freeze({
|
|
28453
28453
|
name: "@pie-element/inline-dropdown",
|
|
28454
|
-
version: "11.0.8-next.
|
|
28454
|
+
version: "11.0.8-next.20261024053312"
|
|
28455
28455
|
});
|
|
28456
28456
|
//#endregion
|
|
28457
28457
|
export { zT as default, BT as piePackage };
|
|
@@ -193,7 +193,7 @@ var x = (e, t) => new Promise((n) => {
|
|
|
193
193
|
}), o;
|
|
194
194
|
}, w = Object.freeze({
|
|
195
195
|
name: "@pie-element/inline-dropdown",
|
|
196
|
-
version: "11.0.8-next.
|
|
196
|
+
version: "11.0.8-next.20261024053312"
|
|
197
197
|
});
|
|
198
198
|
//#endregion
|
|
199
199
|
export { x as createCorrectResponseSession, y as getLogTrace, v as getScore, _ as model, g as normalize, b as outcome, w as piePackage, C as validate };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["defaults","reduce","map","lockChoices","getShuffledChoices","isEmpty","partialScoring","Gn","hn","An","e","t","r","i","n","a","s","o","c","defaults_default","getAllCorrectResponses","correctAnswers","choices","key","respArea","choice","alternateResponse","getFeedback","correct","normalize","question","model","normalizedQuestion","session","area","obj","feedback","env","allCorrectResponses","respAreaLength","correctResponses","result","answer","value","correctChoice","isCorrect","shuffledValues","keys","us","part","update","resolve","storedValues","Cn","updateSession","teacherInstructions","rationale","choicesWillNullRationales","currentValue","acc","getScore","maxScore","config","correctCount","total","str","getLogTrace","traceLog","responseAreaKeys","totalAreas","selectedAreas","val","studentSelection","areaKey","correctOptions","opt","partialScoringEnabled","score","outcome","createCorrectResponseSession","correctChoices","getContent","html","validate","errors","field","nbOfResponseAreas","markup","maxResponseAreas","allChoices","choiceKey","maxResponseAreaChoices","piePackage","\"name\"","\"version\""],"sources":["../../../../../../shared/controller-utils/dist/index.js","../../../../src/controller/defaults.ts","../../../../src/controller/utils.ts","../../../../src/controller/index.ts"],"sourcesContent":["//#region \\0rolldown/runtime.js\nvar e = Object.defineProperty, t = (t, n) => {\n\tlet r = {};\n\tfor (var i in t) e(r, i, {\n\t\tget: t[i],\n\t\tenumerable: !0\n\t});\n\treturn n || e(r, Symbol.toStringTag, { value: \"Module\" }), r;\n};\n//#endregion\n//#region src/persistence.ts\nfunction n(e) {\n\treturn Array.isArray(e) ? e.filter((e) => e != null) : [];\n}\nfunction r(e) {\n\tlet t = [...e];\n\tfor (let e = t.length - 1; e > 0; e--) {\n\t\tlet n = Math.floor(Math.random() * (e + 1));\n\t\t[t[e], t[n]] = [t[n], t[e]];\n\t}\n\treturn t;\n}\nfunction i(e) {\n\treturn e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == \"object\" && Object.keys(e).length === 0;\n}\nasync function a(e, t, a, o = \"value\") {\n\tlet s = n(t?.data?.shuffledValues ?? t?.shuffledValues ?? []);\n\tif (!t) {\n\t\tconsole.warn(\"Unable to save shuffled choices because there's no session.\");\n\t\treturn;\n\t}\n\tif (!i(s)) return n(s.map((t) => e.find((e) => e[o] === t)));\n\tlet c = r(e);\n\tif (a && typeof a == \"function\") try {\n\t\tlet e = n(c.map((e) => e[o]));\n\t\ti(e) ? console.error(`shuffledValues is an empty array - refusing to call updateSession. shuffledChoices: ${JSON.stringify(c)}, key: ${o}`) : await a(t.id, t.element, { shuffledValues: e });\n\t} catch (e) {\n\t\tconsole.warn(\"Unable to save shuffled order for choices\"), console.error(e);\n\t}\n\telse console.warn(\"Unable to save shuffled choices, shuffle will happen every time.\");\n\treturn c;\n}\nfunction o(e, t, n) {\n\treturn !!(e.lockChoiceOrder || n?.[\"@pie-element\"]?.lockChoiceOrder);\n}\n//#endregion\n//#region src/partial-scoring.ts\nvar s = /* @__PURE__ */ t({ enabled: () => c });\nfunction c(e, t, n) {\n\treturn e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n != \"boolean\" || n;\n}\n//#endregion\nexport { a as getShuffledChoices, o as lockChoices, s as partialScoring };\n","import type { InlineDropdownModel } from '../types.js';\n\nexport default {\n alternateResponse: {},\n choiceRationaleEnabled: true,\n choices: {},\n disabled: false,\n displayType: 'block',\n markup: '',\n mode: 'gather',\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n shuffle: true,\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n} satisfies Omit<InlineDropdownModel, 'id' | 'element'>;\n","import { forEach } from '@pie-element/shared-lodash';\nimport type { Choice, InlineDropdownModel } from '../types.js';\n\nexport const getAllCorrectResponses = ({\n choices,\n alternateResponse,\n}: Partial<Pick<InlineDropdownModel, 'choices' | 'alternateResponse'>>) => {\n alternateResponse = alternateResponse || {};\n const correctAnswers: Record<string, string[]> = {};\n\n forEach<Choice[]>(choices, (respArea, key) => {\n if (!correctAnswers[key]) {\n correctAnswers[key] = [];\n }\n\n if (respArea) {\n respArea.forEach((choice) => {\n if (choice.correct) {\n correctAnswers[key].push(choice.value);\n\n if (alternateResponse[key]) {\n correctAnswers[key] = [...correctAnswers[key], ...alternateResponse[key]];\n }\n }\n });\n }\n });\n\n return correctAnswers;\n};\n","import { isEmpty, map, reduce } from '@pie-element/shared-lodash';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-element/shared-controller-utils';\nimport type { PieEnvironment, PieUpdateSession } from '@pie-element/shared-types';\nimport defaults from './defaults.js';\n\nimport { getAllCorrectResponses } from './utils.js';\nimport type {\n Choice,\n Choices,\n InlineDropdownConfiguration,\n InlineDropdownModel,\n InlineDropdownSession,\n} from '../types.js';\n\n/** Errors `validate()` reports, keyed by field. */\nexport type InlineDropdownValidationErrors = {\n teacherInstructions?: string;\n prompt?: string;\n rationale?: string;\n responseAreasError?: string;\n responseAreaChoicesError?: string;\n};\n\n/** A choice as the controller hands it to the delivery: rationales are `null` unless the instructor sees them */\ntype DeliveryChoice = Omit<Choice, 'rationale'> & { rationale?: string | null };\n\nconst getFeedback = (correct: unknown) => {\n if (correct) {\n return 'correct';\n }\n\n return 'incorrect';\n};\n\nexport const normalize = (question: InlineDropdownModel) => ({ ...defaults, ...question });\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(\n question: InlineDropdownModel,\n session: InlineDropdownSession | null | undefined,\n env: PieEnvironment,\n updateSession?: PieUpdateSession,\n) {\n const normalizedQuestion = normalize(question);\n const { value = {} } = session || {};\n let choices = reduce<Choice[], Record<string, DeliveryChoice[] | undefined>>(\n normalizedQuestion.choices,\n (obj, area, key) => {\n obj[key] = map(area, (choice) => choice);\n\n return obj;\n },\n {},\n );\n\n let feedback: Record<string, string> = {};\n\n if (env.mode === 'evaluate') {\n const allCorrectResponses = getAllCorrectResponses(normalizedQuestion);\n const respAreaLength = Object.keys(allCorrectResponses).length;\n let correctResponses = 0;\n\n for (let i = 0; i < respAreaLength; i++) {\n const result = reduce<string[], { correctResponses: number; feedback: Record<string, string> }>(\n allCorrectResponses,\n (obj, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n const isCorrect = answer && correctChoice && correctChoice === answer;\n\n obj.feedback[key] = getFeedback(isCorrect);\n\n if (isCorrect) {\n obj.correctResponses += 1;\n }\n\n return obj;\n },\n { correctResponses: 0, feedback: {} },\n );\n\n if (result.correctResponses >= correctResponses) {\n correctResponses = result.correctResponses;\n feedback = result.feedback;\n }\n\n if (result.correctResponses === respAreaLength) {\n break;\n }\n }\n }\n\n // `lockChoices` ignores the session, so the per-area `shuffledValues` shape does not matter to it.\n const lockChoiceOrder = lockChoices(normalizedQuestion, session as Parameters<typeof lockChoices>[1], env);\n\n if (!lockChoiceOrder) {\n const shuffledValues: Record<string, string[]> = {};\n const keys = Object.keys(choices);\n\n const us =\n (part: string): PieUpdateSession =>\n (_id, _element, update) => {\n return new Promise((resolve) => {\n shuffledValues[part] = update.shuffledValues as string[];\n resolve();\n });\n };\n\n let i;\n\n for (i = 0; i < keys.length; i++) {\n const key = keys[i];\n const storedValues = (session?.shuffledValues as Record<string, string[]> | undefined)?.[key];\n\n choices[key] = await getShuffledChoices(\n choices[key] as DeliveryChoice[],\n // the shuffledValues structure was updated to an object like { choice_key: [] }\n // and we need to override shuffledValues if it's not an array\n { shuffledValues: Array.isArray(storedValues) ? storedValues : [] },\n us(key),\n 'value',\n );\n }\n\n if (!isEmpty(shuffledValues)) {\n if (session && updateSession && typeof updateSession === 'function') {\n updateSession(session.id as string, session.element as string, {\n shuffledValues,\n }).catch((e) => {\n // eslint-disable-next-line no-console\n console.error('update session failed', e);\n });\n }\n }\n }\n\n let teacherInstructions: string | null | undefined = null;\n let rationale: string | null | undefined = null;\n\n const choicesWillNullRationales = (Object.keys(choices) || []).reduce<Record<string, DeliveryChoice[]>>((acc, currentValue) => {\n acc[currentValue] = (choices[currentValue] || []).map((choice) => ({\n ...choice,\n rationale: null,\n }));\n\n return acc;\n }, {});\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n\n choices = normalizedQuestion.choiceRationaleEnabled ? normalizedQuestion.choices : choicesWillNullRationales;\n } else {\n rationale = null;\n teacherInstructions = null;\n choices = choicesWillNullRationales;\n }\n\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n displayType: normalizedQuestion.displayType,\n markup: normalizedQuestion.markup,\n choices,\n feedback,\n\n responseCorrect: env.mode === 'evaluate' ? getScore(normalizedQuestion, session) === 1 : undefined,\n rationale,\n teacherInstructions,\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n\n return out;\n}\n\nexport const getScore = (\n config: Partial<Pick<InlineDropdownModel, 'choices' | 'alternateResponse'>>,\n session: InlineDropdownSession | null | undefined,\n) => {\n const { value = {} } = session || {};\n const maxScore = config && config.choices ? Object.keys(config.choices).length : 0;\n const allCorrectResponses = getAllCorrectResponses(config);\n let correctCount = 0;\n\n for (let i = 0; i < maxScore; i++) {\n const result = reduce<string[], number>(\n allCorrectResponses,\n (total, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n\n if (correctChoice && answer && correctChoice === answer) {\n return total;\n }\n\n return total - 1;\n },\n maxScore,\n );\n\n if (result > correctCount) {\n correctCount = result;\n }\n\n if (result === maxScore) {\n break;\n }\n }\n\n const str = (correctCount / maxScore).toFixed(2);\n\n return parseFloat(str);\n};\n\n/**\n * Generates detailed trace log for scoring evaluation\n * @param {Object} model - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array} traceLog - array of trace messages\n */\nexport const getLogTrace = (\n model: InlineDropdownModel,\n session: InlineDropdownSession | null | undefined,\n env: Partial<PieEnvironment>,\n) => {\n const traceLog: string[] = [];\n const { value = {} } = session || {};\n const allCorrectResponses = getAllCorrectResponses(model);\n const responseAreaKeys = Object.keys(allCorrectResponses);\n const totalAreas = responseAreaKeys.length;\n \n traceLog.push(`${totalAreas} dropdown response area(s) defined in this question.`);\n \n if (value && Object.keys(value).length > 0) {\n const selectedAreas = Object.entries(value).filter(([, val]) => val && val.trim()).length;\n traceLog.push(`Student selected options in ${selectedAreas} out of ${totalAreas} dropdown(s).`);\n \n responseAreaKeys.forEach((areaKey) => {\n const studentSelection = (value && value[areaKey]) || '';\n const correctOptions = allCorrectResponses[areaKey] || [];\n \n if (studentSelection.trim()) {\n traceLog.push(`Dropdown ${parseInt(areaKey) + 1}: student selected '${studentSelection}' (correct options: [${correctOptions.map(opt => `'${opt}'`).join(', ')}]).`);\n } else {\n traceLog.push(`Dropdown ${parseInt(areaKey) + 1}: no selection made (correct options: [${correctOptions.map(opt => `'${opt}'`).join(', ')}]).`);\n }\n });\n } else {\n traceLog.push('Student did not make any selections in the dropdowns.');\n }\n\n const partialScoringEnabled = partialScoring.enabled(model, env);\n traceLog.push(\n `Scoring method: ${\n partialScoringEnabled ? 'partial scoring' : 'all-or-nothing scoring'\n }.`\n );\n\n const score = getScore(model, session);\n traceLog.push(`Final score: ${score}.`);\n\n return traceLog;\n}\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring =\n * false. the value in `env` will override the value in `model`.\n * @param {Object} model - the main model\n * @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)\n * @param {*} session\n * @param {Object} env\n * @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides\n * `model.partialScoring`.\n */\nexport function outcome(\n model: InlineDropdownModel,\n session: InlineDropdownSession | null | undefined,\n env: Partial<PieEnvironment> = {},\n) {\n return new Promise<{ score: number; empty: boolean; traceLog: string[] }>((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ \n score: 0, \n empty: true, \n traceLog: ['Student did not make any selections in the dropdowns. Score is 0.'] \n });\n } else {\n const traceLog = getLogTrace(model, session, env);\n const score = getScore(model, session);\n const partialScoringEnabled = partialScoring.enabled(model, env);\n\n resolve({\n score: partialScoringEnabled ? score : Math.floor(score),\n empty: false,\n traceLog\n });\n }\n });\n}\n\nexport const createCorrectResponseSession = (question: InlineDropdownModel, env: PieEnvironment) => {\n return new Promise<InlineDropdownSession | null>((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { choices } = question;\n const value: Record<string, string> = {};\n\n if (choices) {\n Object.keys(choices).forEach((key, i) => {\n const correctChoices = choices[key] && choices[key].filter((c) => c.correct);\n\n value[i] = correctChoices && correctChoices[0].value;\n });\n }\n\n resolve({\n id: '1',\n value,\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html: string | undefined) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (\n model: Partial<InlineDropdownModel> = {},\n config: InlineDropdownConfiguration = {},\n) => {\n const { markup, choices } = model;\n const { maxResponseAreas, maxResponseAreaChoices } = config;\n const errors: InlineDropdownValidationErrors = {};\n\n (['teacherInstructions', 'prompt', 'rationale'] as const).forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const nbOfResponseAreas = ((markup || '').match(/\\{\\{(\\d+)\\}\\}/g) || []).length;\n\n if (maxResponseAreas !== undefined && nbOfResponseAreas > maxResponseAreas) {\n errors.responseAreasError = `No more than ${maxResponseAreas} response areas should be defined.`;\n } else if (nbOfResponseAreas < 1) {\n errors.responseAreasError = 'There should be defined at least 1 response area.';\n }\n\n // `Object.keys` throws when the model has no `choices`.\n const allChoices = choices as Choices;\n\n (Object.keys(allChoices) || []).forEach((choiceKey) => {\n if (\n allChoices[choiceKey] &&\n maxResponseAreaChoices !== undefined &&\n allChoices[choiceKey].length > maxResponseAreaChoices\n ) {\n errors.responseAreaChoicesError = `No more than ${maxResponseAreaChoices} choices per response area should be defined.`;\n }\n });\n\n return errors;\n};\n"],"mappings":";;AACA,IAAIU,IAAI,OAAO,gBAAgBC,KAAK,GAAG,MAAM;CAC5C,IAAIC,IAAI,CAAC;CACT,KAAK,IAAIC,KAAKF,GAAG,EAAEC,GAAGC,GAAG;EACxB,KAAKF,EAAEE;EACP,YAAY,CAAC;CACd,CAAC;CACD,OAAOC,KAAKJ,EAAEE,GAAG,OAAO,aAAa,EAAE,OAAO,SAAS,CAAC,GAAGA;AAC5D;AAGA,SAASE,EAAE,GAAG;CACb,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,QAAQ,MAAM,KAAK,IAAI,IAAI,CAAC;AACzD;AACA,SAASF,EAAE,GAAG;CACb,IAAI,IAAI,CAAC,GAAG,CAAC;CACb,KAAK,IAAI,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,KAAK;EACtC,IAAI,IAAI,KAAK,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I,MAAM,gBAAgB,KAAK,CAAC,EAAA,CAAG;CAEzE,AAAIC,MAAqB,KAAA,KAAaF,IAAoBE,IACxD,EAAO,qBAAqB,gBAAgBA,EAAiB,sCACpDF,IAAoB,MAC7B,EAAO,qBAAqB;CAI9B,IAAMG,IAAanE;CAYnB,QAVC,OAAO,KAAKmE,CAAU,KAAK,CAAC,EAAA,CAAG,SAAS,MAAc;EACrD,AACEA,EAAWC,MACXC,MAA2B,KAAA,KAC3BF,EAAWC,EAAU,CAAC,SAASC,MAE/B,EAAO,2BAA2B,gBAAgBA,EAAuB;CAE7E,CAAC,GAEMP;AACT,G"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["defaults","reduce","map","lockChoices","getShuffledChoices","isEmpty","partialScoring","Gn","hn","An","e","t","r","i","n","a","s","o","c","defaults_default","getAllCorrectResponses","correctAnswers","choices","key","respArea","choice","alternateResponse","getFeedback","correct","normalize","question","model","normalizedQuestion","session","area","obj","feedback","env","allCorrectResponses","respAreaLength","correctResponses","result","answer","value","correctChoice","isCorrect","shuffledValues","keys","us","part","update","resolve","storedValues","Cn","updateSession","teacherInstructions","rationale","choicesWillNullRationales","currentValue","acc","getScore","maxScore","config","correctCount","total","str","getLogTrace","traceLog","responseAreaKeys","totalAreas","selectedAreas","val","studentSelection","areaKey","correctOptions","opt","partialScoringEnabled","score","outcome","createCorrectResponseSession","correctChoices","getContent","html","validate","errors","field","nbOfResponseAreas","markup","maxResponseAreas","allChoices","choiceKey","maxResponseAreaChoices","piePackage","\"name\"","\"version\""],"sources":["../../../../../../shared/controller-utils/dist/index.js","../../../../src/controller/defaults.ts","../../../../src/controller/utils.ts","../../../../src/controller/index.ts"],"sourcesContent":["//#region \\0rolldown/runtime.js\nvar e = Object.defineProperty, t = (t, n) => {\n\tlet r = {};\n\tfor (var i in t) e(r, i, {\n\t\tget: t[i],\n\t\tenumerable: !0\n\t});\n\treturn n || e(r, Symbol.toStringTag, { value: \"Module\" }), r;\n};\n//#endregion\n//#region src/persistence.ts\nfunction n(e) {\n\treturn Array.isArray(e) ? e.filter((e) => e != null) : [];\n}\nfunction r(e) {\n\tlet t = [...e];\n\tfor (let e = t.length - 1; e > 0; e--) {\n\t\tlet n = Math.floor(Math.random() * (e + 1));\n\t\t[t[e], t[n]] = [t[n], t[e]];\n\t}\n\treturn t;\n}\nfunction i(e) {\n\treturn e == null ? !0 : Array.isArray(e) ? e.length === 0 : typeof e == \"object\" && Object.keys(e).length === 0;\n}\nasync function a(e, t, a, o = \"value\") {\n\tlet s = n(t?.data?.shuffledValues ?? t?.shuffledValues ?? []);\n\tif (!t) {\n\t\tconsole.warn(\"Unable to save shuffled choices because there's no session.\");\n\t\treturn;\n\t}\n\tif (!i(s)) return n(s.map((t) => e.find((e) => e[o] === t)));\n\tlet c = r(e);\n\tif (a && typeof a == \"function\") try {\n\t\tlet e = n(c.map((e) => e[o]));\n\t\ti(e) ? console.error(`shuffledValues is an empty array - refusing to call updateSession. shuffledChoices: ${JSON.stringify(c)}, key: ${o}`) : await a(t.id, t.element, { shuffledValues: e });\n\t} catch (e) {\n\t\tconsole.warn(\"Unable to save shuffled order for choices\"), console.error(e);\n\t}\n\telse console.warn(\"Unable to save shuffled choices, shuffle will happen every time.\");\n\treturn c;\n}\nfunction o(e, t, n) {\n\treturn !!(e.lockChoiceOrder || n?.[\"@pie-element\"]?.lockChoiceOrder);\n}\n//#endregion\n//#region src/partial-scoring.ts\nvar s = /* @__PURE__ */ t({ enabled: () => c });\nfunction c(e, t, n) {\n\treturn e?.partialScoring === !1 || t?.partialScoring === !1 ? !1 : typeof n != \"boolean\" || n;\n}\n//#endregion\n//#region src/response-normalizer.ts\nvar l = /[\\u061C\\u200E\\u200F\\u202A-\\u202E\\u2066-\\u2069\\u0640]/g, u = /[\\uFB50-\\uFDFF\\uFE70-\\uFEFC]+/g, d = /\\p{Nd}/u, f = /(?![0-9])\\p{Nd}/gu, p = /\\u066B/g, m = /\\u066C/g, h = /[\\u0622\\u0623\\u0625\\u0671]/g, g = /[\\u064B-\\u065F\\u0670]/g, _ = /* @__PURE__ */ new Map(), v = (e) => {\n\tlet t = _.get(e);\n\tif (t !== void 0) return t;\n\tlet n = 0;\n\tfor (; d.test(String.fromCodePoint(e - n - 1));) n++;\n\tlet r = n % 10;\n\treturn _.set(e, r), r;\n}, y = (e) => e.replace(f, (e) => String(v(e.codePointAt(0)))), b = {\n\tdecimal: \".\",\n\tgroup: \",\"\n}, x = /* @__PURE__ */ new Map(), S = (e) => {\n\tif (!e) return b;\n\tlet t = x.get(e);\n\tif (t) return t;\n\tlet n = b;\n\ttry {\n\t\tif (Intl.NumberFormat.supportedLocalesOf(e).length > 0) {\n\t\t\tlet t = new Intl.NumberFormat(e, { numberingSystem: \"latn\" }).formatToParts(12345.6);\n\t\t\tn = {\n\t\t\t\tdecimal: t.find((e) => e.type === \"decimal\")?.value ?? \".\",\n\t\t\t\tgroup: t.find((e) => e.type === \"group\")?.value ?? \",\"\n\t\t\t};\n\t\t}\n\t} catch {}\n\treturn x.set(e, n), n;\n}, C = (e, t) => {\n\tlet n = [e?.language, t?.locale];\n\tfor (let e of n) if (typeof e == \"string\" && e.trim()) return e.trim().replace(/_/g, \"-\");\n}, w = /^(tr|az)(-|$)/i, T = (e, t) => {\n\tif (!t || !w.test(t)) return e.toLowerCase();\n\ttry {\n\t\treturn e.toLocaleLowerCase(t);\n\t} catch {\n\t\treturn e.toLowerCase();\n\t}\n}, E = (e, t = {}) => {\n\tlet n = S(t.language), r = (t.ignoreCase ? T(e, t.language) : e).replace(l, \"\").replace(u, (e) => e.normalize(\"NFKC\")).normalize(\"NFC\");\n\treturn r = y(r).replace(p, n.decimal).replace(m, n.group), t.foldLetterVariants && (r = r.replace(g, \"\").replace(h, \"ا\").replace(/\\u0629/g, \"ه\").replace(/\\u0649/g, \"ي\")), r;\n};\n//#endregion\nexport { C as contentLanguage, T as foldCase, y as foldDigits, a as getShuffledChoices, o as lockChoices, E as normalizeResponse, s as partialScoring };\n","import type { InlineDropdownModel } from '../types.js';\n\nexport default {\n alternateResponse: {},\n choiceRationaleEnabled: true,\n choices: {},\n disabled: false,\n displayType: 'block',\n markup: '',\n mode: 'gather',\n prompt: '',\n promptEnabled: true,\n rationale: '',\n rationaleEnabled: true,\n shuffle: true,\n studentInstructionsEnabled: true,\n teacherInstructions: '',\n teacherInstructionsEnabled: true,\n toolbarEditorPosition: 'bottom',\n} satisfies Omit<InlineDropdownModel, 'id' | 'element'>;\n","import { forEach } from '@pie-element/shared-lodash';\nimport type { Choice, InlineDropdownModel } from '../types.js';\n\nexport const getAllCorrectResponses = ({\n choices,\n alternateResponse,\n}: Partial<Pick<InlineDropdownModel, 'choices' | 'alternateResponse'>>) => {\n alternateResponse = alternateResponse || {};\n const correctAnswers: Record<string, string[]> = {};\n\n forEach<Choice[]>(choices, (respArea, key) => {\n if (!correctAnswers[key]) {\n correctAnswers[key] = [];\n }\n\n if (respArea) {\n respArea.forEach((choice) => {\n if (choice.correct) {\n correctAnswers[key].push(choice.value);\n\n if (alternateResponse[key]) {\n correctAnswers[key] = [...correctAnswers[key], ...alternateResponse[key]];\n }\n }\n });\n }\n });\n\n return correctAnswers;\n};\n","import { isEmpty, map, reduce } from '@pie-element/shared-lodash';\nimport { lockChoices, getShuffledChoices, partialScoring } from '@pie-element/shared-controller-utils';\nimport type { PieEnvironment, PieUpdateSession } from '@pie-element/shared-types';\nimport defaults from './defaults.js';\n\nimport { getAllCorrectResponses } from './utils.js';\nimport type {\n Choice,\n Choices,\n InlineDropdownConfiguration,\n InlineDropdownModel,\n InlineDropdownSession,\n} from '../types.js';\n\n/** Errors `validate()` reports, keyed by field. */\nexport type InlineDropdownValidationErrors = {\n teacherInstructions?: string;\n prompt?: string;\n rationale?: string;\n responseAreasError?: string;\n responseAreaChoicesError?: string;\n};\n\n/** A choice as the controller hands it to the delivery: rationales are `null` unless the instructor sees them */\ntype DeliveryChoice = Omit<Choice, 'rationale'> & { rationale?: string | null };\n\nconst getFeedback = (correct: unknown) => {\n if (correct) {\n return 'correct';\n }\n\n return 'incorrect';\n};\n\nexport const normalize = (question: InlineDropdownModel) => ({ ...defaults, ...question });\n\n/**\n *\n * @param {*} question\n * @param {*} session\n * @param {*} env\n * @param {*} updateSession - optional - a function that will set the properties passed into it on the session.\n */\nexport async function model(\n question: InlineDropdownModel,\n session: InlineDropdownSession | null | undefined,\n env: PieEnvironment,\n updateSession?: PieUpdateSession,\n) {\n const normalizedQuestion = normalize(question);\n const { value = {} } = session || {};\n let choices = reduce<Choice[], Record<string, DeliveryChoice[] | undefined>>(\n normalizedQuestion.choices,\n (obj, area, key) => {\n obj[key] = map(area, (choice) => choice);\n\n return obj;\n },\n {},\n );\n\n let feedback: Record<string, string> = {};\n\n if (env.mode === 'evaluate') {\n const allCorrectResponses = getAllCorrectResponses(normalizedQuestion);\n const respAreaLength = Object.keys(allCorrectResponses).length;\n let correctResponses = 0;\n\n for (let i = 0; i < respAreaLength; i++) {\n const result = reduce<string[], { correctResponses: number; feedback: Record<string, string> }>(\n allCorrectResponses,\n (obj, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n const isCorrect = answer && correctChoice && correctChoice === answer;\n\n obj.feedback[key] = getFeedback(isCorrect);\n\n if (isCorrect) {\n obj.correctResponses += 1;\n }\n\n return obj;\n },\n { correctResponses: 0, feedback: {} },\n );\n\n if (result.correctResponses >= correctResponses) {\n correctResponses = result.correctResponses;\n feedback = result.feedback;\n }\n\n if (result.correctResponses === respAreaLength) {\n break;\n }\n }\n }\n\n // `lockChoices` ignores the session, so the per-area `shuffledValues` shape does not matter to it.\n const lockChoiceOrder = lockChoices(normalizedQuestion, session as Parameters<typeof lockChoices>[1], env);\n\n if (!lockChoiceOrder) {\n const shuffledValues: Record<string, string[]> = {};\n const keys = Object.keys(choices);\n\n const us =\n (part: string): PieUpdateSession =>\n (_id, _element, update) => {\n return new Promise((resolve) => {\n shuffledValues[part] = update.shuffledValues as string[];\n resolve();\n });\n };\n\n let i;\n\n for (i = 0; i < keys.length; i++) {\n const key = keys[i];\n const storedValues = (session?.shuffledValues as Record<string, string[]> | undefined)?.[key];\n\n choices[key] = await getShuffledChoices(\n choices[key] as DeliveryChoice[],\n // the shuffledValues structure was updated to an object like { choice_key: [] }\n // and we need to override shuffledValues if it's not an array\n { shuffledValues: Array.isArray(storedValues) ? storedValues : [] },\n us(key),\n 'value',\n );\n }\n\n if (!isEmpty(shuffledValues)) {\n if (session && updateSession && typeof updateSession === 'function') {\n updateSession(session.id as string, session.element as string, {\n shuffledValues,\n }).catch((e) => {\n // eslint-disable-next-line no-console\n console.error('update session failed', e);\n });\n }\n }\n }\n\n let teacherInstructions: string | null | undefined = null;\n let rationale: string | null | undefined = null;\n\n const choicesWillNullRationales = (Object.keys(choices) || []).reduce<Record<string, DeliveryChoice[]>>((acc, currentValue) => {\n acc[currentValue] = (choices[currentValue] || []).map((choice) => ({\n ...choice,\n rationale: null,\n }));\n\n return acc;\n }, {});\n\n if (env.role === 'instructor' && (env.mode === 'view' || env.mode === 'evaluate')) {\n rationale = normalizedQuestion.rationaleEnabled ? normalizedQuestion.rationale : null;\n teacherInstructions = normalizedQuestion.teacherInstructionsEnabled ? normalizedQuestion.teacherInstructions : null;\n\n choices = normalizedQuestion.choiceRationaleEnabled ? normalizedQuestion.choices : choicesWillNullRationales;\n } else {\n rationale = null;\n teacherInstructions = null;\n choices = choicesWillNullRationales;\n }\n\n const out = {\n disabled: env.mode !== 'gather',\n mode: env.mode,\n prompt: normalizedQuestion.promptEnabled ? normalizedQuestion.prompt : null,\n displayType: normalizedQuestion.displayType,\n markup: normalizedQuestion.markup,\n choices,\n feedback,\n\n responseCorrect: env.mode === 'evaluate' ? getScore(normalizedQuestion, session) === 1 : undefined,\n rationale,\n teacherInstructions,\n language: normalizedQuestion.language,\n extraCSSRules: normalizedQuestion.extraCSSRules,\n };\n\n return out;\n}\n\nexport const getScore = (\n config: Partial<Pick<InlineDropdownModel, 'choices' | 'alternateResponse'>>,\n session: InlineDropdownSession | null | undefined,\n) => {\n const { value = {} } = session || {};\n const maxScore = config && config.choices ? Object.keys(config.choices).length : 0;\n const allCorrectResponses = getAllCorrectResponses(config);\n let correctCount = 0;\n\n for (let i = 0; i < maxScore; i++) {\n const result = reduce<string[], number>(\n allCorrectResponses,\n (total, choices, key) => {\n const answer = (value && value[key]) || '';\n const correctChoice = choices[i] || '';\n\n if (correctChoice && answer && correctChoice === answer) {\n return total;\n }\n\n return total - 1;\n },\n maxScore,\n );\n\n if (result > correctCount) {\n correctCount = result;\n }\n\n if (result === maxScore) {\n break;\n }\n }\n\n const str = (correctCount / maxScore).toFixed(2);\n\n return parseFloat(str);\n};\n\n/**\n * Generates detailed trace log for scoring evaluation\n * @param {Object} model - the question model\n * @param {Object} session - the student session\n * @param {Object} env - the environment\n * @returns {Array} traceLog - array of trace messages\n */\nexport const getLogTrace = (\n model: InlineDropdownModel,\n session: InlineDropdownSession | null | undefined,\n env: Partial<PieEnvironment>,\n) => {\n const traceLog: string[] = [];\n const { value = {} } = session || {};\n const allCorrectResponses = getAllCorrectResponses(model);\n const responseAreaKeys = Object.keys(allCorrectResponses);\n const totalAreas = responseAreaKeys.length;\n \n traceLog.push(`${totalAreas} dropdown response area(s) defined in this question.`);\n \n if (value && Object.keys(value).length > 0) {\n const selectedAreas = Object.entries(value).filter(([, val]) => val && val.trim()).length;\n traceLog.push(`Student selected options in ${selectedAreas} out of ${totalAreas} dropdown(s).`);\n \n responseAreaKeys.forEach((areaKey) => {\n const studentSelection = (value && value[areaKey]) || '';\n const correctOptions = allCorrectResponses[areaKey] || [];\n \n if (studentSelection.trim()) {\n traceLog.push(`Dropdown ${parseInt(areaKey) + 1}: student selected '${studentSelection}' (correct options: [${correctOptions.map(opt => `'${opt}'`).join(', ')}]).`);\n } else {\n traceLog.push(`Dropdown ${parseInt(areaKey) + 1}: no selection made (correct options: [${correctOptions.map(opt => `'${opt}'`).join(', ')}]).`);\n }\n });\n } else {\n traceLog.push('Student did not make any selections in the dropdowns.');\n }\n\n const partialScoringEnabled = partialScoring.enabled(model, env);\n traceLog.push(\n `Scoring method: ${\n partialScoringEnabled ? 'partial scoring' : 'all-or-nothing scoring'\n }.`\n );\n\n const score = getScore(model, session);\n traceLog.push(`Final score: ${score}.`);\n\n return traceLog;\n}\n\n/**\n *\n * The score is partial by default for checkbox mode, allOrNothing for radio mode.\n * To disable partial scoring for checkbox mode you either set model.partialScoring = false or env.partialScoring =\n * false. the value in `env` will override the value in `model`.\n * @param {Object} model - the main model\n * @param {boolean} model.partialScoring - is partial scoring enabled (if undefined set to to true)\n * @param {*} session\n * @param {Object} env\n * @param {boolean} env.partialScoring - is partial scoring enabled (if undefined default to true) This overrides\n * `model.partialScoring`.\n */\nexport function outcome(\n model: InlineDropdownModel,\n session: InlineDropdownSession | null | undefined,\n env: Partial<PieEnvironment> = {},\n) {\n return new Promise<{ score: number; empty: boolean; traceLog: string[] }>((resolve) => {\n if (!session || isEmpty(session)) {\n resolve({ \n score: 0, \n empty: true, \n traceLog: ['Student did not make any selections in the dropdowns. Score is 0.'] \n });\n } else {\n const traceLog = getLogTrace(model, session, env);\n const score = getScore(model, session);\n const partialScoringEnabled = partialScoring.enabled(model, env);\n\n resolve({\n score: partialScoringEnabled ? score : Math.floor(score),\n empty: false,\n traceLog\n });\n }\n });\n}\n\nexport const createCorrectResponseSession = (question: InlineDropdownModel, env: PieEnvironment) => {\n return new Promise<InlineDropdownSession | null>((resolve) => {\n if (env.mode !== 'evaluate' && env.role === 'instructor') {\n const { choices } = question;\n const value: Record<string, string> = {};\n\n if (choices) {\n Object.keys(choices).forEach((key, i) => {\n const correctChoices = choices[key] && choices[key].filter((c) => c.correct);\n\n value[i] = correctChoices && correctChoices[0].value;\n });\n }\n\n resolve({\n id: '1',\n value,\n });\n } else {\n resolve(null);\n }\n });\n};\n\n// remove all html tags except img, iframe and source tag for audio\nconst getContent = (html: string | undefined) => (html || '').replace(/(<(?!img|iframe|source)([^>]+)>)/gi, '');\n\nexport const validate = (\n model: Partial<InlineDropdownModel> = {},\n config: InlineDropdownConfiguration = {},\n) => {\n const { markup, choices } = model;\n const { maxResponseAreas, maxResponseAreaChoices } = config;\n const errors: InlineDropdownValidationErrors = {};\n\n (['teacherInstructions', 'prompt', 'rationale'] as const).forEach((field) => {\n if (config[field]?.required && !getContent(model[field])) {\n errors[field] = 'This field is required.';\n }\n });\n\n const nbOfResponseAreas = ((markup || '').match(/\\{\\{(\\d+)\\}\\}/g) || []).length;\n\n if (maxResponseAreas !== undefined && nbOfResponseAreas > maxResponseAreas) {\n errors.responseAreasError = `No more than ${maxResponseAreas} response areas should be defined.`;\n } else if (nbOfResponseAreas < 1) {\n errors.responseAreasError = 'There should be defined at least 1 response area.';\n }\n\n // `Object.keys` throws when the model has no `choices`.\n const allChoices = choices as Choices;\n\n (Object.keys(allChoices) || []).forEach((choiceKey) => {\n if (\n allChoices[choiceKey] &&\n maxResponseAreaChoices !== undefined &&\n allChoices[choiceKey].length > maxResponseAreaChoices\n ) {\n errors.responseAreaChoicesError = `No more than ${maxResponseAreaChoices} choices per response area should be defined.`;\n }\n });\n\n return errors;\n};\n"],"mappings":";;AACA,IAAIU,IAAI,OAAO,gBAAgBC,KAAK,GAAG,MAAM;CAC5C,IAAIC,IAAI,CAAC;CACT,KAAK,IAAIC,KAAKF,GAAG,EAAEC,GAAGC,GAAG;EACxB,KAAKF,EAAEE;EACP,YAAY,CAAC;CACd,CAAC;CACD,OAAOC,KAAKJ,EAAEE,GAAG,OAAO,aAAa,EAAE,OAAO,SAAS,CAAC,GAAGA;AAC5D;AAGA,SAASE,EAAE,GAAG;CACb,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,QAAQ,MAAM,KAAK,IAAI,IAAI,CAAC;AACzD;AACA,SAASF,EAAE,GAAG;CACb,IAAI,IAAI,CAAC,GAAG,CAAC;CACb,KAAK,IAAI,IAAI,EAAE,SAAS,GAAG,IAAI,GAAG,KAAK;EACtC,IAAI,IAAI,KAAK,MAAM,KAAK,OAAO,K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AK,CAAC,EAAA,CAAG;CAEzE,AAAIC,MAAqB,KAAA,KAAaF,IAAoBE,IACxD,EAAO,qBAAqB,gBAAgBA,EAAiB,sCACpDF,IAAoB,MAC7B,EAAO,qBAAqB;CAI9B,IAAMG,IAAanE;CAYnB,QAVC,OAAO,KAAKmE,CAAU,KAAK,CAAC,EAAA,CAAG,SAAS,MAAc;EACrD,AACEA,EAAWC,MACXC,MAA2B,KAAA,KAC3BF,EAAWC,EAAU,CAAC,SAASC,MAE/B,EAAO,2BAA2B,gBAAgBA,EAAuB;CAE7E,CAAC,GAEMP;AACT,G"}
|
|
@@ -1359,7 +1359,7 @@ var Dt = x, X = Dt.default, Z = X && typeof X == "object" ? X : Dt, Ot = Y(i, "U
|
|
|
1359
1359
|
}
|
|
1360
1360
|
}, zt = Object.freeze({
|
|
1361
1361
|
name: "@pie-element/inline-dropdown",
|
|
1362
|
-
version: "11.0.8-next.
|
|
1362
|
+
version: "11.0.8-next.20261024053312"
|
|
1363
1363
|
});
|
|
1364
1364
|
//#endregion
|
|
1365
1365
|
export { Rt as default, zt as piePackage };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://cdn.jsdelivr.net/npm/@pie-element/inline-dropdown@11.0.8-next.
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/@pie-element/inline-dropdown@11.0.8-next.20261024053312/dist/schemas/configuration.schema.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
|
6
6
|
"baseInputConfiguration": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://cdn.jsdelivr.net/npm/@pie-element/inline-dropdown@11.0.8-next.
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/@pie-element/inline-dropdown@11.0.8-next.20261024053312/dist/schemas/model.schema.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
|
6
6
|
"id": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
-
"$id": "https://cdn.jsdelivr.net/npm/@pie-element/inline-dropdown@11.0.8-next.
|
|
3
|
+
"$id": "https://cdn.jsdelivr.net/npm/@pie-element/inline-dropdown@11.0.8-next.20261024053312/dist/schemas/session.schema.json",
|
|
4
4
|
"type": "object",
|
|
5
5
|
"properties": {
|
|
6
6
|
"id": {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/inline-dropdown",
|
|
3
|
-
"version": "11.0.8-next.
|
|
3
|
+
"version": "11.0.8-next.20261024053312",
|
|
4
4
|
"description": "",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -12,18 +12,18 @@
|
|
|
12
12
|
"@mui/icons-material": "^7.3.4",
|
|
13
13
|
"@mui/material": "^7.3.4",
|
|
14
14
|
"@pie-element/shared-configure-events": "0.1.3-next.20261023101922",
|
|
15
|
-
"@pie-element/shared-controller-utils": "0.1.5-next.
|
|
15
|
+
"@pie-element/shared-controller-utils": "0.1.5-next.20261024053312",
|
|
16
16
|
"@pie-element/shared-i18n": "0.1.3-next.20261024044430",
|
|
17
17
|
"@pie-element/shared-lodash": "0.1.4-next.20261023101922",
|
|
18
18
|
"@pie-element/shared-math-rendering-mathjax": "0.1.9-next.20261023101922",
|
|
19
19
|
"@pie-element/shared-player-events": "0.2.2-next.20261023101922",
|
|
20
|
-
"@pie-element/shared-types": "0.2.4-next.
|
|
21
|
-
"@pie-element/shared-utils": "0.1.7-next.
|
|
22
|
-
"@pie-lib/config-ui": "14.0.8-next.
|
|
23
|
-
"@pie-lib/correct-answer-toggle": "5.0.8-next.
|
|
24
|
-
"@pie-lib/editable-html-tip-tap": "3.1.3-next.
|
|
25
|
-
"@pie-lib/mask-markup": "4.1.3-next.
|
|
26
|
-
"@pie-lib/render-ui": "8.0.8-next.
|
|
20
|
+
"@pie-element/shared-types": "0.2.4-next.20261024053312",
|
|
21
|
+
"@pie-element/shared-utils": "0.1.7-next.20261024053312",
|
|
22
|
+
"@pie-lib/config-ui": "14.0.8-next.20261024053312",
|
|
23
|
+
"@pie-lib/correct-answer-toggle": "5.0.8-next.20261024053312",
|
|
24
|
+
"@pie-lib/editable-html-tip-tap": "3.1.3-next.20261024053312",
|
|
25
|
+
"@pie-lib/mask-markup": "4.1.3-next.20261024053312",
|
|
26
|
+
"@pie-lib/render-ui": "8.0.8-next.20261024053312",
|
|
27
27
|
"@pie-lib/translator": "5.0.3-next.20261023101922",
|
|
28
28
|
"debug": "^4.4.3",
|
|
29
29
|
"prop-types": "^15.8.1",
|