@intellectif/lk-react 12.0.1 → 14.0.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/CHANGELOG.md +73 -0
- package/README.md +17 -6
- package/dist/{WrittenResponse-BgcpEM-e.d.ts → WrittenResponse-C0P34En1.d.ts} +1 -1
- package/dist/{WrittenResponse-ByzXYEoW.d.cts → WrittenResponse-pB1ik8hg.d.cts} +1 -1
- package/dist/chunk-36FTYJWJ.cjs +869 -0
- package/dist/chunk-36FTYJWJ.cjs.map +1 -0
- package/dist/chunk-47HHC4GD.js +763 -0
- package/dist/chunk-47HHC4GD.js.map +1 -0
- package/dist/chunk-62AKSD5Y.js +509 -0
- package/dist/chunk-62AKSD5Y.js.map +1 -0
- package/dist/{chunk-XKGBD3UK.js → chunk-72UGRIMM.js} +6 -5
- package/dist/chunk-72UGRIMM.js.map +1 -0
- package/dist/{chunk-FX7VMZHQ.cjs → chunk-B2XQLU2E.cjs} +58 -8
- package/dist/chunk-B2XQLU2E.cjs.map +1 -0
- package/dist/{chunk-ZFWC4KZC.js → chunk-BO6P723E.js} +26 -31
- package/dist/chunk-BO6P723E.js.map +1 -0
- package/dist/chunk-BRPEB43C.cjs +13 -0
- package/dist/chunk-BRPEB43C.cjs.map +1 -0
- package/dist/{chunk-6KMEB7TF.cjs → chunk-BVRUUYYR.cjs} +42 -15
- package/dist/chunk-BVRUUYYR.cjs.map +1 -0
- package/dist/{chunk-AMGK7DDM.cjs → chunk-D4DQFTA7.cjs} +2 -2
- package/dist/chunk-D4DQFTA7.cjs.map +1 -0
- package/dist/chunk-D57QZILZ.js +863 -0
- package/dist/chunk-D57QZILZ.js.map +1 -0
- package/dist/chunk-F4TBCRGI.cjs +518 -0
- package/dist/chunk-F4TBCRGI.cjs.map +1 -0
- package/dist/{chunk-V6M57YMK.js → chunk-I33FOKZ7.js} +227 -30
- package/dist/chunk-I33FOKZ7.js.map +1 -0
- package/dist/{chunk-GVBEI5R3.cjs → chunk-J2CDPIRC.cjs} +233 -36
- package/dist/chunk-J2CDPIRC.cjs.map +1 -0
- package/dist/{chunk-KYOCDRUO.cjs → chunk-LB3FEV7Z.cjs} +97 -2
- package/dist/chunk-LB3FEV7Z.cjs.map +1 -0
- package/dist/{chunk-QXYAOILF.js → chunk-LGCUOLP6.js} +6 -5
- package/dist/chunk-LGCUOLP6.js.map +1 -0
- package/dist/{chunk-GWD75Q25.js → chunk-LLXCX5KK.js} +6 -5
- package/dist/chunk-LLXCX5KK.js.map +1 -0
- package/dist/chunk-MCO52PV5.js +520 -0
- package/dist/chunk-MCO52PV5.js.map +1 -0
- package/dist/{chunk-G6PUWKQC.cjs → chunk-NDQD3ZRY.cjs} +15 -14
- package/dist/chunk-NDQD3ZRY.cjs.map +1 -0
- package/dist/chunk-OD65OZIW.cjs +159 -0
- package/dist/chunk-OD65OZIW.cjs.map +1 -0
- package/dist/chunk-RCMYEWBE.js +11 -0
- package/dist/chunk-RCMYEWBE.js.map +1 -0
- package/dist/{chunk-KSXEBV2H.cjs → chunk-RRH7ZPXC.cjs} +6 -6
- package/dist/{chunk-KSXEBV2H.cjs.map → chunk-RRH7ZPXC.cjs.map} +1 -1
- package/dist/{chunk-DQNVAXG6.js → chunk-RXS455MR.js} +2 -2
- package/dist/chunk-RXS455MR.js.map +1 -0
- package/dist/{chunk-LIHKQEIP.cjs → chunk-SE6WWDVW.cjs} +15 -14
- package/dist/chunk-SE6WWDVW.cjs.map +1 -0
- package/dist/{chunk-5IH3NRXE.js → chunk-SWY6PWXK.js} +4 -4
- package/dist/{chunk-5IH3NRXE.js.map → chunk-SWY6PWXK.js.map} +1 -1
- package/dist/chunk-TDJEKXEP.js +212 -0
- package/dist/chunk-TDJEKXEP.js.map +1 -0
- package/dist/{chunk-NK5EVL5C.cjs → chunk-U3APKQ7P.cjs} +15 -14
- package/dist/chunk-U3APKQ7P.cjs.map +1 -0
- package/dist/chunk-UDCQTOVU.cjs +523 -0
- package/dist/chunk-UDCQTOVU.cjs.map +1 -0
- package/dist/{chunk-EWTAMY6L.cjs → chunk-USBANZ7K.cjs} +27 -33
- package/dist/chunk-USBANZ7K.cjs.map +1 -0
- package/dist/chunk-WTS34S5E.cjs +765 -0
- package/dist/chunk-WTS34S5E.cjs.map +1 -0
- package/dist/{chunk-2Y6V5E7H.js → chunk-XIBOFTOL.js} +57 -7
- package/dist/chunk-XIBOFTOL.js.map +1 -0
- package/dist/{chunk-ZFSRMGWO.js → chunk-XUEIUEPI.js} +6 -5
- package/dist/chunk-XUEIUEPI.js.map +1 -0
- package/dist/{chunk-64AJVB6O.cjs → chunk-YEYKJFEC.cjs} +14 -13
- package/dist/chunk-YEYKJFEC.cjs.map +1 -0
- package/dist/{chunk-5S2YDMEJ.js → chunk-YMBBM5K7.js} +36 -9
- package/dist/chunk-YMBBM5K7.js.map +1 -0
- package/dist/chunk-YORQQXGO.js +155 -0
- package/dist/chunk-YORQQXGO.js.map +1 -0
- package/dist/components/ActivityPreview.cjs +15 -9
- package/dist/components/ActivityPreview.d.cts +9 -3
- package/dist/components/ActivityPreview.d.ts +9 -3
- package/dist/components/ActivityPreview.js +14 -8
- package/dist/components/ActivitySequence.cjs +16 -10
- package/dist/components/ActivitySequence.d.cts +112 -6
- package/dist/components/ActivitySequence.d.ts +112 -6
- package/dist/components/ActivitySequence.js +15 -9
- package/dist/components/Dictation.cjs +19 -0
- package/dist/components/Dictation.cjs.map +1 -0
- package/dist/components/Dictation.d.cts +17 -0
- package/dist/components/Dictation.d.ts +17 -0
- package/dist/components/Dictation.js +10 -0
- package/dist/components/Dictation.js.map +1 -0
- package/dist/components/FillInTheBlanks.cjs +6 -5
- package/dist/components/FillInTheBlanks.d.cts +2 -1
- package/dist/components/FillInTheBlanks.d.ts +2 -1
- package/dist/components/FillInTheBlanks.js +5 -4
- package/dist/components/GapSelect.cjs +6 -5
- package/dist/components/GapSelect.d.cts +2 -1
- package/dist/components/GapSelect.d.ts +2 -1
- package/dist/components/GapSelect.js +5 -4
- package/dist/components/MultipleChoice.cjs +6 -5
- package/dist/components/MultipleChoice.d.cts +2 -1
- package/dist/components/MultipleChoice.d.ts +2 -1
- package/dist/components/MultipleChoice.js +5 -4
- package/dist/components/PronunciationFeedback.cjs +16 -0
- package/dist/components/PronunciationFeedback.cjs.map +1 -0
- package/dist/components/PronunciationFeedback.d.cts +64 -0
- package/dist/components/PronunciationFeedback.d.ts +64 -0
- package/dist/components/PronunciationFeedback.js +7 -0
- package/dist/components/PronunciationFeedback.js.map +1 -0
- package/dist/components/ReadAloud.cjs +21 -0
- package/dist/components/ReadAloud.cjs.map +1 -0
- package/dist/components/ReadAloud.d.cts +15 -0
- package/dist/components/ReadAloud.d.ts +15 -0
- package/dist/components/ReadAloud.js +12 -0
- package/dist/components/ReadAloud.js.map +1 -0
- package/dist/components/StimulusPanel.cjs +4 -4
- package/dist/components/StimulusPanel.d.cts +2 -1
- package/dist/components/StimulusPanel.d.ts +2 -1
- package/dist/components/StimulusPanel.js +3 -3
- package/dist/components/WrittenResponse.cjs +6 -5
- package/dist/components/WrittenResponse.d.cts +4 -3
- package/dist/components/WrittenResponse.d.ts +4 -3
- package/dist/components/WrittenResponse.js +5 -4
- package/dist/hooks/useSpeechRecorder.cjs +17 -0
- package/dist/hooks/useSpeechRecorder.cjs.map +1 -0
- package/dist/hooks/useSpeechRecorder.d.cts +127 -0
- package/dist/hooks/useSpeechRecorder.d.ts +127 -0
- package/dist/hooks/useSpeechRecorder.js +4 -0
- package/dist/hooks/useSpeechRecorder.js.map +1 -0
- package/dist/i18n/LkIntlProvider.cjs +7 -7
- package/dist/i18n/LkIntlProvider.d.cts +3 -2
- package/dist/i18n/LkIntlProvider.d.ts +3 -2
- package/dist/i18n/LkIntlProvider.js +1 -1
- package/dist/index.cjs +59 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -2
- package/dist/index.d.ts +7 -2
- package/dist/index.js +17 -11
- package/dist/index.js.map +1 -1
- package/dist/machine-CuwKqWXC.d.cts +26 -0
- package/dist/machine-CuwKqWXC.d.ts +26 -0
- package/dist/{strings-CN7n-BlE.d.ts → strings--ADnHcaA.d.cts} +261 -8
- package/dist/{strings-CN7n-BlE.d.cts → strings-CtdSf2St.d.ts} +261 -8
- package/dist/theme/ThemeProvider.cjs +6 -6
- package/dist/theme/ThemeProvider.d.cts +4 -4
- package/dist/theme/ThemeProvider.d.ts +4 -4
- package/dist/theme/ThemeProvider.js +1 -1
- package/dist/theme/skin.css +1050 -3
- package/package.json +43 -3
- package/dist/chunk-2Y6V5E7H.js.map +0 -1
- package/dist/chunk-5S2YDMEJ.js.map +0 -1
- package/dist/chunk-64AJVB6O.cjs.map +0 -1
- package/dist/chunk-6KMEB7TF.cjs.map +0 -1
- package/dist/chunk-AMGK7DDM.cjs.map +0 -1
- package/dist/chunk-CK7Z275S.js +0 -117
- package/dist/chunk-CK7Z275S.js.map +0 -1
- package/dist/chunk-DQNVAXG6.js.map +0 -1
- package/dist/chunk-EWTAMY6L.cjs.map +0 -1
- package/dist/chunk-FX7VMZHQ.cjs.map +0 -1
- package/dist/chunk-G6PUWKQC.cjs.map +0 -1
- package/dist/chunk-GVBEI5R3.cjs.map +0 -1
- package/dist/chunk-GWD75Q25.js.map +0 -1
- package/dist/chunk-KYOCDRUO.cjs.map +0 -1
- package/dist/chunk-LIHKQEIP.cjs.map +0 -1
- package/dist/chunk-NK5EVL5C.cjs.map +0 -1
- package/dist/chunk-QXYAOILF.js.map +0 -1
- package/dist/chunk-V6M57YMK.js.map +0 -1
- package/dist/chunk-XKGBD3UK.js.map +0 -1
- package/dist/chunk-ZFSRMGWO.js.map +0 -1
- package/dist/chunk-ZFWC4KZC.js.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkBRPEB43C_cjs = require('./chunk-BRPEB43C.cjs');
|
|
5
|
+
var chunkUSBANZ7K_cjs = require('./chunk-USBANZ7K.cjs');
|
|
6
|
+
var chunkB2XQLU2E_cjs = require('./chunk-B2XQLU2E.cjs');
|
|
5
7
|
var chunkXOR4MPEN_cjs = require('./chunk-XOR4MPEN.cjs');
|
|
6
|
-
var
|
|
7
|
-
var chunkKYOCDRUO_cjs = require('./chunk-KYOCDRUO.cjs');
|
|
8
|
+
var chunkLB3FEV7Z_cjs = require('./chunk-LB3FEV7Z.cjs');
|
|
8
9
|
var lkCore = require('@intellectif/lk-core');
|
|
9
10
|
var react = require('react');
|
|
10
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -60,9 +61,9 @@ function MultipleChoice({
|
|
|
60
61
|
shuffleSeed,
|
|
61
62
|
strings
|
|
62
63
|
}) {
|
|
63
|
-
const s =
|
|
64
|
+
const s = chunkLB3FEV7Z_cjs.useLkStrings(strings);
|
|
64
65
|
const devError = react.useMemo(() => {
|
|
65
|
-
if (!
|
|
66
|
+
if (!chunkUSBANZ7K_cjs.isDevelopment()) {
|
|
66
67
|
return null;
|
|
67
68
|
}
|
|
68
69
|
if (data.redacted === true) {
|
|
@@ -101,7 +102,7 @@ function MultipleChoice({
|
|
|
101
102
|
if (!data.shuffle) {
|
|
102
103
|
return [...data.options];
|
|
103
104
|
}
|
|
104
|
-
const seedSource = shuffleSeed ?? (sessionIdRef.current ??=
|
|
105
|
+
const seedSource = shuffleSeed ?? (sessionIdRef.current ??= chunkUSBANZ7K_cjs.randomSessionId());
|
|
105
106
|
return lkCore.seededShuffle(data.options, `${seedSource}:${data.id}`);
|
|
106
107
|
}, [data, shuffleSeed]);
|
|
107
108
|
const reviewDetails = react.useMemo(() => {
|
|
@@ -175,9 +176,9 @@ function MultipleChoice({
|
|
|
175
176
|
complete();
|
|
176
177
|
const timeSpent = getTimeSpent();
|
|
177
178
|
const xapiStatement = lkCore.xAPIBuilder.buildAnsweredStatement({
|
|
178
|
-
actor:
|
|
179
|
+
actor: chunkUSBANZ7K_cjs.ANONYMOUS_ACTOR,
|
|
179
180
|
object: {
|
|
180
|
-
id:
|
|
181
|
+
id: chunkUSBANZ7K_cjs.objectIdFor(data.id),
|
|
181
182
|
name: { [data.locale ?? "en-US"]: data.title },
|
|
182
183
|
// Activity-type IRI, interaction type and correct-responses pattern
|
|
183
184
|
// come from the REGISTERED descriptor, so a consumer-registered type
|
|
@@ -261,7 +262,7 @@ function MultipleChoice({
|
|
|
261
262
|
});
|
|
262
263
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "lk-mc", lang: locale, style: theme, children: [
|
|
263
264
|
data.media ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
264
|
-
|
|
265
|
+
chunkB2XQLU2E_cjs.ActivityMedia,
|
|
265
266
|
{
|
|
266
267
|
media: data.media,
|
|
267
268
|
renderMode,
|
|
@@ -283,14 +284,14 @@ function MultipleChoice({
|
|
|
283
284
|
isSingle ? /* @__PURE__ */ jsxRuntime.jsx("div", { role: "radiogroup", "aria-labelledby": questionId, children: optionList }) : /* @__PURE__ */ jsxRuntime.jsx("div", { children: optionList }),
|
|
284
285
|
isReview ? null : /* @__PURE__ */ jsxRuntime.jsx("button", { type: "submit", disabled: inactive, children: s.submit })
|
|
285
286
|
] }) }),
|
|
286
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
287
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkBRPEB43C_cjs.FeedbackRegion, { id: `${data.id}-feedback`, children: isReview ? reviewAnnouncement(outcome, s) : summary })
|
|
287
288
|
] });
|
|
288
289
|
}
|
|
289
290
|
function MultipleChoice2(props) {
|
|
290
|
-
const strings =
|
|
291
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
291
|
+
const strings = chunkLB3FEV7Z_cjs.useLkStrings(props.strings);
|
|
292
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkUSBANZ7K_cjs.ActivityErrorBoundary, { activityTitle: props.data?.title, strings, children: /* @__PURE__ */ jsxRuntime.jsx(MultipleChoice, { ...props }) });
|
|
292
293
|
}
|
|
293
294
|
|
|
294
295
|
exports.MultipleChoice = MultipleChoice2;
|
|
295
|
-
//# sourceMappingURL=chunk-
|
|
296
|
-
//# sourceMappingURL=chunk-
|
|
296
|
+
//# sourceMappingURL=chunk-NDQD3ZRY.cjs.map
|
|
297
|
+
//# sourceMappingURL=chunk-NDQD3ZRY.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/MultipleChoice/MultipleChoice.tsx","../src/components/MultipleChoice/index.tsx"],"names":["useLkStrings","useMemo","isDevelopment","validateActivity","ActivitySchemaError","useRef","useActivityState","useState","useEffect","randomSessionId","seededShuffle","score","xAPIBuilder","ANONYMOUS_ACTOR","objectIdFor","xapiDefinitionFor","jsxs","jsx","Fragment","ActivityMedia","FeedbackRegion","MultipleChoice","ActivityErrorBoundary"],"mappings":";;;;;;;;;;;AA8BA,SAAS,YAAY,QAAA,EAAiD;AACpE,EAAA,OAAO,QAAA,EAAU,IAAA,KAAS,iBAAA,GAAoB,QAAA,CAAS,oBAAoB,EAAC;AAC9E;AAWA,SAAS,cAAA,CAAe,QAAuB,WAAA,EAA+B;AAC5E,EAAA,QAAQ,OAAO,OAAA;AAAS,IACtB,KAAK,SAAA;AAAA,IACL,KAAK,oBAAA;AACH,MAAA,OAAO,IAAA;AAAA,IACT,KAAK,WAAA;AAAA,IACL,KAAK,kBAAA;AACH,MAAA,OAAO,KAAA;AAAA,IACT;AACE,MAAA,OAAO,WAAA,GAAc,MAAA,CAAO,OAAA,GAAU,CAAC,MAAA,CAAO,OAAA;AAAA;AAEpD;AASA,SAAS,kBAAA,CAAmB,SAAkC,CAAA,EAA6B;AACzF,EAAA,IAAI,YAAY,MAAA,EAAW;AACzB,IAAA,OAAO,IAAA;AAAA,EACT;AACA,EAAA,IAAI,OAAA,CAAQ,WAAW,QAAA,EAAU;AAC/B,IAAA,MAAM,UAAU,OAAA,CAAQ,QAAA;AACxB,IAAA,OAAO,GAAG,CAAA,CAAE,iBAAA,CAAk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A,EAAI,CAAA,EAAG,IAAA,CAAK,EAAE,CAAA,SAAA,CAAA,EAC3B,QAAA,EAAA,QAAA,GAAW,kBAAA,CAAmB,OAAA,EAAS,CAAC,CAAA,GAAI,OAAA,EAC/C;AAAA,GAAA,EACF,CAAA;AAEJ;AChcO,SAASC,gBAAe,KAAA,EAA4B;AAGzD,EAAA,MAAM,OAAA,GAAUrB,8BAAA,CAAa,KAAA,CAAM,OAAO,CAAA;AAC1C,EAAA,uBACEiB,cAAAA,CAACK,uCAAA,EAAA,EAAsB,aAAA,EAAe,KAAA,CAAM,IAAA,EAAM,KAAA,EAAO,OAAA,EACvD,QAAA,kBAAAL,cAAAA,CAAC,cAAA,EAAA,EAAoB,GAAG,OAAO,CAAA,EACjC,CAAA;AAEJ","file":"chunk-NDQD3ZRY.cjs","sourcesContent":["'use client';\n\nimport {\n ActivitySchemaError,\n type ItemOutcome,\n type LearnerResponse,\n type MultipleChoiceData,\n type MultipleChoiceLearnerResponse,\n type MultipleChoiceOption,\n type ScoringDetail,\n score,\n seededShuffle,\n validateActivity,\n xAPIBuilder,\n xapiDefinitionFor,\n} from '@intellectif/lk-core';\nimport { type CSSProperties, Fragment, useEffect, useMemo, useRef, useState } from 'react';\nimport { useActivityState } from '../../hooks/useActivityState.js';\nimport { useLkStrings } from '../../i18n/LkIntlProvider.js';\nimport type { LkStrings } from '../../i18n/strings.js';\nimport { ANONYMOUS_ACTOR, isDevelopment, objectIdFor, randomSessionId } from '../_internal.js';\nimport { ActivityMedia } from '../shared/ActivityMedia.js';\nimport { FeedbackRegion } from '../shared/FeedbackRegion.js';\nimport type { ActivityProps } from '../types.js';\n\n/**\n * Selected option ids carried by a learner response. Any other response shape\n * (a caller wiring the wrong item's state through `value`) reads as \"nothing\n * selected\" rather than throwing mid-exam.\n */\nfunction selectionOf(response: LearnerResponse | undefined): string[] {\n return response?.type === 'multiple-choice' ? response.selectedOptionIds : [];\n}\n\n/**\n * Whether an option is part of the correct answer, derived from the SERVER's\n * outcome — review mode never holds an answer key of its own.\n * {@link ScoringDetail.outcome} states this unambiguously. For 0.2-era details\n * that carry only the deprecated `correct` flag (which means \"the learner\n * ACTED correctly on this option\", not \"this option is the answer\") the fact\n * is still recoverable, because we know whether the learner selected it:\n * `isCorrect = wasSelected ? correct : !correct`.\n */\nfunction isAnswerOption(detail: ScoringDetail, wasSelected: boolean): boolean {\n switch (detail.outcome) {\n case 'correct':\n case 'incorrect-omission':\n return true;\n case 'incorrect':\n case 'correct-omission':\n return false;\n default:\n return wasSelected ? detail.correct : !detail.correct;\n }\n}\n\n/**\n * Announcement for `review` mode, built only from the server-supplied outcome.\n *\n * The authored overall feedback is appended by this function rather than being\n * baked into the score sentence, so a translation of \"Score 80%. Passed.\" never\n * has to carry the author's words with it.\n */\nfunction reviewAnnouncement(outcome: ItemOutcome | undefined, s: LkStrings): string | null {\n if (outcome === undefined) {\n return null;\n }\n if (outcome.status === 'scored') {\n const overall = outcome.feedback;\n return `${s.scoreAnnouncement(Math.round(outcome.score * 100), outcome.passed)}${\n overall ? ` ${overall}` : ''\n }`;\n }\n if (outcome.status === 'deferred') {\n // Never \"0%\": ungraded is not the same as wrong.\n return s.notGradedYet;\n }\n if (outcome.status === 'unscorable') {\n return s.noGradeAvailable;\n }\n // `graded` is left silent here deliberately: a returned GradeRecord on a\n // multiple-choice item has no rubric to render, and announcing a bare\n // percentage would duplicate what the marking already shows.\n return null;\n}\n\nexport interface MultipleChoiceProps extends ActivityProps<MultipleChoiceData> {\n /**\n * Seed for the deterministic option shuffle. Supply one (e.g. the attempt\n * id) to make the shuffled order reproducible server-side, stable across\n * page reloads, and identical between SSR and hydration. When absent, a\n * random per-mount session seed is used (order stable within the mount\n * only — the behaviour before `shuffleSeed` existed).\n */\n shuffleSeed?: string;\n}\n\nexport function MultipleChoice({\n data,\n onComplete,\n onSubmit,\n value,\n defaultValue,\n defaultSubmitted,\n onChange,\n renderMode = 'practice',\n outcome,\n sanitizeHtml,\n mediaBudget,\n mediaStrings,\n onInteraction,\n theme,\n locale,\n disabled,\n shuffleSeed,\n strings,\n}: MultipleChoiceProps) {\n const s = useLkStrings(strings);\n\n // Dev-only boundary validation (Req 2.3). Throwing during render lets\n // ActivityErrorBoundary catch it. Memoised so it only re-runs on data change.\n const devError = useMemo(() => {\n if (!isDevelopment()) {\n return null;\n }\n // A `redact()` projection cannot satisfy the full content schema — the\n // answer key is gone by design — and must not be checked against the\n // strict redacted schema either, since a `reveal: 'after-submit'`\n // projection legitimately carries answer-key fields for review renders.\n if (data.redacted === true) {\n return null;\n }\n const result = validateActivity('multiple-choice', data);\n return result.success ? null : new ActivitySchemaError('multiple-choice', result.errors);\n }, [data]);\n\n // Lazily created only when shuffling without a caller seed: avoids calling\n // crypto.randomUUID (absent on non-secure http origins) unless needed.\n const sessionIdRef = useRef<string | null>(null);\n const { state, start, complete, getTimeSpent, reset } = useActivityState(\n defaultSubmitted === true ? 'completed' : 'idle',\n );\n // Uncontrolled state. `defaultValue` seeds the mount only (React convention);\n // to re-seed later, remount with a `key` or drive the component with `value`.\n const [internalSelection, setInternalSelection] = useState<string[]>(() =>\n selectionOf(defaultValue),\n );\n const [summary, setSummary] = useState<string | null>(null);\n\n // Reset on data-prop CHANGE (Req 3.7). The identity guard makes the mount\n // run a no-op, which it always was before `defaultValue` existed — without\n // it this effect would wipe the seed immediately after the first render.\n // (It also makes the reset StrictMode-safe: a remount with unchanged data\n // no longer discards the learner's selection.)\n // Resets back to `defaultValue`, not to empty. Clearing looked safer — it\n // cannot carry a stale answer into a different question — but `data`\n // identity is a poor proxy for \"different question\": a parent that builds\n // entries in render (`activities={raw.map(redact)}`, the documented exam\n // pattern) hands over a new object every render, and clearing wiped every\n // RESTORED answer on the first unrelated re-render, silently. `defaultValue`\n // is by definition the caller's seed for the CURRENT data, which is what\n // FillInTheBlanks already reset to; the two now agree.\n const defaultValueRef = useRef(defaultValue);\n useEffect(() => {\n defaultValueRef.current = defaultValue;\n }, [defaultValue]);\n // A data change must return the item to its SEED, submitted state included —\n // resetting to idle unlocked work the learner had already committed.\n const defaultSubmittedRef = useRef(defaultSubmitted);\n useEffect(() => {\n defaultSubmittedRef.current = defaultSubmitted;\n }, [defaultSubmitted]);\n const lastDataRef = useRef(data);\n useEffect(() => {\n if (lastDataRef.current === data) {\n return;\n }\n lastDataRef.current = data;\n setInternalSelection(selectionOf(defaultValueRef.current));\n setSummary(null);\n reset(defaultSubmittedRef.current === true ? 'completed' : 'idle');\n }, [data, reset]);\n\n const displayedOptions = useMemo<MultipleChoiceOption[]>(() => {\n if (!data.shuffle) {\n return [...data.options];\n }\n // biome-ignore lint/suspicious/noAssignInExpressions: sanctioned lazy ref initialization\n const seedSource = shuffleSeed ?? (sessionIdRef.current ??= randomSessionId());\n // The seed string is unchanged from when the algorithm lived in this file,\n // so an order a consumer recorded against a seed still reproduces.\n return seededShuffle(data.options, `${seedSource}:${data.id}`);\n }, [data, shuffleSeed]);\n\n // Per-option correctness for `review`, indexed by option id. Null unless the\n // caller supplied a SCORED outcome — the only source of truth this mode has.\n const reviewDetails = useMemo(() => {\n if (renderMode !== 'review' || outcome === undefined || outcome.status !== 'scored') {\n return null;\n }\n return new Map(outcome.details.map((detail) => [detail.itemId, detail]));\n }, [renderMode, outcome]);\n\n // All hooks are called before these throws, so hook order stays stable.\n if (devError) {\n throw devError;\n }\n // Practice grades locally, which a redacted projection cannot support:\n // `score()` would throw from the submit handler — where no error boundary\n // can catch it — AFTER the learner has answered. Fail loudly at render\n // instead, in production too. Wiring an exam item into the self-grading\n // mode is precisely the accident `renderMode` exists to prevent.\n if (data.redacted === true && renderMode === 'practice') {\n throw new Error(\n `Multiple Choice \"${data.id}\" received redacted activity data in renderMode \"practice\", ` +\n 'which grades locally and has no answer key to grade against. ' +\n 'Render redacted data with renderMode=\"exam\" (server grades) or \"review\" (pass `outcome`).',\n );\n }\n\n const isSingle = data.mode === 'single';\n const isExam = renderMode === 'exam';\n const isReview = renderMode === 'review';\n const submitted = state === 'completed';\n const inactive = disabled === true || submitted || isReview;\n const isControlled = value !== undefined;\n const selected = isControlled ? selectionOf(value) : internalSelection;\n /**\n * Whether correctness and authored feedback may be shown. Practice earns it\n * by grading locally after submit; review shows what the server already\n * graded. Exam never reveals anything — not before, not after submit.\n */\n const reveal = isReview || (renderMode === 'practice' && submitted);\n\n const fireInteraction = (\n type: 'option-selected' | 'option-deselected' | 'submitted',\n payload: Record<string, unknown>,\n ): void => {\n onInteraction?.({ type, activityId: data.id, timestamp: Date.now(), payload });\n };\n\n /** Single funnel for every response change: owns state only when uncontrolled. */\n const emitChange = (selectedOptionIds: string[]): void => {\n if (!isControlled) {\n setInternalSelection(selectedOptionIds);\n }\n onChange?.({ type: 'multiple-choice', selectedOptionIds });\n };\n\n const selectSingle = (optionId: string): void => {\n if (inactive) {\n return;\n }\n if (state === 'idle') {\n start();\n }\n emitChange([optionId]);\n fireInteraction('option-selected', { optionId });\n };\n\n const toggleMulti = (optionId: string, checked: boolean): void => {\n if (inactive) {\n return;\n }\n if (state === 'idle') {\n start();\n }\n emitChange(checked ? [...selected, optionId] : selected.filter((id) => id !== optionId));\n fireInteraction(checked ? 'option-selected' : 'option-deselected', { optionId });\n };\n\n const handleSubmit = (event: React.FormEvent): void => {\n event.preventDefault();\n if (inactive) {\n return;\n }\n const response: MultipleChoiceLearnerResponse = {\n type: 'multiple-choice',\n selectedOptionIds: selected,\n };\n // Always first, and before anything that can throw: an exam runner must be\n // able to persist the raw response no matter what happens after.\n onSubmit?.(response);\n\n if (isExam) {\n // No score(), no answer key read, no onComplete, no xAPI — the server\n // grades. The announcement deliberately carries no correctness signal.\n complete();\n setSummary(s.answerSubmitted);\n fireInteraction('submitted', { selectedOptionIds: selected });\n return;\n }\n\n const scoringResult = score('multiple-choice', data as MultipleChoiceData, response);\n complete();\n const timeSpent = getTimeSpent();\n const xapiStatement = xAPIBuilder.buildAnsweredStatement({\n actor: ANONYMOUS_ACTOR,\n object: {\n id: objectIdFor(data.id),\n name: { [data.locale ?? 'en-US']: data.title },\n // Activity-type IRI, interaction type and correct-responses pattern\n // come from the REGISTERED descriptor, so a consumer-registered type\n // gets correct interop without touching this component.\n ...xapiDefinitionFor(data),\n choices: data.options.map((option) => ({\n id: option.id,\n description: { [data.locale ?? 'en-US']: option.text },\n })),\n },\n scoringResult,\n timeSpentMs: timeSpent,\n response: selected.join(','),\n });\n onComplete?.({\n score: scoringResult.score,\n maxScore: scoringResult.maxScore,\n passed: scoringResult.passed,\n timeSpent,\n xapiStatement,\n });\n // Core selects the authored overall feedback on `passed` (B3 fix).\n const overall = scoringResult.feedback;\n setSummary(\n `${s.answerSubmitted} ${s.scoreAnnouncement(\n Math.round(scoringResult.score * 100),\n scoringResult.passed,\n )}${overall ? ` ${overall}` : ''}`,\n );\n fireInteraction('submitted', {\n selectedOptionIds: selected,\n score: scoringResult.score,\n });\n };\n\n const questionId = `${data.id}-question`;\n // Rich text renders ONLY through a caller-supplied sanitiser; without one we\n // fall back to the plain-text field, escaped by React (types.ts HtmlSanitizer).\n const questionHtml =\n sanitizeHtml !== undefined && data.questionHtml !== undefined\n ? sanitizeHtml(data.questionHtml)\n : null;\n\n const optionList = displayedOptions.map((option) => {\n const checked = selected.includes(option.id);\n // `data-correct` means \"this option is part of the correct answer\".\n let correctness: string | undefined;\n if (isReview) {\n const detail = reviewDetails?.get(option.id);\n correctness = detail === undefined ? undefined : String(isAnswerOption(detail, checked));\n } else if (reveal) {\n correctness = String(option.isCorrect);\n }\n const media = option.media;\n // A picture goes INSIDE the label: it has no controls of its own, clicking\n // it is how a learner picks that option, and its `alt` joins the option's\n // accessible name. A recording cannot — see below.\n const picture =\n media?.type === 'image' ? (\n <img className=\"lk-mc-option-image\" src={media.url} alt={media.alt ?? ''} />\n ) : null;\n\n const label = (\n <label className=\"lk-mc-option\" data-correct={correctness}>\n <input\n type={isSingle ? 'radio' : 'checkbox'}\n name={isSingle ? `${data.id}-options` : undefined}\n value={option.id}\n checked={checked}\n disabled={inactive}\n aria-disabled={inactive || undefined}\n onChange={(e) =>\n isSingle ? selectSingle(option.id) : toggleMulti(option.id, e.target.checked)\n }\n />\n <span>{option.text}</span>\n {picture}\n {reveal && option.feedback ? (\n <span className=\"lk-mc-option-feedback\" role=\"note\">\n {option.feedback}\n </span>\n ) : null}\n </label>\n );\n\n if (media?.type !== 'audio') {\n return <Fragment key={option.id}>{label}</Fragment>;\n }\n\n // A recording sits OUTSIDE the label, deliberately. A <label> activates its\n // control for any click inside it, so an <audio> nested in one would select\n // the option the moment the learner pressed play — and a listening item is\n // answered by comparing all the recordings before choosing any of them.\n // Selecting an option must stay something the learner does on purpose.\n return (\n <div className=\"lk-mc-option-media\" key={option.id}>\n {label}\n {/* biome-ignore lint/a11y/useMediaCaption: captions are optional in the data contract — a <track> is rendered when captionsUrl is provided; absence is the author's documented choice (Req 14.5) */}\n <audio\n className=\"lk-mc-option-audio\"\n src={media.url}\n controls\n preload=\"none\"\n aria-label={media.alt ?? option.text}\n >\n {media.captionsUrl ? (\n <track kind=\"captions\" src={media.captionsUrl} label={media.alt ?? option.text} />\n ) : null}\n </audio>\n </div>\n );\n });\n\n return (\n <div className=\"lk-mc\" lang={locale} style={theme as CSSProperties | undefined}>\n {data.media ? (\n <ActivityMedia\n media={data.media}\n renderMode={renderMode}\n {...(mediaBudget !== undefined ? { mediaBudget } : {})}\n {...(mediaStrings !== undefined ? { mediaStrings } : {})}\n {...(strings !== undefined ? { strings } : {})}\n {...(onInteraction !== undefined ? { onInteraction } : {})}\n {...(locale !== undefined ? { locale } : {})}\n />\n ) : null}\n <form onSubmit={handleSubmit}>\n <fieldset disabled={inactive}>\n {questionHtml === null ? (\n <legend id={questionId}>{data.question}</legend>\n ) : (\n <legend\n id={questionId}\n // biome-ignore lint/security/noDangerouslySetInnerHtml: HTML is the output of the caller-supplied sanitizeHtml (types.ts HtmlSanitizer contract)\n dangerouslySetInnerHTML={{ __html: questionHtml }}\n />\n )}\n {/*\n single: an explicit radiogroup is meaningful (fieldset's implicit\n role is `group`, not `radiogroup`). multi: the fieldset + legend\n already provide a named group — an explicit role=\"group\" here would\n be a redundant, duplicate same-named group in the a11y tree, so we\n use a plain layout div. (Refines the design ARIA sketch.)\n */}\n {isSingle ? (\n <div role=\"radiogroup\" aria-labelledby={questionId}>\n {optionList}\n </div>\n ) : (\n <div>{optionList}</div>\n )}\n {/* review is read-only: there is nothing left to submit. */}\n {isReview ? null : (\n <button type=\"submit\" disabled={inactive}>\n {s.submit}\n </button>\n )}\n </fieldset>\n </form>\n <FeedbackRegion id={`${data.id}-feedback`}>\n {isReview ? reviewAnnouncement(outcome, s) : summary}\n </FeedbackRegion>\n </div>\n );\n}\n","'use client';\n\nimport { useLkStrings } from '../../i18n/LkIntlProvider.js';\nimport { ActivityErrorBoundary } from '../ActivityErrorBoundary.js';\nimport {\n MultipleChoice as MultipleChoiceCore,\n type MultipleChoiceProps,\n} from './MultipleChoice.js';\n\nexport type { MultipleChoiceProps } from './MultipleChoice.js';\n\n/**\n * Public Multiple Choice activity: the core component wrapped in\n * `ActivityErrorBoundary` so a render failure (incl. the dev schema-validation\n * throw) degrades to an accessible fallback instead of crashing the host.\n */\nexport function MultipleChoice(props: MultipleChoiceProps) {\n // Read here rather than in the boundary: a class component cannot call a\n // hook, and the fallback it renders is learner-facing text like any other.\n const strings = useLkStrings(props.strings);\n return (\n <ActivityErrorBoundary activityTitle={props.data?.title} strings={strings}>\n <MultipleChoiceCore {...props} />\n </ActivityErrorBoundary>\n );\n}\n"]}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
// src/i18n/direction.ts
|
|
5
|
+
var RTL_SCRIPT_CODES = /* @__PURE__ */ new Set([
|
|
6
|
+
"phlv",
|
|
7
|
+
"adlm",
|
|
8
|
+
"arab",
|
|
9
|
+
"aran",
|
|
10
|
+
"armi",
|
|
11
|
+
"avst",
|
|
12
|
+
"chrs",
|
|
13
|
+
"cprt",
|
|
14
|
+
"elym",
|
|
15
|
+
"gara",
|
|
16
|
+
"hatr",
|
|
17
|
+
"hebr",
|
|
18
|
+
"hung",
|
|
19
|
+
"khar",
|
|
20
|
+
"lydi",
|
|
21
|
+
"mand",
|
|
22
|
+
"mani",
|
|
23
|
+
"mend",
|
|
24
|
+
"merc",
|
|
25
|
+
"mero",
|
|
26
|
+
"narb",
|
|
27
|
+
"nbat",
|
|
28
|
+
"nkoo",
|
|
29
|
+
"orkh",
|
|
30
|
+
"ougr",
|
|
31
|
+
"palm",
|
|
32
|
+
"phli",
|
|
33
|
+
"phlp",
|
|
34
|
+
"phnx",
|
|
35
|
+
"prti",
|
|
36
|
+
"rohg",
|
|
37
|
+
"samr",
|
|
38
|
+
"sarb",
|
|
39
|
+
"sidt",
|
|
40
|
+
"sogd",
|
|
41
|
+
"sogo",
|
|
42
|
+
"syrc",
|
|
43
|
+
"syre",
|
|
44
|
+
"syrj",
|
|
45
|
+
"syrn",
|
|
46
|
+
"thaa",
|
|
47
|
+
"yezi"
|
|
48
|
+
]);
|
|
49
|
+
var RTL_LANGUAGES = /* @__PURE__ */ new Set([
|
|
50
|
+
"acm",
|
|
51
|
+
"aeb",
|
|
52
|
+
"aii",
|
|
53
|
+
"ajp",
|
|
54
|
+
"apc",
|
|
55
|
+
"ar",
|
|
56
|
+
"arc",
|
|
57
|
+
"ars",
|
|
58
|
+
"ary",
|
|
59
|
+
"arz",
|
|
60
|
+
"azb",
|
|
61
|
+
"bqi",
|
|
62
|
+
"ckb",
|
|
63
|
+
"dv",
|
|
64
|
+
"fa",
|
|
65
|
+
"glk",
|
|
66
|
+
"hbo",
|
|
67
|
+
"he",
|
|
68
|
+
"iw",
|
|
69
|
+
"ji",
|
|
70
|
+
"jrb",
|
|
71
|
+
"khw",
|
|
72
|
+
"lrc",
|
|
73
|
+
"mzn",
|
|
74
|
+
"nqo",
|
|
75
|
+
"ota",
|
|
76
|
+
"pnb",
|
|
77
|
+
"prs",
|
|
78
|
+
"ps",
|
|
79
|
+
"sdh",
|
|
80
|
+
"skr",
|
|
81
|
+
"syc",
|
|
82
|
+
"syr",
|
|
83
|
+
"ur",
|
|
84
|
+
"yi"
|
|
85
|
+
]);
|
|
86
|
+
var RTL_BLOCKS = [
|
|
87
|
+
[1424, 2303],
|
|
88
|
+
[64285, 65023],
|
|
89
|
+
[65136, 65279],
|
|
90
|
+
[67584, 69631],
|
|
91
|
+
[124928, 126975]
|
|
92
|
+
];
|
|
93
|
+
var RTL_DIGITS = [
|
|
94
|
+
[1984, 1993],
|
|
95
|
+
[125127, 125135],
|
|
96
|
+
[125264, 125273]
|
|
97
|
+
];
|
|
98
|
+
var LETTER_RE = /^\p{L}$/u;
|
|
99
|
+
var NUMBER_RE = /^\p{N}$/u;
|
|
100
|
+
function within(point, ranges) {
|
|
101
|
+
return ranges.some(([first, last]) => point >= first && point <= last);
|
|
102
|
+
}
|
|
103
|
+
function scriptSubtagOf(subtags) {
|
|
104
|
+
if (subtags[0].length === 1) {
|
|
105
|
+
return void 0;
|
|
106
|
+
}
|
|
107
|
+
let index = 1;
|
|
108
|
+
while (index < subtags.length && index <= 3 && /^[a-z]{3}$/.test(subtags[index])) {
|
|
109
|
+
index += 1;
|
|
110
|
+
}
|
|
111
|
+
const candidate = subtags[index];
|
|
112
|
+
if (candidate === void 0 || !/^[a-z]{4}$/.test(candidate)) {
|
|
113
|
+
return void 0;
|
|
114
|
+
}
|
|
115
|
+
return /^z/.test(candidate) || candidate >= "qaaa" && candidate <= "qabx" ? void 0 : candidate;
|
|
116
|
+
}
|
|
117
|
+
function localeDirectionOf(locale) {
|
|
118
|
+
if (typeof locale !== "string") {
|
|
119
|
+
return void 0;
|
|
120
|
+
}
|
|
121
|
+
const subtags = locale.toLowerCase().split(/[-_]/);
|
|
122
|
+
const script = scriptSubtagOf(subtags);
|
|
123
|
+
if (script !== void 0) {
|
|
124
|
+
return RTL_SCRIPT_CODES.has(script) ? "rtl" : "ltr";
|
|
125
|
+
}
|
|
126
|
+
return RTL_LANGUAGES.has(subtags[0]) ? "rtl" : void 0;
|
|
127
|
+
}
|
|
128
|
+
var LEFT_TO_RIGHT_MARK = String.fromCodePoint(8206);
|
|
129
|
+
var RIGHT_TO_LEFT_MARKS = /* @__PURE__ */ new Set([String.fromCodePoint(8207), String.fromCodePoint(1564)]);
|
|
130
|
+
function textDirectionOf(text) {
|
|
131
|
+
for (const character of text) {
|
|
132
|
+
if (character === LEFT_TO_RIGHT_MARK) {
|
|
133
|
+
return "ltr";
|
|
134
|
+
}
|
|
135
|
+
if (RIGHT_TO_LEFT_MARKS.has(character)) {
|
|
136
|
+
return "rtl";
|
|
137
|
+
}
|
|
138
|
+
if (LETTER_RE.test(character)) {
|
|
139
|
+
return within(character.codePointAt(0), RTL_BLOCKS) ? "rtl" : "ltr";
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return void 0;
|
|
143
|
+
}
|
|
144
|
+
function characterDirectionOf(character) {
|
|
145
|
+
const point = character.codePointAt(0);
|
|
146
|
+
if (NUMBER_RE.test(character)) {
|
|
147
|
+
return within(point, RTL_DIGITS) ? "rtl" : "ltr";
|
|
148
|
+
}
|
|
149
|
+
if (LETTER_RE.test(character)) {
|
|
150
|
+
return within(point, RTL_BLOCKS) ? "rtl" : "ltr";
|
|
151
|
+
}
|
|
152
|
+
return void 0;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
exports.characterDirectionOf = characterDirectionOf;
|
|
156
|
+
exports.localeDirectionOf = localeDirectionOf;
|
|
157
|
+
exports.textDirectionOf = textDirectionOf;
|
|
158
|
+
//# sourceMappingURL=chunk-OD65OZIW.cjs.map
|
|
159
|
+
//# sourceMappingURL=chunk-OD65OZIW.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/i18n/direction.ts"],"names":[],"mappings":";;;AAQA,IAAM,gBAAA,uBAAuB,GAAA,CAAI;AAAA,EAC/B,MAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,EACA,MAAA;AAAA,E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AQ,SAAA,CAAU,WAAA,CAAY,CAAC,CAAA;AACrC,EAAA,IAAI,SAAA,CAAU,IAAA,CAAK,SAAS,CAAA,EAAG;AAC7B,IAAA,OAAO,MAAA,CAAO,KAAA,EAAO,UAAU,CAAA,GAAI,KAAA,GAAQ,KAAA;AAAA,EAC7C;AACA,EAAA,IAAI,SAAA,CAAU,IAAA,CAAK,SAAS,CAAA,EAAG;AAC7B,IAAA,OAAO,MAAA,CAAO,KAAA,EAAO,UAAU,CAAA,GAAI,KAAA,GAAQ,KAAA;AAAA,EAC7C;AACA,EAAA,OAAO,MAAA;AACT","file":"chunk-OD65OZIW.cjs","sourcesContent":["/**\n * The writing direction of authored content. A language tag is read from the\n * tag alone, so a server rendering and the browser that hydrates it agree on\n * it. Text is read by the runtime's Unicode tables, which agree on every\n * character both runtimes' Unicode versions know.\n */\n\n/** ISO 15924 codes of the scripts written right to left. */\nconst RTL_SCRIPT_CODES = new Set([\n 'phlv',\n 'adlm',\n 'arab',\n 'aran',\n 'armi',\n 'avst',\n 'chrs',\n 'cprt',\n 'elym',\n 'gara',\n 'hatr',\n 'hebr',\n 'hung',\n 'khar',\n 'lydi',\n 'mand',\n 'mani',\n 'mend',\n 'merc',\n 'mero',\n 'narb',\n 'nbat',\n 'nkoo',\n 'orkh',\n 'ougr',\n 'palm',\n 'phli',\n 'phlp',\n 'phnx',\n 'prti',\n 'rohg',\n 'samr',\n 'sarb',\n 'sidt',\n 'sogd',\n 'sogo',\n 'syrc',\n 'syre',\n 'syrj',\n 'syrn',\n 'thaa',\n 'yezi',\n]);\n\n/**\n * Languages written right to left in every script they are commonly written\n * in, including the deprecated tags `iw` and `ji` and the Arabic varieties\n * with tags of their own. A language also written left to right — Kurdish,\n * Sindhi, Uyghur — is not listed: its own text decides.\n */\nconst RTL_LANGUAGES = new Set([\n 'acm',\n 'aeb',\n 'aii',\n 'ajp',\n 'apc',\n 'ar',\n 'arc',\n 'ars',\n 'ary',\n 'arz',\n 'azb',\n 'bqi',\n 'ckb',\n 'dv',\n 'fa',\n 'glk',\n 'hbo',\n 'he',\n 'iw',\n 'ji',\n 'jrb',\n 'khw',\n 'lrc',\n 'mzn',\n 'nqo',\n 'ota',\n 'pnb',\n 'prs',\n 'ps',\n 'sdh',\n 'skr',\n 'syc',\n 'syr',\n 'ur',\n 'yi',\n]);\n\n/**\n * The code-point blocks Unicode reserves for right-to-left scripts (their\n * default bidirectional class is R or AL): Hebrew through Arabic Extended-A,\n * the Hebrew and Arabic presentation forms, the historic right-to-left scripts\n * of the Supplementary Multilingual Plane, and Mende Kikakui through the Arabic\n * mathematical letters. A letter in one of them is written right to left.\n */\nconst RTL_BLOCKS: readonly (readonly [number, number])[] = [\n [0x0590, 0x08ff],\n [0xfb1d, 0xfdff],\n [0xfe70, 0xfeff],\n [0x10800, 0x10fff],\n [0x1e800, 0x1efff],\n];\n\n/** Digits whose bidirectional class is R: N'Ko, Mende Kikakui and Adlam. */\nconst RTL_DIGITS: readonly (readonly [number, number])[] = [\n [0x07c0, 0x07c9],\n [0x1e8c7, 0x1e8cf],\n [0x1e950, 0x1e959],\n];\n\nconst LETTER_RE = /^\\p{L}$/u;\nconst NUMBER_RE = /^\\p{N}$/u;\n\nfunction within(point: number, ranges: readonly (readonly [number, number])[]): boolean {\n return ranges.some(([first, last]) => point >= first && point <= last);\n}\n\n/**\n * The script subtag of a BCP 47 tag's lowercased subtags, if it names a\n * direction: not in a private-use or grandfathered tag (`x-arab`, `i-klingon`),\n * and not one of the codes for no particular script — Common, Inherited,\n * Unwritten, Unknown and the like (`Z` codes) or private use (`Qaaa`–`Qabx`).\n */\nfunction scriptSubtagOf(subtags: readonly string[]): string | undefined {\n if ((subtags[0] as string).length === 1) {\n return undefined;\n }\n let index = 1;\n // Up to three extended language subtags may come between language and script.\n while (index < subtags.length && index <= 3 && /^[a-z]{3}$/.test(subtags[index] as string)) {\n index += 1;\n }\n const candidate = subtags[index];\n if (candidate === undefined || !/^[a-z]{4}$/.test(candidate)) {\n return undefined;\n }\n return /^z/.test(candidate) || (candidate >= 'qaaa' && candidate <= 'qabx')\n ? undefined\n : candidate;\n}\n\n/**\n * The direction a language tag names, or `undefined` when it names none: its\n * script subtag when it has one (`ku-Arab` is right-to-left, `ar-Latn` is not),\n * then the languages above. `-` and `_` both separate subtags. Anything that is\n * not a string names none.\n */\nexport function localeDirectionOf(locale: unknown): 'ltr' | 'rtl' | undefined {\n if (typeof locale !== 'string') {\n return undefined;\n }\n const subtags = locale.toLowerCase().split(/[-_]/);\n const script = scriptSubtagOf(subtags);\n if (script !== undefined) {\n return RTL_SCRIPT_CODES.has(script) ? 'rtl' : 'ltr';\n }\n return RTL_LANGUAGES.has(subtags[0] as string) ? 'rtl' : undefined;\n}\n\nconst LEFT_TO_RIGHT_MARK = String.fromCodePoint(0x200e);\n/** RIGHT-TO-LEFT MARK and ARABIC LETTER MARK. */\nconst RIGHT_TO_LEFT_MARKS = new Set([String.fromCodePoint(0x200f), String.fromCodePoint(0x61c)]);\n\n/**\n * The direction of `text`'s first letter or directional mark — an author can\n * start a transcript with a right-to-left mark to lay it out right to left — or\n * `undefined` when it has neither. Other characters with a strong direction,\n * such as a Hebrew punctuation mark or an N'Ko digit, are not read, so this is\n * the first strong character the Unicode bidirectional algorithm finds only\n * where the text starts with a letter or a mark. Letters are read by the\n * runtime's Unicode tables: a letter added in a later Unicode version than a\n * server's is not one to that server.\n */\nexport function textDirectionOf(text: string): 'ltr' | 'rtl' | undefined {\n for (const character of text) {\n if (character === LEFT_TO_RIGHT_MARK) {\n return 'ltr';\n }\n if (RIGHT_TO_LEFT_MARKS.has(character)) {\n return 'rtl';\n }\n if (LETTER_RE.test(character)) {\n return within(character.codePointAt(0) as number, RTL_BLOCKS) ? 'rtl' : 'ltr';\n }\n }\n return undefined;\n}\n\n/**\n * The direction a single character is laid out in, for a mark standing in for\n * it: a digit runs left to right unless it is one of the right-to-left digits,\n * a letter runs in its script's direction, and anything else has none of its\n * own.\n */\nexport function characterDirectionOf(character: string): 'ltr' | 'rtl' | undefined {\n const point = character.codePointAt(0) as number;\n if (NUMBER_RE.test(character)) {\n return within(point, RTL_DIGITS) ? 'rtl' : 'ltr';\n }\n if (LETTER_RE.test(character)) {\n return within(point, RTL_BLOCKS) ? 'rtl' : 'ltr';\n }\n return undefined;\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
// src/components/shared/FeedbackRegion.tsx
|
|
5
|
+
function FeedbackRegion({ id, className, children }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", { id, className, "aria-live": "polite", "aria-atomic": "true", children });
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { FeedbackRegion };
|
|
10
|
+
//# sourceMappingURL=chunk-RCMYEWBE.js.map
|
|
11
|
+
//# sourceMappingURL=chunk-RCMYEWBE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/shared/FeedbackRegion.tsx"],"names":[],"mappings":";;;AAcO,SAAS,cAAA,CAAe,EAAE,EAAA,EAAI,SAAA,EAAW,UAAS,EAAwB;AAC/E,EAAA,uBACE,GAAA,CAAC,SAAI,EAAA,EAAQ,SAAA,EAAsB,aAAU,QAAA,EAAS,aAAA,EAAY,QAC/D,QAAA,EACH,CAAA;AAEJ","file":"chunk-RCMYEWBE.js","sourcesContent":["import type { ReactNode } from 'react';\n\nexport interface FeedbackRegionProps {\n /** Identifier so activity inputs can reference this region via aria. */\n id?: string;\n className?: string;\n children?: ReactNode;\n}\n\n/**\n * A polite ARIA live region. Screen readers announce content injected here\n * (score, feedback, state changes) without moving focus. Pure/presentational\n * — safe to render in any environment.\n */\nexport function FeedbackRegion({ id, className, children }: FeedbackRegionProps) {\n return (\n <div id={id} className={className} aria-live=\"polite\" aria-atomic=\"true\">\n {children}\n </div>\n );\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var chunkB2XQLU2E_cjs = require('./chunk-B2XQLU2E.cjs');
|
|
5
|
+
var chunkLB3FEV7Z_cjs = require('./chunk-LB3FEV7Z.cjs');
|
|
6
6
|
var react = require('react');
|
|
7
7
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
8
|
|
|
@@ -19,7 +19,7 @@ function StimulusPanel({
|
|
|
19
19
|
strings
|
|
20
20
|
}) {
|
|
21
21
|
const titleId = react.useId();
|
|
22
|
-
const s =
|
|
22
|
+
const s = chunkLB3FEV7Z_cjs.useLkStrings(strings);
|
|
23
23
|
const bodyHtml = react.useMemo(() => {
|
|
24
24
|
if (sanitizeHtml === void 0 || typeof stimulus.bodyHtml !== "string") {
|
|
25
25
|
return null;
|
|
@@ -33,7 +33,7 @@ function StimulusPanel({
|
|
|
33
33
|
stimulus.title !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-stimulus-title", id: titleId, ...contentLang, children: stimulus.title }) : null,
|
|
34
34
|
rangeText !== null ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "lk-stimulus-range", children: rangeText }) : null,
|
|
35
35
|
stimulus.media !== void 0 ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
36
|
-
|
|
36
|
+
chunkB2XQLU2E_cjs.ActivityMedia,
|
|
37
37
|
{
|
|
38
38
|
media: stimulus.media,
|
|
39
39
|
...renderMode !== void 0 ? { renderMode } : {},
|
|
@@ -59,5 +59,5 @@ function StimulusPanel({
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
exports.StimulusPanel = StimulusPanel;
|
|
62
|
-
//# sourceMappingURL=chunk-
|
|
63
|
-
//# sourceMappingURL=chunk-
|
|
62
|
+
//# sourceMappingURL=chunk-RRH7ZPXC.cjs.map
|
|
63
|
+
//# sourceMappingURL=chunk-RRH7ZPXC.cjs.map
|
|
@@ -1 +1 @@
|
|
|
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AI,SAAA,EAAU,kBAAA,EAAmB,aAAA,EAAY,MAAA,EAAQ,GAAG,WAAA,EACtD,QAAA,EAAA,QAAA,CAAS,MACZ,CAAA,GACE,IAAA;AAAA,IACH,QAAA,CAAS,WAAA,KAAgB,MAAA,mBACxBA,cAAA,CAAC,OAAE,SAAA,EAAU,yBAAA,EAA2B,GAAG,WAAA,EACzC,QAAA,kBAAAA,cAAA,CAAC,MAAA,EAAA,EAAM,QAAA,EAAA,QAAA,CAAS,WAAA,EAAY,GAC9B,CAAA,GACE;AAAA,GAAA,EACN,CAAA;AAEJ","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../src/components/StimulusPanel/StimulusPanel.tsx"],"names":["useId","useLkStrings","useMemo","jsxs","jsx","ActivityMedia"],"mappings":";;;;;;;AAsDO,SAAS,aAAA,CAAc;AAAA,EAC5B,QAAA;AAAA,EACA,KAAA;AAAA,EACA,YAAA;AAAA,EACA,MAAA;AAAA,EACA,UAAA;AAAA,EACA,WAAA;AAAA,EACA,YAAA;AAAA,EACA,aAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAA,EAA0C;AACxC,EAAA,MAAM,UAAUA,WAAA,EAAM;AACtB,EAAA,MAAM,CAAA,GAAIC,+BAAa,OAAO,CAAA;AAE9B,EAAA,MAAM,QAAA,GAAWC,cAAQ,MAAM;AAC7B,IAAA,IAAI,YAAA,KAAiB,MAAA,IAAa,OAAO,QAAA,CAAS,aAAa,QAAA,EAAU;AACvE,MAAA,OAAO,IAAA;AAAA,IACT;AACA,IAAA,OAAO,YAAA,CAAa,SAAS,QAAQ,CAAA;AAAA,EACvC,CAAA,EAAG,CAAC,QAAA,CAAS,QAAA,EAAU,YAAY,CAAC,CAAA;AAEpC,EAAA,MAAM,SAAA,GAAY,UAAU,MAAA,GAAY,IAAA,GAAO,EAAE,aAAA,CAAc,KAAA,CAAM,KAAA,EAAO,KAAA,CAAM,IAAI,CAAA;AAEtF,EAAA,MAAM,MAAA,GACJ,QAAA,CA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a,EAAC;AAAA,QAC7C,GAAI,MAAA,KAAW,MAAA,GAAY,EAAE,MAAA,KAAW;AAAC;AAAA,KAC5C,GACE,IAAA;AAAA,IACH,aAAa,IAAA,mBACZD,cAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAU,kBAAA;AAAA,QACV,aAAA,EAAY,MAAA;AAAA,QACX,GAAG,WAAA;AAAA,QAEJ,uBAAA,EAAyB,EAAE,MAAA,EAAQ,QAAA;AAAS;AAAA,KAC9C,GACE,QAAA,CAAS,IAAA,KAAS,MAAA,kCACnB,KAAA,EAAA,EAAI,SAAA,EAAU,kBAAA,EAAmB,aAAA,EAAY,MAAA,EAAQ,GAAG,WAAA,EACtD,QAAA,EAAA,QAAA,CAAS,MACZ,CAAA,GACE,IAAA;AAAA,IACH,QAAA,CAAS,WAAA,KAAgB,MAAA,mBACxBA,cAAA,CAAC,OAAE,SAAA,EAAU,yBAAA,EAA2B,GAAG,WAAA,EACzC,QAAA,kBAAAA,cAAA,CAAC,MAAA,EAAA,EAAM,QAAA,EAAA,QAAA,CAAS,WAAA,EAAY,GAC9B,CAAA,GACE;AAAA,GAAA,EACN,CAAA;AAEJ","file":"chunk-RRH7ZPXC.cjs","sourcesContent":["'use client';\n\nimport type { InteractionEvent, Stimulus } from '@intellectif/lk-core';\nimport { useId, useMemo } from 'react';\nimport { useLkStrings } from '../../i18n/LkIntlProvider.js';\nimport type { LkStringsOverride } from '../../i18n/strings.js';\nimport { ActivityMedia } from '../shared/ActivityMedia.js';\nimport type {\n HtmlSanitizer,\n MediaBudgetBinding,\n MediaTransportStrings,\n RenderMode,\n} from '../types.js';\n\nexport interface StimulusPanelProps {\n stimulus: Stimulus;\n /**\n * 1-based presented positions of the first and last question this material\n * serves, rendered as \"Questions 3–8\" so a learner knows how far the\n * passage carries.\n */\n range?: { first: number; last: number };\n /** Renders `stimulus.bodyHtml` when provided. See `HtmlSanitizer`. */\n sanitizeHtml?: HtmlSanitizer;\n locale?: string;\n /**\n * Forwarded to the stimulus's own media. `review` keeps the browser's control\n * bar even under an enforcing policy — a graded paper cannot be changed by\n * listening again.\n */\n renderMode?: RenderMode;\n /**\n * Binds this group's recording to a play budget the consumer persists. One\n * recording serves every question in the group, so the key is derived from\n * the ENTRY rather than the slot — see `stimulusMediaKey()` in lk-core.\n */\n mediaBudget?: MediaBudgetBinding;\n /** Translations for the audio transport chrome. */\n mediaStrings?: Partial<MediaTransportStrings>;\n onInteraction?: (event: InteractionEvent) => void;\n disabled?: boolean;\n /** Overrides the SDK's chrome text for this panel. See {@link LkIntlProvider}. */\n strings?: LkStringsOverride;\n}\n\n/**\n * Presents a shared stimulus — the passage, recording or image an item group's\n * questions refer to. A landmark region named by its title (or by its kind),\n * so a screen-reader user can jump back to the material from any question.\n *\n * Rich text follows the SDK-wide rule: `bodyHtml` is rendered only through a\n * caller-supplied sanitiser, and the plain `body` is the fallback — which the\n * schema guarantees exists whenever `bodyHtml` does.\n */\nexport function StimulusPanel({\n stimulus,\n range,\n sanitizeHtml,\n locale,\n renderMode,\n mediaBudget,\n mediaStrings,\n onInteraction,\n disabled,\n strings,\n}: StimulusPanelProps): React.JSX.Element {\n const titleId = useId();\n const s = useLkStrings(strings);\n\n const bodyHtml = useMemo(() => {\n if (sanitizeHtml === undefined || typeof stimulus.bodyHtml !== 'string') {\n return null;\n }\n return sanitizeHtml(stimulus.bodyHtml);\n }, [stimulus.bodyHtml, sanitizeHtml]);\n\n const rangeText = range === undefined ? null : s.stimulusRange(range.first, range.last);\n\n const naming =\n stimulus.title !== undefined\n ? { 'aria-labelledby': titleId }\n : { 'aria-label': s.stimulusKind[stimulus.kind] };\n\n // The AUTHORED parts carry the stimulus language; the SDK's own chrome does\n // not. Declaring `stimulus.locale` on the whole region made a screen reader\n // read \"Recording\" and \"Questions 3–5\" — English strings this package ships\n // — in the passage's voice, so a Spanish listening panel announced its own\n // name and the only orientation text in it with Spanish phonetics\n // (WCAG 3.1.2 Language of Parts). Scope the declaration to the content it\n // actually describes.\n const contentLang = stimulus.locale !== undefined ? { lang: stimulus.locale } : {};\n\n return (\n <section className=\"lk-stimulus\" data-kind={stimulus.kind} lang={locale} {...naming}>\n {stimulus.title !== undefined ? (\n <p className=\"lk-stimulus-title\" id={titleId} {...contentLang}>\n {stimulus.title}\n </p>\n ) : null}\n {rangeText !== null ? <p className=\"lk-stimulus-range\">{rangeText}</p> : null}\n {stimulus.media !== undefined ? (\n <ActivityMedia\n media={stimulus.media}\n {...(renderMode !== undefined ? { renderMode } : {})}\n {...(mediaBudget !== undefined ? { mediaBudget } : {})}\n {...(mediaStrings !== undefined ? { mediaStrings } : {})}\n {...(strings !== undefined ? { strings } : {})}\n {...(onInteraction !== undefined ? { onInteraction } : {})}\n {...(disabled !== undefined ? { disabled } : {})}\n {...(locale !== undefined ? { locale } : {})}\n />\n ) : null}\n {bodyHtml !== null ? (\n <div\n className=\"lk-stimulus-body\"\n data-format=\"html\"\n {...contentLang}\n // biome-ignore lint/security/noDangerouslySetInnerHtml: rendered only through the caller-supplied HtmlSanitizer — the SDK never injects unsanitised markup\n dangerouslySetInnerHTML={{ __html: bodyHtml }}\n />\n ) : stimulus.body !== undefined ? (\n <div className=\"lk-stimulus-body\" data-format=\"text\" {...contentLang}>\n {stimulus.body}\n </div>\n ) : null}\n {stimulus.attribution !== undefined ? (\n <p className=\"lk-stimulus-attribution\" {...contentLang}>\n <cite>{stimulus.attribution}</cite>\n </p>\n ) : null}\n </section>\n );\n}\n"]}
|
|
@@ -116,5 +116,5 @@ function useTheme() {
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
export { ThemeProvider, createTailwindTheme, darkTheme, defaultTheme, useTheme };
|
|
119
|
-
//# sourceMappingURL=chunk-
|
|
120
|
-
//# sourceMappingURL=chunk-
|
|
119
|
+
//# sourceMappingURL=chunk-RXS455MR.js.map
|
|
120
|
+
//# sourceMappingURL=chunk-RXS455MR.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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AAA,EAAO,WAAA,EAA+B,QAAA,EAAS,CAAA,EACtD,CAAA;AAEJ;AAGO,SAAS,QAAA,GAAwB;AACtC,EAAA,OAAO,WAAW,YAAY,CAAA;AAChC","file":"chunk-RXS455MR.js","sourcesContent":["import type { ThemeTokens } from '@intellectif/lk-core';\n\n/**\n * Dark-mode colour overrides, merged over {@link defaultTheme} by\n * `ThemeProvider`. Colours only — spacing/typography/shape/motion are\n * theme-invariant. All pairs verified WCAG 2.2 AA against the dark surface.\n */\nexport const darkTheme: Partial<ThemeTokens> = {\n '--lk-color-primary': '#fafafa',\n '--lk-color-primary-hover': '#e4e4e7',\n '--lk-color-surface': '#09090b',\n '--lk-color-surface-raised': '#18181b',\n '--lk-color-border': '#27272a',\n '--lk-color-text': '#fafafa',\n '--lk-color-text-muted': '#a1a1aa',\n '--lk-color-success': '#4ade80',\n '--lk-color-error': '#f87171',\n '--lk-color-warning': '#fbbf24',\n '--lk-color-focus-ring': '#fafafa',\n};\n","import type { ThemeTokens } from '@intellectif/lk-core';\n\n/**\n * Canonical default theme token values. `defaults.css` mirrors these exactly.\n * Palette is a neutral monochrome, deliberately unbranded, so the SDK carries\n * nobody's look out of the box; consumers rebrand via `ThemeProvider`. All\n * colour pairs are verified to meet WCAG 2.2 AA: 4.5:1 for normal text, 3:1 for\n * UI / focus ring (see theme/__tests__/contrast.test.ts).\n */\nexport const defaultTheme: ThemeTokens = {\n // ── Colours (light) — neutral monochrome; semantic success/error/warning\n // retained for status legibility ────────────────────────────────────────\n '--lk-color-primary': '#18181b',\n '--lk-color-primary-hover': '#27272a',\n '--lk-color-surface': '#ffffff',\n '--lk-color-surface-raised': '#fafafa',\n '--lk-color-border': '#e4e4e7',\n '--lk-color-text': '#18181b',\n '--lk-color-text-muted': '#52525b',\n '--lk-color-success': '#15803d',\n '--lk-color-error': '#b91c1c',\n '--lk-color-warning': '#b45309',\n '--lk-color-focus-ring': '#18181b',\n\n // ── Spacing ──────────────────────────────────────────────────────────────\n '--lk-spacing-xs': '4px',\n '--lk-spacing-sm': '8px',\n '--lk-spacing-md': '16px',\n '--lk-spacing-lg': '24px',\n '--lk-spacing-xl': '32px',\n\n // ── Typography ───────────────────────────────────────────────────────────\n '--lk-font-family-base':\n 'system-ui, -apple-system, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif',\n '--lk-font-size-sm': '0.875rem',\n '--lk-font-size-base': '1rem',\n '--lk-font-size-lg': '1.125rem',\n '--lk-font-weight-normal': '400',\n '--lk-font-weight-bold': '700',\n '--lk-line-height-base': '1.5',\n\n // ── Shape ────────────────────────────────────────────────────────────────\n '--lk-radius-sm': '0.25rem',\n '--lk-radius-base': '0.5rem',\n '--lk-radius-lg': '0.75rem',\n\n // ── Motion ───────────────────────────────────────────────────────────────\n '--lk-transition-fast': '150ms ease',\n '--lk-transition-base': '250ms ease',\n};\n","import type { ThemeTokens } from '@intellectif/lk-core';\nimport { defaultTheme } from './tokens.js';\n\n/**\n * Shape consumed by a Tailwind config's `theme.extend`. Every entry is a\n * `var(--lk-token, <fallback>)` reference: the var keeps utilities live\n * (ThemeProvider / dark-mode override at runtime); the fallback makes them\n * work with zero setup (no provider, no `defaults.css` import).\n */\nexport interface TailwindThemeExtension {\n colors: Record<string, string>;\n spacing: Record<string, string>;\n borderRadius: Record<string, string>;\n fontFamily: Record<string, string>;\n fontSize: Record<string, string>;\n}\n\n/**\n * Token-prefix → Tailwind bucket. `--lk-font-weight-*`, `--lk-line-height-*`\n * and `--lk-transition-*` are intentionally absent: the first two have no\n * matching `theme.extend` group here, and the transition tokens hold a\n * `<duration> <easing>` shorthand that would emit invalid\n * `transition-duration: 150ms ease` if mapped to Tailwind's `transitionDuration`.\n */\nconst BUCKETS = [\n ['--lk-color-', 'colors'],\n ['--lk-spacing-', 'spacing'],\n ['--lk-radius-', 'borderRadius'],\n ['--lk-font-family-', 'fontFamily'],\n ['--lk-font-size-', 'fontSize'],\n] as const;\n\n/**\n * Converts SDK theme tokens into a Tailwind `theme.extend` object so Tailwind\n * projects consume the same `--lk-*` tokens as the components — one shared\n * source of truth rather than a parallel, conflicting palette.\n */\nexport function createTailwindTheme(theme: Partial<ThemeTokens>): TailwindThemeExtension {\n const merged: Record<string, string> = { ...defaultTheme, ...theme };\n const extension: TailwindThemeExtension = {\n colors: {},\n spacing: {},\n borderRadius: {},\n fontFamily: {},\n fontSize: {},\n };\n\n for (const [tokenName, fallback] of Object.entries(merged)) {\n for (const [prefix, bucket] of BUCKETS) {\n if (tokenName.startsWith(prefix)) {\n extension[bucket][`lk-${tokenName.slice(prefix.length)}`] =\n `var(${tokenName}, ${fallback})`;\n break;\n }\n }\n }\n\n return extension;\n}\n","'use client';\n\nimport type { ThemeTokens } from '@intellectif/lk-core';\nimport {\n type CSSProperties,\n createContext,\n type ReactNode,\n useContext,\n useMemo,\n useSyncExternalStore,\n} from 'react';\nimport { darkTheme } from './dark-theme.js';\nimport { defaultTheme } from './tokens.js';\n\nexport { darkTheme } from './dark-theme.js';\nexport { createTailwindTheme, type TailwindThemeExtension } from './tailwind.js';\nexport { defaultTheme } from './tokens.js';\n\nconst ThemeContext = createContext<ThemeTokens>(defaultTheme);\n\nconst DARK_QUERY = '(prefers-color-scheme: dark)';\n\n/** Subscribe to OS dark-mode changes; no-op when there is no `window`. */\nfunction subscribePrefersDark(onChange: () => void): () => void {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {\n return () => {};\n }\n const mql = window.matchMedia(DARK_QUERY);\n mql.addEventListener('change', onChange);\n return () => mql.removeEventListener('change', onChange);\n}\n\n/** Current OS dark-mode preference; `false` when there is no `window`. */\nfunction getPrefersDark(): boolean {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') {\n return false;\n }\n return window.matchMedia(DARK_QUERY).matches;\n}\n\nexport interface ThemeProviderProps {\n /** Partial token overrides. When provided, dark auto-detection is disabled. */\n theme?: Partial<ThemeTokens>;\n children: ReactNode;\n}\n\n/**\n * Provides theme tokens to descendant activity components as scoped inline CSS\n * custom properties on a wrapper `<div>`, and via {@link useTheme}.\n *\n * Resolution: an explicit `theme` prop merges over {@link defaultTheme} (and\n * suppresses dark auto-detect, per Req 13.5). With no `theme` prop, the OS\n * `prefers-color-scheme: dark` preference auto-applies {@link darkTheme}.\n * SSR-safe: the server snapshot is always light, so hydration never mismatches.\n */\nexport function ThemeProvider({ theme, children }: ThemeProviderProps) {\n const prefersDark = useSyncExternalStore(subscribePrefersDark, getPrefersDark, () => false);\n\n const activeTheme = useMemo<ThemeTokens>(() => {\n if (theme !== undefined) {\n return { ...defaultTheme, ...theme };\n }\n return prefersDark ? { ...defaultTheme, ...darkTheme } : defaultTheme;\n }, [theme, prefersDark]);\n\n return (\n <ThemeContext.Provider value={activeTheme}>\n <div style={activeTheme as CSSProperties}>{children}</div>\n </ThemeContext.Provider>\n );\n}\n\n/** Returns the currently active theme tokens (defaults when no provider). */\nexport function useTheme(): ThemeTokens {\n return useContext(ThemeContext);\n}\n"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkBRPEB43C_cjs = require('./chunk-BRPEB43C.cjs');
|
|
5
|
+
var chunkUSBANZ7K_cjs = require('./chunk-USBANZ7K.cjs');
|
|
6
|
+
var chunkB2XQLU2E_cjs = require('./chunk-B2XQLU2E.cjs');
|
|
5
7
|
var chunkXOR4MPEN_cjs = require('./chunk-XOR4MPEN.cjs');
|
|
6
|
-
var
|
|
7
|
-
var chunkKYOCDRUO_cjs = require('./chunk-KYOCDRUO.cjs');
|
|
8
|
+
var chunkLB3FEV7Z_cjs = require('./chunk-LB3FEV7Z.cjs');
|
|
8
9
|
var lkCore = require('@intellectif/lk-core');
|
|
9
10
|
var react = require('react');
|
|
10
11
|
var jsxRuntime = require('react/jsx-runtime');
|
|
@@ -66,9 +67,9 @@ function FillInTheBlanks({
|
|
|
66
67
|
}) {
|
|
67
68
|
const isExam = renderMode === "exam";
|
|
68
69
|
const isReview = renderMode === "review";
|
|
69
|
-
const s =
|
|
70
|
+
const s = chunkLB3FEV7Z_cjs.useLkStrings(strings);
|
|
70
71
|
const devError = react.useMemo(() => {
|
|
71
|
-
if (!
|
|
72
|
+
if (!chunkUSBANZ7K_cjs.isDevelopment()) {
|
|
72
73
|
return null;
|
|
73
74
|
}
|
|
74
75
|
if (data.redacted === true) {
|
|
@@ -116,7 +117,7 @@ function FillInTheBlanks({
|
|
|
116
117
|
reset(defaultSubmittedRef.current === true ? "completed" : "idle");
|
|
117
118
|
}, [data, reset]);
|
|
118
119
|
react.useEffect(() => {
|
|
119
|
-
if (
|
|
120
|
+
if (chunkUSBANZ7K_cjs.isDevelopment() && sanitizeHtml !== void 0 && data.passageHtml !== void 0) {
|
|
120
121
|
console.warn(
|
|
121
122
|
"[lk-react] FillInTheBlanks ignores `passageHtml`: the passage hosts the answer inputs, so rich HTML cannot be split at {{placeholders}} without voiding the sanitiser. Rendering the plain `passage` instead."
|
|
122
123
|
);
|
|
@@ -189,9 +190,9 @@ function FillInTheBlanks({
|
|
|
189
190
|
complete();
|
|
190
191
|
const timeSpent = getTimeSpent();
|
|
191
192
|
const xapiStatement = lkCore.xAPIBuilder.buildAnsweredStatement({
|
|
192
|
-
actor:
|
|
193
|
+
actor: chunkUSBANZ7K_cjs.ANONYMOUS_ACTOR,
|
|
193
194
|
object: {
|
|
194
|
-
id:
|
|
195
|
+
id: chunkUSBANZ7K_cjs.objectIdFor(data.id),
|
|
195
196
|
name: { [data.locale ?? "en-US"]: data.title },
|
|
196
197
|
...lkCore.xapiDefinitionFor(data)
|
|
197
198
|
},
|
|
@@ -252,7 +253,7 @@ function FillInTheBlanks({
|
|
|
252
253
|
onSubmit: handleSubmit,
|
|
253
254
|
children: [
|
|
254
255
|
data.media ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
255
|
-
|
|
256
|
+
chunkB2XQLU2E_cjs.ActivityMedia,
|
|
256
257
|
{
|
|
257
258
|
media: data.media,
|
|
258
259
|
renderMode,
|
|
@@ -350,16 +351,16 @@ function FillInTheBlanks({
|
|
|
350
351
|
children: feedbackHidden ? s.showFeedback : s.hideFeedback
|
|
351
352
|
}
|
|
352
353
|
) : null,
|
|
353
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
354
|
+
/* @__PURE__ */ jsxRuntime.jsx(chunkBRPEB43C_cjs.FeedbackRegion, { id: `${data.id}-feedback`, children: isReview ? reviewSummary : summary })
|
|
354
355
|
]
|
|
355
356
|
}
|
|
356
357
|
);
|
|
357
358
|
}
|
|
358
359
|
function FillInTheBlanks2(props) {
|
|
359
|
-
const strings =
|
|
360
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
360
|
+
const strings = chunkLB3FEV7Z_cjs.useLkStrings(props.strings);
|
|
361
|
+
return /* @__PURE__ */ jsxRuntime.jsx(chunkUSBANZ7K_cjs.ActivityErrorBoundary, { activityTitle: props.data?.title, strings, children: /* @__PURE__ */ jsxRuntime.jsx(FillInTheBlanks, { ...props }) });
|
|
361
362
|
}
|
|
362
363
|
|
|
363
364
|
exports.FillInTheBlanks = FillInTheBlanks2;
|
|
364
|
-
//# sourceMappingURL=chunk-
|
|
365
|
-
//# sourceMappingURL=chunk-
|
|
365
|
+
//# sourceMappingURL=chunk-SE6WWDVW.cjs.map
|
|
366
|
+
//# sourceMappingURL=chunk-SE6WWDVW.cjs.map
|