@pie-qti/qti-common 0.1.25 → 0.1.27

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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apip.js","sourceRoot":"","sources":["../../src/accessibility/apip.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAoB,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC/E,OAAO,EAGN,YAAY,EAIZ,SAAS,GAET,MAAM,cAAc,CAAC;AAEtB,MAAM,CAAC,MAAM,cAAc,GAAG,4DAA4D,CAAC;AAC3F,MAAM,CAAC,MAAM,cAAc,GAAG,qCAAqC,CAAC;AAkCpE,MAAM,MAAM,GAAG,QAAQ,CAAC;AACxB,MAAM,aAAa,GAAG,eAAe,CAAC;AACtC,MAAM,iBAAiB,GAAG,yCAAyC,CAAC;AACpE,MAAM,WAAW,GAAG,wBAAwB,CAAC;AAC7C,MAAM,oBAAoB,GAAG,iCAAiC,CAAC;AAC/D,+FAA+F;AAC/F,MAAM,mBAAmB,GAA2B;IACnD,WAAW,EAAE,KAAK;IAClB,qBAAqB,EAAE,QAAQ;CAC/B,CAAC;AACF,gEAAgE;AAChE,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC;IAClC,GAAG;IACH,GAAG;IACH,QAAQ;IACR,SAAS;IACT,KAAK;IACL,OAAO;IACP,UAAU;IACV,OAAO;IACP,SAAS;IACT,MAAM;IACN,OAAO;CACP,CAAC,CAAC;AACH,MAAM,UAAU,GAA2B;IAC1C,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,YAAY;IACjB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,aAAa;IAClB,GAAG,EAAE,iBAAiB;IACtB,GAAG,EAAE,W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IAAI,IAAI,EAAE,CAAC;AACpD,CAAC;AAED,8EAA8E;AAC9E,SAAS;AACT,8EAA8E;AAE9E,SAAS,UAAU,CAAC,IAAY;IAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAChF,CAAC;AAED,SAAS,eAAe,CAAC,KAAa;IACrC,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAClD,CAAC;AAED,SAAS,aAAa,CAAC,MAAmB,EAAE,IAAY;IACvD,OAAO,gBAAgB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAmB;IAC5C,OAAO,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,KAAK,EAAwB,EAAE,CAAC,KAAK,CAAC,QAAQ,KAAK,QAAQ,CAAC,YAAY,CAAC,CAAC;AAC5G,CAAC;AAED,SAAS,UAAU,CAAC,MAAmB,EAAE,IAAY;IACpD,OAAO,aAAa,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACvC,CAAC;AAED,SAAS,SAAS,CAAC,OAAoB;IACtC,MAAM,GAAG,GAAG,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;IACrC,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AACxC,CAAC","sourcesContent":["/**\n * APIP accessibility\n *\n * QTI 2.x carries accessibility content as APIP 1.0: an `apip:apipAccessibility` element whose\n * `accessElement`s each link content elements, by `id`, to the supports that describe them. A\n * catalog is the same thing in QTI 3's terms, so an access element maps to one catalog by its\n * `identifier`, its supports to cards under the support names QTI 3 uses, as 1EdTech's\n * APIP-to-QTI 3 migration guide maps them:\n *\n * - `spoken`: one script card, the first of `textToSpeechPronunciationSSML` (as `<speak>`),\n * `textToSpeechPronunciation` and `spokenText`, the others kept as `ext:custom-` cards, and a\n * card per `audioFileInfo` recording, its `startTime` and `duration` the time range;\n * - `brailleText` as `braille`, `tactileFile` as `tactile`;\n * - `signing` as `sign-language` video, `ase` for ASL and `eng-US` for Signed English, with the\n * cues as the time range;\n * - `keyWordTranslation` as `keyword-translation`, one card per language;\n * - `guidance`'s `languageLearnerSupport` as `linguistic-guidance`.\n *\n * QTI 3 has no counterpart for the other supports, which the reader reports as unmapped;\n * `voiceType`, `voiceSpeed` and `supportOrder` are dropped, the last because document order is the\n * order.\n *\n * The writer maps the other way. A card APIP has no element for, a card past the one an element\n * holds, and a card missing what its element requires (a `tactile` recording without its text, an\n * audio file whose MIME type is unknown) are unwritten, and the result names their supports.\n * SSML elements APIP does not admit are unwrapped to their content. Plain-text APIP elements take\n * the card's text, its markup dropped.\n */\n\nimport { type HTMLElement, NodeType, parse, TextNode } from 'node-html-parser';\nimport {\n\ttype CatalogCard,\n\ttype CatalogCardPayload,\n\tclockSeconds,\n\ttype MediaFragmentRange,\n\ttype MediaKind,\n\ttype MediaSource,\n\tmediaKind,\n\ttype TextRange,\n} from './catalog.js';\n\nexport const APIP_NAMESPACE = 'http://www.imsglobal.org/xsd/apip/apipv1p0/imsapip_qtiv1p0';\nexport const SSML_NAMESPACE = 'http://www.w3.org/2001/10/synthesis';\n\n/** An APIP link from an access element to the content it describes. */\nexport interface ApipContentLink {\n\t/** The `id` of the content element, from `qtiLinkIdentifierRef`; empty when it names none. */\n\ttarget: string;\n\t/** The word or character range of the element's text, when the link has one. */\n\trange?: TextRange;\n\t/** The link names the element as an object (`objectLink`): an image, a media player. */\n\tobject?: boolean;\n}\n\nexport interface ApipAccessElement {\n\tidentifier: string;\n\tlinks: ApipContentLink[];\n\tcards: CatalogCard[];\n\t/** The supports QTI 3 has no counterpart for, by element name. */\n\tunmapped: string[];\n}\n\nexport type ApipAccessElementSource = Pick<ApipAccessElement, 'identifier' | 'links' | 'cards'>;\n\nexport interface ApipAccessibilityXml {\n\t/** The `apip:apipAccessibility` element, its namespaces declared on it; absent when nothing is written. */\n\txml?: string;\n\t/** The supports of the cards not written, by access element identifier. */\n\tunwritten: Map<string, string[]>;\n}\n\nexport interface ApipWriteOptions {\n\t/** The `id`s the document uses already, which the access elements and labels must not take. */\n\treservedIds?: Iterable<string>;\n}\n\nconst SPOKEN = 'spoken';\nconst SIGN_LANGUAGE = 'sign-language';\nconst TTS_PRONUNCIATION = 'ext:custom-text-to-speech-pronunciation';\nconst SPOKEN_TEXT = 'ext:custom-spoken-text';\nconst TACTILE_BRAILLE_TEXT = 'ext:custom-tactile-braille-text';\n/** The sign language a `signing` file is in: ASL, and Signed English as the guide codes it. */\nconst SIGN_FILE_LANGUAGES: Record<string, string> = {\n\tsignFileASL: 'ase',\n\tsignFileSignedEnglish: 'eng-US',\n};\n/** The SSML elements `textToSpeechPronunciationSSML` admits. */\nconst APIP_SSML_ELEMENTS = new Set([\n\t'p',\n\t's',\n\t'say-as',\n\t'phoneme',\n\t'sub',\n\t'voice',\n\t'emphasis',\n\t'break',\n\t'prosody',\n\t'mark',\n\t'audio',\n]);\nconst MIME_TYPES: Record<string, string> = {\n\taac: 'audio/aac',\n\tm4a: 'audio/mp4',\n\tmp3: 'audio/mpeg',\n\toga: 'audio/ogg',\n\togg: 'audio/ogg',\n\twav: 'audio/wav',\n\tm4v: 'video/x-m4v',\n\tmov: 'video/quicktime',\n\tmp4: 'video/mp4',\n\togv: 'video/ogg',\n\twebm: 'video/webm',\n};\nconst APIP_SUPPORTS: Record<string, (support: HTMLElement) => ApipSupport> = {\n\tspoken: spokenSupport,\n\tbrailleText: (support) => ({ cards: textCards('braille', textOf(support, 'brailleTextString')) }),\n\ttactileFile: (support) => {\n\t\tconst audio = firstChild(support, 'tactileAudioFile');\n\t\tconst payload = audio && audioPayload(audio);\n\t\treturn {\n\t\t\tcards: [\n\t\t\t\t...textCards('tactile', textOf(support, 'tactileAudioText')),\n\t\t\t\t...(payload ? [{ catalog: 'tactile', payload }] : []),\n\t\t\t\t...textCards(TACTILE_BRAILLE_TEXT, textOf(support, 'tactileBrailleText')),\n\t\t\t],\n\t\t};\n\t},\n\tsigning: (support) => {\n\t\tconst cards: CatalogCard[] = [];\n\t\tconst unmapped: string[] = [];\n\t\tfor (const signFile of allChildElements(support)) {\n\t\t\tconst language = SIGN_FILE_LANGUAGES[localName(signFile)];\n\t\t\tconst video = firstChild(signFile, 'videoFileInfo');\n\t\t\tconst payload = language && video ? videoPayload(video) : undefined;\n\t\t\tif (payload) cards.push({ catalog: SIGN_LANGUAGE, language, payload });\n\t\t\tif (!language) unmapped.push(localName(signFile));\n\t\t\telse if (firstChild(signFile, 'boneAnimationVideoFile')) unmapped.push('boneAnimationVideoFile');\n\t\t}\n\t\treturn { cards, unmapped };\n\t},\n\tkeyWordTranslation: (support) => ({\n\t\tcards: childElements(support, 'definitionId').flatMap((definition) => {\n\t\t\tconst language = definition.getAttribute('xml:lang')?.trim();\n\t\t\treturn textCards('keyword-translation', textOf(definition, 'textString')).map((card) =>\n\t\t\t\tlanguage ? { ...card, language } : card\n\t\t\t);\n\t\t}),\n\t}),\n\tguidance: (support) => {\n\t\tconst learner = firstChild(support, 'languageLearnerSupport');\n\t\treturn {\n\t\t\tcards: learner ? textCards('linguistic-guidance', textOf(learner, 'textString')) : [],\n\t\t\tunmapped: firstChild(support, 'cognitiveGuidanceSupport') ? ['cognitiveGuidanceSupport'] : [],\n\t\t};\n\t},\n};\n\ninterface ApipSupport {\n\tcards: CatalogCard[];\n\tunmapped?: string[];\n}\n\n/**\n * The APIP access elements a QTI 2.x document declares, in document order. A string is parsed\n * with its CDATA sections unwrapped; a parsed root must keep tag names as authored.\n */\nexport function readApipAccessElements(source: string | HTMLElement): ApipAccessElement[] {\n\tconst root =\n\t\ttypeof source === 'string'\n\t\t\t? parse(source.replace(/<!\\[CDATA\\[([\\s\\S]*?)\\]\\]>/g, '$1'), {\n\t\t\t\t\tlowerCaseTagName: false,\n\t\t\t\t\tcomment: false,\n\t\t\t\t})\n\t\t\t: source;\n\treturn root\n\t\t.querySelectorAll('*')\n\t\t.filter((element) => localName(element) === 'accessElement')\n\t\t.map((element) => {\n\t\t\tconst cards: CatalogCard[] = [];\n\t\t\tconst unmapped: string[] = [];\n\t\t\tfor (const info of childElements(element, 'relatedElementInfo')) {\n\t\t\t\tfor (const support of allChildElements(info)) {\n\t\t\t\t\tconst read = APIP_SUPPORTS[localName(support)];\n\t\t\t\t\tif (!read) {\n\t\t\t\t\t\tunmapped.push(localName(support));\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tconst mapped = read(support);\n\t\t\t\t\tcards.push(...mapped.cards);\n\t\t\t\t\tunmapped.push(...(mapped.unmapped ?? []));\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tidentifier: element.getAttribute('identifier')?.trim() ?? '',\n\t\t\t\tlinks: childElements(element, 'contentLinkInfo').map(contentLink),\n\t\t\t\tcards,\n\t\t\t\tunmapped,\n\t\t\t};\n\t\t});\n}\n\n/** Write access elements as `apip:apipAccessibility`, for the end of an item or stimulus. */\nexport function writeApipAccessibility(\n\telements: ApipAccessElementSource[],\n\toptions: ApipWriteOptions = {}\n): ApipAccessibilityXml {\n\tconst ids = new IdAllocator(options.reservedIds);\n\tconst unwritten = new Map<string, string[]>();\n\tconst written: string[] = [];\n\tlet ssml = false;\n\tfor (const element of elements) {\n\t\tconst links = element.links.flatMap((link) => {\n\t\t\tconst xml = contentLinkXml(link);\n\t\t\treturn xml ? [xml] : [];\n\t\t});\n\t\tconst identifier = ids.take(ncName(element.identifier));\n\t\tconst label = () => ids.take(`${identifier}-${ids.next(identifier)}`);\n\t\tconst supports = links.length > 0 ? supportsXml(element.cards, label) : undefined;\n\t\tconst skipped = supports ? supports.unwritten : element.cards.map((card) => card.catalog);\n\t\tif (skipped.length > 0) unwritten.set(element.identifier, [...new Set(skipped)]);\n\t\tif (!supports || supports.xml.length === 0) continue;\n\t\tssml ||= supports.ssml;\n\t\twritten.push(\n\t\t\t`<apip:accessElement identifier=\"${escapeAttribute(identifier)}\">${links.join('')}` +\n\t\t\t\t`<apip:relatedElementInfo>${supports.xml.join('')}</apip:relatedElementInfo></apip:accessElement>`\n\t\t);\n\t}\n\tif (written.length === 0) return { unwritten };\n\tconst namespaces = `xmlns:apip=\"${APIP_NAMESPACE}\"${ssml ? ` xmlns:ssml=\"${SSML_NAMESPACE}\"` : ''}`;\n\treturn {\n\t\txml: `<apip:apipAccessibility ${namespaces}><apip:accessibilityInfo>${written.join('')}</apip:accessibilityInfo></apip:apipAccessibility>`,\n\t\tunwritten,\n\t};\n}\n\n// ---------------------------------------------------------------------------\n// Reading\n// ---------------------------------------------------------------------------\n\nfunction spokenSupport(spoken: HTMLElement): ApipSupport {\n\tconst ssml = firstChild(spoken, 'textToSpeechPronunciationSSML');\n\t// The first script present is the spoken card; the ones it outranks keep their own names.\n\tconst scripts = [\n\t\t[SPOKEN, ssml && speakMarkup(ssml)],\n\t\t[TTS_PRONUNCIATION, textOf(spoken, 'textToSpeechPronunciation')],\n\t\t[SPOKEN_TEXT, textOf(spoken, 'spokenText')],\n\t].filter((script): script is [string, string] => Boolean(script[1]));\n\tconst recordings = childElements(spoken, 'audioFileInfo').flatMap((audio) => {\n\t\tconst payload = audioPayload(audio);\n\t\treturn payload ? [{ catalog: SPOKEN, payload }] : [];\n\t});\n\treturn {\n\t\tcards: [\n\t\t\t...scripts.map(([catalog, content], index) => ({\n\t\t\t\tcatalog: index === 0 ? SPOKEN : catalog,\n\t\t\t\tcontent,\n\t\t\t})),\n\t\t\t...recordings,\n\t\t],\n\t};\n}\n\n/** `textToSpeechPronunciationSSML` as a `<speak>` document, its elements without prefixes. */\nfunction speakMarkup(ssml: HTMLElement): string | undefined {\n\tconst markup = ssml.innerHTML\n\t\t.replace(/<(\\/?)[\\w.-]+:/g, '<$1')\n\t\t.replace(/\\s+xmlns(?::[\\w.-]+)?\\s*=\\s*(?:\"[^\"]*\"|'[^']*')/g, '')\n\t\t.replace(/\\s+/g, ' ')\n\t\t.trim();\n\tif (!markup) return undefined;\n\treturn /^<speak[\\s>]/.test(markup) ? markup : `<speak>${markup}</speak>`;\n}\n\nfunction audioPayload(info: HTMLElement): CatalogCardPayload | undefined {\n\tconst start = timeOf(info, 'startTime');\n\tconst duration = timeOf(info, 'duration');\n\tconst startSeconds = start ?? 0;\n\treturn filePayload(\n\t\tinfo,\n\t\t'audio',\n\t\tstart === undefined && duration === undefined\n\t\t\t? undefined\n\t\t\t: {\n\t\t\t\t\tstartSeconds,\n\t\t\t\t\t...(duration === undefined ? {} : { endSeconds: milliseconds(startSeconds + duration) }),\n\t\t\t\t}\n\t);\n}\n\nfunction videoPayload(info: HTMLElement): CatalogCardPayload | undefined {\n\tconst start = timeOf(info, 'startCue');\n\tconst end = timeOf(info, 'endCue');\n\treturn filePayload(\n\t\tinfo,\n\t\t'video',\n\t\tstart === undefined && end === undefined\n\t\t\t? undefined\n\t\t\t: { startSeconds: start ?? 0, ...(end === undefined ? {} : { endSeconds: end }) }\n\t);\n}\n\nfunction filePayload(\n\tinfo: HTMLElement,\n\tfallback: MediaKind,\n\tfragment: MediaFragmentRange | undefined\n): CatalogCardPayload | undefined {\n\tconst src = firstChild(info, 'fileHref')?.textContent.trim();\n\tif (!src) return undefined;\n\tconst type = info.getAttribute('mimeType')?.trim();\n\treturn {\n\t\tmedia: {\n\t\t\tversion: 1,\n\t\t\tid: src,\n\t\t\tkind: mediaKind(type, src, fallback),\n\t\t\tsources: [{ src, ...(type ? { type } : {}) }],\n\t\t},\n\t\t...(fragment ? { fragment } : {}),\n\t};\n}\n\n/** An `xs:time` child as seconds; its time zone, which a media offset has no use for, ignored. */\nfunction timeOf(parent: HTMLElement, name: string): number | undefined {\n\tconst value = firstChild(parent, name)\n\t\t?.textContent.trim()\n\t\t.replace(/(?:Z|[+-]\\d{2}:\\d{2})$/, '');\n\treturn value ? clockSeconds(value) : undefined;\n}\n\nfunction milliseconds(value: number): number {\n\treturn Math.round(value * 1000) / 1000;\n}\n\nfunction contentLink(link: HTMLElement): ApipContentLink {\n\tconst target = link.getAttribute('qtiLinkIdentifierRef')?.trim() ?? '';\n\tconst textLink = firstChild(link, 'textLink');\n\tconst word = textLink && firstChild(textLink, 'wordLink');\n\tconst character = textLink && firstChild(textLink, 'characterLink');\n\tconst characters = textLink && firstChild(textLink, 'characterStringLink');\n\tlet range: TextRange | undefined;\n\tif (word) {\n\t\trange = { unit: 'word', start: count(word), stop: count(word) };\n\t} else if (character) {\n\t\trange = { unit: 'character', start: count(character), stop: count(character) };\n\t} else if (characters) {\n\t\trange = {\n\t\t\tunit: 'character',\n\t\t\tstart: count(firstChild(characters, 'startCharacter')),\n\t\t\tstop: count(firstChild(characters, 'stopCharacter')),\n\t\t};\n\t}\n\treturn {\n\t\ttarget,\n\t\t...(range ? { range } : {}),\n\t\t...(firstChild(link, 'objectLink') ? { object: true } : {}),\n\t};\n}\n\n/** A link's word or character number; not a number when absent, so it locates nothing. */\nfunction count(element: HTMLElement | undefined): number {\n\treturn Number(element?.textContent.trim() || Number.NaN);\n}\n\n/** A text child as card content: its text, escaped as HTML. */\nfunction textOf(parent: HTMLElement, name: string): string | undefined {\n\tconst text = firstChild(parent, name)?.textContent.trim();\n\treturn text ? escapeText(text) : undefined;\n}\n\nfunction textCards(catalog: string, content: string | undefined): CatalogCard[] {\n\treturn content ? [{ catalog, content }] : [];\n}\n\n// ---------------------------------------------------------------------------\n// Writing\n// ---------------------------------------------------------------------------\n\ninterface SupportsXml {\n\t/** The `relatedElementInfo` children, in the order the reader lists their cards. */\n\txml: string[];\n\tunwritten: string[];\n\tssml: boolean;\n}\n\n/** Hands out unique NCName `id`s. */\nclass IdAllocator {\n\tprivate readonly used: Set<string>;\n\tprivate readonly counters = new Map<string, number>();\n\n\tconstructor(reserved: Iterable<string> = []) {\n\t\tthis.used = new Set(reserved);\n\t}\n\n\ttake(base: string): string {\n\t\tlet id = base;\n\t\tfor (let suffix = 2; this.used.has(id); suffix += 1) id = `${base}-${suffix}`;\n\t\tthis.used.add(id);\n\t\treturn id;\n\t}\n\n\t/** The next number in `base`'s sequence, from 1. */\n\tnext(base: string): number {\n\t\tconst value = (this.counters.get(base) ?? 0) + 1;\n\t\tthis.counters.set(base, value);\n\t\treturn value;\n\t}\n}\n\nfunction supportsXml(cards: CatalogCard[], label: () => string): SupportsXml {\n\tconst unwritten: string[] = [];\n\tconst byCatalog = (...catalogs: string[]) => cards.filter((card) => catalogs.includes(card.catalog));\n\tconst handled = new Set([\n\t\tSPOKEN,\n\t\tTTS_PRONUNCIATION,\n\t\tSPOKEN_TEXT,\n\t\t'braille',\n\t\t'tactile',\n\t\tTACTILE_BRAILLE_TEXT,\n\t\tSIGN_LANGUAGE,\n\t\t'keyword-translation',\n\t\t'linguistic-guidance',\n\t]);\n\tunwritten.push(...cards.filter((card) => !handled.has(card.catalog)).map((card) => card.catalog));\n\n\tconst xml: string[] = [];\n\tconst spoken = spokenXml(byCatalog(SPOKEN, TTS_PRONUNCIATION, SPOKEN_TEXT), label);\n\tunwritten.push(...spoken.unwritten);\n\tif (spoken.xml) xml.push(spoken.xml);\n\n\tfor (const card of byCatalog('braille')) {\n\t\tconst text = card.content === undefined ? undefined : plainText(card.content);\n\t\tif (text) xml.push(`<apip:brailleText>${labelled('brailleTextString', label(), text)}</apip:brailleText>`);\n\t\telse unwritten.push(card.catalog);\n\t}\n\n\tconst tactile = tactileXml(byCatalog('tactile', TACTILE_BRAILLE_TEXT), label);\n\tunwritten.push(...tactile.unwritten);\n\tif (tactile.xml) xml.push(tactile.xml);\n\n\tconst signFiles: Record<string, string[]> = { signFileASL: [], signFileSignedEnglish: [] };\n\tfor (const card of byCatalog(SIGN_LANGUAGE)) {\n\t\tconst element = Object.keys(SIGN_FILE_LANGUAGES).find(\n\t\t\t(name) => SIGN_FILE_LANGUAGES[name]?.toLowerCase() === card.language?.toLowerCase()\n\t\t);\n\t\tconst video = element && card.payload ? fileInfoXml('videoFileInfo', card.payload, label) : undefined;\n\t\tif (element && video) signFiles[element]?.push(`<apip:${element}>${video}</apip:${element}>`);\n\t\telse unwritten.push(card.catalog);\n\t}\n\tconst signing = Object.values(signFiles).flat();\n\tif (signing.length > 0) xml.push(`<apip:signing>${signing.join('')}</apip:signing>`);\n\n\tconst definitions = byCatalog('keyword-translation').flatMap((card) => {\n\t\tconst text = card.content === undefined ? undefined : plainText(card.content);\n\t\tif (!text || !card.language) {\n\t\t\tunwritten.push(card.catalog);\n\t\t\treturn [];\n\t\t}\n\t\treturn [\n\t\t\t`<apip:definitionId xml:lang=\"${escapeAttribute(card.language)}\">${labelled('textString', label(), text)}</apip:definitionId>`,\n\t\t];\n\t});\n\tif (definitions.length > 0) xml.push(`<apip:keyWordTranslation>${definitions.join('')}</apip:keyWordTranslation>`);\n\n\tconst [guidance, ...extraGuidance] = byCatalog('linguistic-guidance');\n\tconst guidanceText = guidance?.content === undefined ? undefined : plainText(guidance.content);\n\tif (guidance && guidanceText) {\n\t\txml.push(\n\t\t\t`<apip:guidance><apip:languageLearnerSupport><apip:supportOrder>1</apip:supportOrder>${labelled('textString', label(), guidanceText)}</apip:languageLearnerSupport></apip:guidance>`\n\t\t);\n\t} else if (guidance) {\n\t\tunwritten.push(guidance.catalog);\n\t}\n\tunwritten.push(...extraGuidance.map((card) => card.catalog));\n\n\treturn { xml, unwritten, ssml: spoken.ssml };\n}\n\n/**\n * One `spoken`: its recordings, then its scripts. A `<speak>` card is the SSML script; the\n * `ext:custom-` cards take their own elements, and a plain-text `spoken` card the first of\n * `textToSpeechPronunciation` and `spokenText` they leave free.\n */\nfunction spokenXml(\n\tcards: CatalogCard[],\n\tlabel: () => string\n): { xml?: string; unwritten: string[]; ssml: boolean } {\n\tconst unwritten: string[] = [];\n\tconst audio: string[] = [];\n\tconst slots: { ssml?: string; tts?: string; text?: string } = {};\n\tconst plain: CatalogCard[] = [];\n\tfor (const card of cards) {\n\t\tif (card.payload) {\n\t\t\tconst info = card.catalog === SPOKEN ? fileInfoXml('audioFileInfo', card.payload, label) : undefined;\n\t\t\tif (info) audio.push(info);\n\t\t\telse unwritten.push(card.catalog);\n\t\t\tcontinue;\n\t\t}\n\t\tconst content = card.content ?? '';\n\t\tconst ssml = card.catalog === SPOKEN && !slots.ssml ? ssmlScript(content) : undefined;\n\t\tconst text = plainText(content);\n\t\tif (ssml) slots.ssml = ssml;\n\t\telse if (card.catalog === TTS_PRONUNCIATION && !slots.tts && text) slots.tts = text;\n\t\telse if (card.catalog === SPOKEN_TEXT && !slots.text && text) slots.text = text;\n\t\telse if (card.catalog === SPOKEN && text) plain.push(card);\n\t\telse unwritten.push(card.catalog);\n\t}\n\tfor (const card of plain) {\n\t\tconst text = plainText(card.content ?? '');\n\t\tif (!slots.tts) slots.tts = text;\n\t\telse if (!slots.text) slots.text = text;\n\t\telse unwritten.push(card.catalog);\n\t}\n\tconst scripts = [\n\t\tslots.text && labelled('spokenText', label(), slots.text),\n\t\tslots.tts && labelled('textToSpeechPronunciation', label(), slots.tts),\n\t\tslots.ssml &&\n\t\t\t`<apip:textToSpeechPronunciationSSML>${slots.ssml}</apip:textToSpeechPronunciationSSML>`,\n\t].filter(Boolean);\n\tif (audio.length === 0 && scripts.length === 0) return { unwritten, ssml: false };\n\treturn {\n\t\txml: `<apip:spoken>${audio.join('')}${scripts.join('')}</apip:spoken>`,\n\t\tunwritten,\n\t\tssml: Boolean(slots.ssml),\n\t};\n}\n\n/** One `tactileFile`: it needs the `tactile` text, so the cards beside it go unwritten without one. */\nfunction tactileXml(cards: CatalogCard[], label: () => string): { xml?: string; unwritten: string[] } {\n\tconst unwritten: string[] = [];\n\tlet text: string | undefined;\n\tlet audio: string | undefined;\n\tlet braille: string | undefined;\n\tfor (const card of cards) {\n\t\tconst value = card.content === undefined ? undefined : plainText(card.content);\n\t\tif (card.catalog === TACTILE_BRAILLE_TEXT && value && !braille) braille = value;\n\t\telse if (card.catalog === 'tactile' && card.payload && !audio) {\n\t\t\taudio = fileInfoXml('tactileAudioFile', card.payload, label);\n\t\t\tif (!audio) unwritten.push(card.catalog);\n\t\t} else if (card.catalog === 'tactile' && value && !text) text = value;\n\t\telse unwritten.push(card.catalog);\n\t}\n\tif (!text) return { unwritten: cards.map((card) => card.catalog) };\n\treturn {\n\t\txml:\n\t\t\t`<apip:tactileFile>${audio ?? ''}${labelled('tactileAudioText', label(), text)}` +\n\t\t\t`${braille ? labelled('tactileBrailleText', label(), braille) : ''}</apip:tactileFile>`,\n\t\tunwritten,\n\t};\n}\n\n/** An `audioFileInfo` or `videoFileInfo` for a payload's first source whose MIME type is known. */\nfunction fileInfoXml(name: string, payload: CatalogCardPayload, label: () => string): string | undefined {\n\tconst video = name === 'videoFileInfo';\n\tconst source = payload.media.sources\n\t\t.map((candidate) => ({ ...candidate, mimeType: mimeTypeOf(candidate) }))\n\t\t.find((candidate) => candidate.src && candidate.mimeType);\n\tif (!source) return undefined;\n\tconst { fragment } = payload;\n\tlet times = '';\n\tif (fragment && video) {\n\t\ttimes =\n\t\t\t`<apip:startCue>${xsTime(fragment.startSeconds)}</apip:startCue>` +\n\t\t\t(fragment.endSeconds === undefined ? '' : `<apip:endCue>${xsTime(fragment.endSeconds)}</apip:endCue>`);\n\t} else if (fragment) {\n\t\ttimes =\n\t\t\t`<apip:startTime>${xsTime(fragment.startSeconds)}</apip:startTime>` +\n\t\t\t(fragment.endSeconds === undefined\n\t\t\t\t? ''\n\t\t\t\t: `<apip:duration>${xsTime(fragment.endSeconds - fragment.startSeconds)}</apip:duration>`);\n\t}\n\treturn (\n\t\t`<apip:${name} contentLinkIdentifier=\"${escapeAttribute(label())}\" mimeType=\"${escapeAttribute(source.mimeType as string)}\">` +\n\t\t`<apip:fileHref>${escapeText(source.src)}</apip:fileHref>${times}</apip:${name}>`\n\t);\n}\n\nfunction mimeTypeOf(source: MediaSource): string | undefined {\n\tconst declared = source.type?.trim();\n\tif (declared) return declared;\n\tconst extension = /\\.([a-z0-9]+)(?:[?#].*)?$/i.exec(source.src)?.[1]?.toLowerCase();\n\treturn extension ? MIME_TYPES[extension] : undefined;\n}\n\n/** Seconds as an `xs:time`, to the millisecond. */\nfunction xsTime(seconds: number): string {\n\tconst total = Math.max(0, Math.round(seconds * 1000));\n\tconst pad = (value: number) => String(value).padStart(2, '0');\n\tconst fraction = total % 1000;\n\tconst clock = `${pad(Math.floor(total / 3_600_000))}:${pad(Math.floor(total / 60_000) % 60)}:${pad(Math.floor(total / 1000) % 60)}`;\n\treturn fraction === 0 ? clock : `${clock}.${String(fraction).padStart(3, '0').replace(/0+$/, '')}`;\n}\n\nfunction contentLinkXml(link: ApipContentLink): string | undefined {\n\tif (!link.target) return undefined;\n\tconst { range } = link;\n\tlet body: string;\n\tif (link.object) {\n\t\tbody = '<apip:objectLink/>';\n\t} else if (!range) {\n\t\tbody = '<apip:textLink><apip:fullString/></apip:textLink>';\n\t} else if (!Number.isInteger(range.start) || !Number.isInteger(range.stop)) {\n\t\treturn undefined;\n\t} else if (range.unit === 'character' && range.start !== range.stop) {\n\t\tbody = `<apip:textLink><apip:characterStringLink><apip:startCharacter>${range.start}</apip:startCharacter><apip:stopCharacter>${range.stop}</apip:stopCharacter></apip:characterStringLink></apip:textLink>`;\n\t} else if (range.start === range.stop) {\n\t\tconst element = range.unit === 'word' ? 'wordLink' : 'characterLink';\n\t\tbody = `<apip:textLink><apip:${element}>${range.start}</apip:${element}></apip:textLink>`;\n\t} else {\n\t\t// APIP links one word, never a run of them.\n\t\treturn undefined;\n\t}\n\treturn `<apip:contentLinkInfo qtiLinkIdentifierRef=\"${escapeAttribute(link.target)}\">${body}</apip:contentLinkInfo>`;\n}\n\n/** A `<speak>` card's content as APIP SSML, prefixed, or `undefined` when it is not SSML. */\nfunction ssmlScript(content: string): string | undefined {\n\tif (!/^\\s*<(?:[\\w.-]+:)?speak[\\s>/]/.test(content)) return undefined;\n\tconst root = parse(content, { lowerCaseTagName: false, comment: false });\n\tconst speak = allChildElements(root).find((element) => localName(element) === 'speak');\n\tconst script = speak ? speak.childNodes.map(ssmlNode).join('').trim() : '';\n\treturn script || undefined;\n}\n\nfunction ssmlNode(node: HTMLElement['childNodes'][number]): string {\n\tif (node instanceof TextNode) return escapeText(node.text);\n\tif (node.nodeType !== NodeType.ELEMENT_NODE) return '';\n\tconst element = node as HTMLElement;\n\tconst children = element.childNodes.map(ssmlNode).join('');\n\tconst name = localName(element);\n\tif (!APIP_SSML_ELEMENTS.has(name)) return children;\n\tconst attributes = Object.entries(element.attributes)\n\t\t.filter(([attribute]) => attribute !== 'xmlns' && !attribute.startsWith('xmlns:'))\n\t\t.map(([attribute, value]) => ` ${attribute}=\"${escapeAttribute(value)}\"`)\n\t\t.join('');\n\treturn children ? `<ssml:${name}${attributes}>${children}</ssml:${name}>` : `<ssml:${name}${attributes}/>`;\n}\n\n/** Card content as the text a plain-text APIP element holds. */\nfunction plainText(content: string): string {\n\treturn parse(content).textContent.trim();\n}\n\nfunction labelled(name: string, identifier: string, text: string): string {\n\treturn `<apip:${name} contentLinkIdentifier=\"${escapeAttribute(identifier)}\">${escapeText(text)}</apip:${name}>`;\n}\n\n/** `value` as an `xs:ID`: characters an NCName cannot hold become `-`, and a leading non-letter gains `_`. */\nfunction ncName(value: string): string {\n\tconst name = value.trim().replace(/[^\\w.-]/g, '-');\n\treturn /^[A-Za-z_]/.test(name) ? name : `_${name}`;\n}\n\n// ---------------------------------------------------------------------------\n// Shared\n// ---------------------------------------------------------------------------\n\nfunction escapeText(text: string): string {\n\treturn text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n}\n\nfunction escapeAttribute(value: string): string {\n\treturn escapeText(value).replace(/\"/g, '&quot;');\n}\n\nfunction childElements(parent: HTMLElement, name: string): HTMLElement[] {\n\treturn allChildElements(parent).filter((child) => localName(child) === name);\n}\n\nfunction allChildElements(parent: HTMLElement): HTMLElement[] {\n\treturn parent.childNodes.filter((child): child is HTMLElement => child.nodeType === NodeType.ELEMENT_NODE);\n}\n\nfunction firstChild(parent: HTMLElement, name: string): HTMLElement | undefined {\n\treturn childElements(parent, name)[0];\n}\n\nfunction localName(element: HTMLElement): string {\n\tconst raw = element.rawTagName ?? '';\n\treturn raw.slice(raw.indexOf(':') + 1);\n}\n"]}
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Accessibility catalog cards
3
+ *
4
+ * The card shape pie-players resolves: a catalog per identifier, a card per support and language,
5
+ * its body either HTML `content` or a media `payload`. Support names are QTI 3's.
6
+ */
7
+ export type MediaKind = 'image' | 'audio' | 'video' | 'other';
8
+ /** One playable encoding of a media asset. */
9
+ export interface MediaSource {
10
+ src: string;
11
+ /** MIME type, omitted when the source does not declare one. */
12
+ type?: string;
13
+ }
14
+ export interface MediaAssetRef {
15
+ version: 1;
16
+ id: string;
17
+ kind: MediaKind;
18
+ sources: MediaSource[];
19
+ }
20
+ /** A time slice of a media asset, from a QTI 3 media fragment (`#t=2,5`). */
21
+ export interface MediaFragmentRange {
22
+ startSeconds: number;
23
+ endSeconds?: number;
24
+ }
25
+ /** The structured form of a card: a recording for `spoken`, a video for `sign-language`. */
26
+ export interface CatalogCardPayload {
27
+ media: MediaAssetRef;
28
+ fragment?: MediaFragmentRange;
29
+ }
30
+ /** One alternate representation of a content node. Exactly one of `content` and `payload`. */
31
+ export interface CatalogCard {
32
+ /** The QTI `support`, e.g. `spoken`, `sign-language`, `glossary-on-screen`. */
33
+ catalog: string;
34
+ language?: string;
35
+ content?: string;
36
+ payload?: CatalogCardPayload;
37
+ }
38
+ export interface AccessibilityCatalog {
39
+ identifier: string;
40
+ cards: CatalogCard[];
41
+ }
42
+ /** A word or character range of an element's text, counted from 1, both ends included. */
43
+ export interface TextRange {
44
+ unit: 'word' | 'character';
45
+ start: number;
46
+ stop: number;
47
+ }
48
+ /** A media asset's kind, from its MIME type, else its extension, else `fallback`. */
49
+ export declare function mediaKind(type: string | undefined, src: string, fallback: MediaKind): MediaKind;
50
+ /** A clock value (`90`, `1:30`, `00:01:30.5`) as seconds; `undefined` when it is not one. */
51
+ export declare function clockSeconds(value: string): number | undefined;
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Accessibility catalog cards
3
+ *
4
+ * The card shape pie-players resolves: a catalog per identifier, a card per support and language,
5
+ * its body either HTML `content` or a media `payload`. Support names are QTI 3's.
6
+ */
7
+ const EXTENSION_KINDS = {
8
+ aac: 'audio',
9
+ m4a: 'audio',
10
+ mp3: 'audio',
11
+ oga: 'audio',
12
+ ogg: 'audio',
13
+ wav: 'audio',
14
+ m4v: 'video',
15
+ mov: 'video',
16
+ mp4: 'video',
17
+ ogv: 'video',
18
+ webm: 'video',
19
+ gif: 'image',
20
+ jpeg: 'image',
21
+ jpg: 'image',
22
+ png: 'image',
23
+ svg: 'image',
24
+ webp: 'image',
25
+ };
26
+ /** A media asset's kind, from its MIME type, else its extension, else `fallback`. */
27
+ export function mediaKind(type, src, fallback) {
28
+ const prefix = type?.split('/')[0]?.toLowerCase();
29
+ if (prefix === 'image' || prefix === 'audio' || prefix === 'video')
30
+ return prefix;
31
+ const extension = /\.([a-z0-9]+)$/i.exec(src)?.[1]?.toLowerCase();
32
+ return (extension ? EXTENSION_KINDS[extension] : undefined) ?? fallback;
33
+ }
34
+ /** A clock value (`90`, `1:30`, `00:01:30.5`) as seconds; `undefined` when it is not one. */
35
+ export function clockSeconds(value) {
36
+ const parts = value.split(':').map(Number);
37
+ if (parts.length > 3 || parts.some((part) => !Number.isFinite(part)))
38
+ return undefined;
39
+ return parts.reduce((total, part) => total * 60 + part, 0);
40
+ }
41
+ //# sourceMappingURL=catalog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/accessibility/catalog.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmDH,M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AAC,IAAI,CAAC,CAAC;QAAE,OAAO,SAAS,CAAC;IACvF,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,GAAG,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC;AAC5D,CAAC","sourcesContent":["/**\n * Accessibility catalog cards\n *\n * The card shape pie-players resolves: a catalog per identifier, a card per support and language,\n * its body either HTML `content` or a media `payload`. Support names are QTI 3's.\n */\n\nexport type MediaKind = 'image' | 'audio' | 'video' | 'other';\n\n/** One playable encoding of a media asset. */\nexport interface MediaSource {\n\tsrc: string;\n\t/** MIME type, omitted when the source does not declare one. */\n\ttype?: string;\n}\n\nexport interface MediaAssetRef {\n\tversion: 1;\n\tid: string;\n\tkind: MediaKind;\n\tsources: MediaSource[];\n}\n\n/** A time slice of a media asset, from a QTI 3 media fragment (`#t=2,5`). */\nexport interface MediaFragmentRange {\n\tstartSeconds: number;\n\tendSeconds?: number;\n}\n\n/** The structured form of a card: a recording for `spoken`, a video for `sign-language`. */\nexport interface CatalogCardPayload {\n\tmedia: MediaAssetRef;\n\tfragment?: MediaFragmentRange;\n}\n\n/** One alternate representation of a content node. Exactly one of `content` and `payload`. */\nexport interface CatalogCard {\n\t/** The QTI `support`, e.g. `spoken`, `sign-language`, `glossary-on-screen`. */\n\tcatalog: string;\n\tlanguage?: string;\n\tcontent?: string;\n\tpayload?: CatalogCardPayload;\n}\n\nexport interface AccessibilityCatalog {\n\tidentifier: string;\n\tcards: CatalogCard[];\n}\n\n/** A word or character range of an element's text, counted from 1, both ends included. */\nexport interface TextRange {\n\tunit: 'word' | 'character';\n\tstart: number;\n\tstop: number;\n}\n\nconst EXTENSION_KINDS: Record<string, MediaKind> = {\n\taac: 'audio',\n\tm4a: 'audio',\n\tmp3: 'audio',\n\toga: 'audio',\n\togg: 'audio',\n\twav: 'audio',\n\tm4v: 'video',\n\tmov: 'video',\n\tmp4: 'video',\n\togv: 'video',\n\twebm: 'video',\n\tgif: 'image',\n\tjpeg: 'image',\n\tjpg: 'image',\n\tpng: 'image',\n\tsvg: 'image',\n\twebp: 'image',\n};\n\n/** A media asset's kind, from its MIME type, else its extension, else `fallback`. */\nexport function mediaKind(type: string | undefined, src: string, fallback: MediaKind): MediaKind {\n\tconst prefix = type?.split('/')[0]?.toLowerCase();\n\tif (prefix === 'image' || prefix === 'audio' || prefix === 'video') return prefix;\n\tconst extension = /\\.([a-z0-9]+)$/i.exec(src)?.[1]?.toLowerCase();\n\treturn (extension ? EXTENSION_KINDS[extension] : undefined) ?? fallback;\n}\n\n/** A clock value (`90`, `1:30`, `00:01:30.5`) as seconds; `undefined` when it is not one. */\nexport function clockSeconds(value: string): number | undefined {\n\tconst parts = value.split(':').map(Number);\n\tif (parts.length > 3 || parts.some((part) => !Number.isFinite(part))) return undefined;\n\treturn parts.reduce((total, part) => total * 60 + part, 0);\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export { APIP_NAMESPACE, type ApipAccessElement, type ApipAccessElementSource, type ApipAccessibilityXml, type ApipContentLink, type ApipWriteOptions, readApipAccessElements, SSML_NAMESPACE, writeApipAccessibility, } from './apip.js';
2
+ export { type AccessibilityCatalog, type CatalogCard, type CatalogCardPayload, clockSeconds, type MediaAssetRef, type MediaFragmentRange, type MediaKind, type MediaSource, mediaKind, type TextRange, } from './catalog.js';
@@ -0,0 +1,3 @@
1
+ export { APIP_NAMESPACE, readApipAccessElements, SSML_NAMESPACE, writeApipAccessibility, } from './apip.js';
2
+ export { clockSeconds, mediaKind, } from './catalog.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/accessibility/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,cAAc,EAMd,sBAAsB,EACtB,cAAc,EACd,sBAAsB,GACtB,MAAM,WAAW,CAAC;AACnB,OAAO,EAIN,YAAY,EAKZ,SAAS,GAET,MAAM,cAAc,CAAC","sourcesContent":["export {\n\tAPIP_NAMESPACE,\n\ttype ApipAccessElement,\n\ttype ApipAccessElementSource,\n\ttype ApipAccessibilityXml,\n\ttype ApipContentLink,\n\ttype ApipWriteOptions,\n\treadApipAccessElements,\n\tSSML_NAMESPACE,\n\twriteApipAccessibility,\n} from './apip.js';\nexport {\n\ttype AccessibilityCatalog,\n\ttype CatalogCard,\n\ttype CatalogCardPayload,\n\tclockSeconds,\n\ttype MediaAssetRef,\n\ttype MediaFragmentRange,\n\ttype MediaKind,\n\ttype MediaSource,\n\tmediaKind,\n\ttype TextRange,\n} from './catalog.js';\n"]}
@@ -38,15 +38,3 @@ export declare class Qti3AttributeNameMapper implements AttributeNameMapper {
38
38
  */
39
39
  private camelToKebabCase;
40
40
  }
41
- /**
42
- * Get all QTI 3.0 attribute names (kebab-case).
43
- */
44
- export declare function getQti3AttributeNames(): readonly string[];
45
- /**
46
- * Get canonical name for a QTI 3.0 attribute.
47
- */
48
- export declare function getCanonicalAttributeName(qti3AttributeName: string): string | undefined;
49
- /**
50
- * Check if an attribute name is a valid QTI 3.0 attribute.
51
- */
52
- export declare function isQti3Attribute(attributeName: string): boolean;
@@ -1,171 +1,4 @@
1
- /**
2
- * QTI 3.0 attribute name mappings from kebab-case to camelCase.
3
- *
4
- * Based on QTI 3.0 specification where all attributes use kebab-case.
5
- * This provides comprehensive mappings for all standard QTI attributes.
6
- */
7
- const QTI3_ATTRIBUTE_MAPPINGS = {
8
- // Core identifiers
9
- identifier: 'identifier',
10
- 'response-identifier': 'responseIdentifier',
11
- 'outcome-identifier': 'outcomeIdentifier',
12
- 'template-identifier': 'templateIdentifier',
13
- 'context-identifier': 'contextIdentifier',
14
- // Types and cardinality
15
- 'base-type': 'baseType',
16
- cardinality: 'cardinality',
17
- // Choice/selection attributes
18
- 'max-choices': 'maxChoices',
19
- 'min-choices': 'minChoices',
20
- shuffle: 'shuffle',
21
- fixed: 'fixed',
22
- orientation: 'orientation',
23
- required: 'required',
24
- // Match/association attributes
25
- 'match-max': 'matchMax',
26
- 'match-min': 'matchMin',
27
- 'max-associations': 'maxAssociations',
28
- 'min-associations': 'minAssociations',
29
- // Text interaction attributes
30
- 'expected-length': 'expectedLength',
31
- 'expected-lines': 'expectedLines',
32
- 'pattern-mask': 'patternMask',
33
- 'placeholder-text': 'placeholderText',
34
- format: 'format',
35
- 'string-identifier': 'stringIdentifier',
36
- 'min-strings': 'minStrings',
37
- 'max-strings': 'maxStrings',
38
- // Slider attributes
39
- 'lower-bound': 'lowerBound',
40
- 'upper-bound': 'upperBound',
41
- step: 'step',
42
- 'step-label': 'stepLabel',
43
- reverse: 'reverse',
44
- // Hotspot/graphic attributes
45
- shape: 'shape',
46
- coords: 'coords',
47
- 'hotspot-label': 'hotspotLabel',
48
- 'min-hotspots': 'minHotspots',
49
- 'max-hotspots': 'maxHotspots',
50
- // Media attributes
51
- autostart: 'autostart',
52
- 'min-plays': 'minPlays',
53
- 'max-plays': 'maxPlays',
54
- loop: 'loop',
55
- controls: 'controls',
56
- // Feedback attributes
57
- 'show-hide': 'showHide',
58
- 'outcome-value': 'outcomeValue',
59
- access: 'access',
60
- view: 'view',
61
- // Outcome/result attributes
62
- 'normal-maximum': 'normalMaximum',
63
- 'normal-minimum': 'normalMinimum',
64
- 'mastery-value': 'masteryValue',
65
- interpretation: 'interpretation',
66
- 'long-interpretation': 'longInterpretation',
67
- // Template attributes
68
- 'math-variable': 'mathVariable',
69
- 'param-variable': 'paramVariable',
70
- // Assessment/test attributes
71
- 'time-dependent': 'timeDependent',
72
- adaptive: 'adaptive',
73
- title: 'title',
74
- label: 'label',
75
- // Test structure attributes
76
- 'navigation-mode': 'navigationMode',
77
- 'submission-mode': 'submissionMode',
78
- 'item-session-control': 'itemSessionControl',
79
- 'time-limits': 'timeLimits',
80
- // Time limits
81
- 'min-time': 'minTime',
82
- 'max-time': 'maxTime',
83
- 'allow-late-submission': 'allowLateSubmission',
84
- // Item session control
85
- 'max-attempts': 'maxAttempts',
86
- 'show-feedback': 'showFeedback',
87
- 'allow-review': 'allowReview',
88
- 'show-solution': 'showSolution',
89
- 'allow-comment': 'allowComment',
90
- 'allow-skipping': 'allowSkipping',
91
- 'validate-responses': 'validateResponses',
92
- // Processing attributes
93
- template: 'template',
94
- 'template-location': 'templateLocation',
95
- // Expression attributes
96
- 'field-identifier': 'fieldIdentifier',
97
- 'base-value': 'baseValue',
98
- 'tolerance-mode': 'toleranceMode',
99
- 'include-category': 'includeCategory',
100
- 'exclude-category': 'excludeCategory',
101
- 'section-identifier': 'sectionIdentifier',
102
- 'weight-identifier': 'weightIdentifier',
103
- // Mapping attributes
104
- 'map-key': 'mapKey',
105
- 'mapped-value': 'mappedValue',
106
- 'case-sensitive': 'caseSensitive',
107
- 'default-value': 'defaultValue',
108
- // Note: lower-bound and upper-bound already defined above (used in slider and mapping contexts)
109
- // Interpolation attributes
110
- 'source-value': 'sourceValue',
111
- 'target-value': 'targetValue',
112
- 'include-boundary': 'includeBoundary',
113
- // Ordering attributes
114
- 'keep-together': 'keepTogether',
115
- // Selection attributes
116
- select: 'select',
117
- 'with-replacement': 'withReplacement',
118
- // Pre-conditions and branching
119
- 'pre-condition': 'preCondition',
120
- 'branch-rule': 'branchRule',
121
- // Catalog/accessibility attributes
122
- 'data-catalog-idref': 'dataCatalogIdref',
123
- support: 'support',
124
- 'card-idref': 'cardIdref',
125
- // PCI attributes
126
- hook: 'hook',
127
- module: 'module',
128
- 'entry-point': 'entryPoint',
129
- // Object attributes
130
- data: 'data',
131
- type: 'type',
132
- width: 'width',
133
- height: 'height',
134
- codetype: 'codetype',
135
- codebase: 'codebase',
136
- archive: 'archive',
137
- // Param attributes
138
- name: 'name',
139
- value: 'value',
140
- valuetype: 'valuetype',
141
- // Stylesheet attributes
142
- href: 'href',
143
- media: 'media',
144
- // Math operator attributes
145
- operator: 'operator',
146
- // Stats operator attributes
147
- 'stats-operator': 'statsOperator',
148
- // Rounding attributes
149
- 'rounding-mode': 'roundingMode',
150
- figures: 'figures',
151
- // Variable matching
152
- 'variable-identifier': 'variableIdentifier',
153
- // Index attributes
154
- n: 'n',
155
- // String matching
156
- 'substring-match': 'substringMatch',
157
- // Container attributes
158
- 'ordered-container': 'orderedContainer',
159
- // Custom operator
160
- class: 'class',
161
- definition: 'definition',
162
- // Standard XML attributes (pass through)
163
- lang: 'lang',
164
- 'xml:lang': 'xml:lang',
165
- 'xml:base': 'xml:base',
166
- id: 'id',
167
- xmlns: 'xmlns',
168
- };
1
+ import { QTI3_ATTRIBUTE_TO_QTI2 } from './qti3-attribute-map.js';
169
2
  /**
170
3
  * QTI 3.0 attribute name mapper.
171
4
  *
@@ -188,7 +21,7 @@ export class Qti3AttributeNameMapper {
188
21
  */
189
22
  toCanonical(attributeName) {
190
23
  // Direct lookup
191
- const canonical = QTI3_ATTRIBUTE_MAPPINGS[attributeName];
24
+ const canonical = QTI3_ATTRIBUTE_TO_QTI2.get(attributeName);
192
25
  if (canonical) {
193
26
  return canonical;
194
27
  }
@@ -206,7 +39,7 @@ export class Qti3AttributeNameMapper {
206
39
  // Build reverse map on first use
207
40
  if (!this.reverseMap) {
208
41
  this.reverseMap = new Map();
209
- for (const [kebab, camel] of Object.entries(QTI3_ATTRIBUTE_MAPPINGS)) {
42
+ for (const [kebab, camel] of QTI3_ATTRIBUTE_TO_QTI2) {
210
43
  this.reverseMap.set(camel, kebab);
211
44
  }
212
45
  }
@@ -251,22 +84,4 @@ export class Qti3AttributeNameMapper {
251
84
  return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
252
85
  }
253
86
  }
254
- /**
255
- * Get all QTI 3.0 attribute names (kebab-case).
256
- */
257
- export function getQti3AttributeNames() {
258
- return Object.keys(QTI3_ATTRIBUTE_MAPPINGS);
259
- }
260
- /**
261
- * Get canonical name for a QTI 3.0 attribute.
262
- */
263
- export function getCanonicalAttributeName(qti3AttributeName) {
264
- return QTI3_ATTRIBUTE_MAPPINGS[qti3AttributeName];
265
- }
266
- /**
267
- * Check if an attribute name is a valid QTI 3.0 attribute.
268
- */
269
- export function isQti3Attribute(attributeName) {
270
- return attributeName in QTI3_ATTRIBUTE_MAPPINGS;
271
- }
272
87
  //# sourceMappingURL=Qti3AttributeNameMapper.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Qti3AttributeNameMapper.js","sourceRoot":"","sources":["../../src/element-mapper/Qti3AttributeNameMapper.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,uBAAuB,GAA2B;IACvD,mBAAmB;IACnB,UAAU,EAAE,YAAY;IACxB,qBAAqB,EAAE,oBAAoB;IAC3C,oBAAoB,EAAE,mBAAmB;IACzC,qBAAqB,EAAE,oBAAoB;IAC3C,oBAAoB,EAAE,mBAAmB;IAEzC,wBAAwB;IACxB,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,aAAa;IAE1B,8BAA8B;IAC9B,aAAa,EAAE,YAAY;IAC3B,aAAa,EAAE,YAAY;IAC3B,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;IAC1B,QAAQ,EAAE,UAAU;IAEpB,+BAA+B;IAC/B,WAAW,EAAE,UAAU;IACvB,WAAW,EAAE,UAAU;IACvB,kBAAkB,EAAE,iBAAiB;IACrC,kBAAkB,EAAE,iBAAiB;IAErC,8BAA8B;IAC9B,iBAAiB,EAAE,gBAAgB;IACnC,gBAAgB,EAAE,eAAe;IACjC,cAAc,EAAE,aAAa;IAC7B,kBAAkB,EAAE,iBAAiB;IACrC,MAAM,EAAE,QAAQ;IAChB,mBAAmB,EAAE,kBAAkB;IACvC,aAAa,EAAE,YAAY;IAC3B,aAAa,EAAE,YAAY;IAE3B,oBAAoB;IACpB,aAAa,EAAE,YAAY;IAC3B,aAAa,EAAE,YAAY;IAC3B,IAAI,EAAE,MAAM;IACZ,YAAY,EAAE,WAAW;IACzB,OAAO,EAAE,SAAS;IAElB,6BAA6B;IAC7B,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,eAAe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C,aAAqB;IACpD,OAAO,aAAa,IAAI,uBAAuB,CAAC;AACjD,CAAC","sourcesContent":["import type { AttributeNameMapper } from './AttributeNameMapper.js';\n\n/**\n * QTI 3.0 attribute name mappings from kebab-case to camelCase.\n *\n * Based on QTI 3.0 specification where all attributes use kebab-case.\n * This provides comprehensive mappings for all standard QTI attributes.\n */\nconst QTI3_ATTRIBUTE_MAPPINGS: Record<string, string> = {\n\t// Core identifiers\n\tidentifier: 'identifier',\n\t'response-identifier': 'responseIdentifier',\n\t'outcome-identifier': 'outcomeIdentifier',\n\t'template-identifier': 'templateIdentifier',\n\t'context-identifier': 'contextIdentifier',\n\n\t// Types and cardinality\n\t'base-type': 'baseType',\n\tcardinality: 'cardinality',\n\n\t// Choice/selection attributes\n\t'max-choices': 'maxChoices',\n\t'min-choices': 'minChoices',\n\tshuffle: 'shuffle',\n\tfixed: 'fixed',\n\torientation: 'orientation',\n\trequired: 'required',\n\n\t// Match/association attributes\n\t'match-max': 'matchMax',\n\t'match-min': 'matchMin',\n\t'max-associations': 'maxAssociations',\n\t'min-associations': 'minAssociations',\n\n\t// Text interaction attributes\n\t'expected-length': 'expectedLength',\n\t'expected-lines': 'expectedLines',\n\t'pattern-mask': 'patternMask',\n\t'placeholder-text': 'placeholderText',\n\tformat: 'format',\n\t'string-identifier': 'stringIdentifier',\n\t'min-strings': 'minStrings',\n\t'max-strings': 'maxStrings',\n\n\t// Slider attributes\n\t'lower-bound': 'lowerBound',\n\t'upper-bound': 'upperBound',\n\tstep: 'step',\n\t'step-label': 'stepLabel',\n\treverse: 'reverse',\n\n\t// Hotspot/graphic attributes\n\tshape: 'shape',\n\tcoords: 'coords',\n\t'hotspot-label': 'hotspotLabel',\n\t'min-hotspots': 'minHotspots',\n\t'max-hotspots': 'maxHotspots',\n\n\t// Media attributes\n\tautostart: 'autostart',\n\t'min-plays': 'minPlays',\n\t'max-plays': 'maxPlays',\n\tloop: 'loop',\n\tcontrols: 'controls',\n\n\t// Feedback attributes\n\t'show-hide': 'showHide',\n\t'outcome-value': 'outcomeValue',\n\taccess: 'access',\n\tview: 'view',\n\n\t// Outcome/result attributes\n\t'normal-maximum': 'normalMaximum',\n\t'normal-minimum': 'normalMinimum',\n\t'mastery-value': 'masteryValue',\n\tinterpretation: 'interpretation',\n\t'long-interpretation': 'longInterpretation',\n\n\t// Template attributes\n\t'math-variable': 'mathVariable',\n\t'param-variable': 'paramVariable',\n\n\t// Assessment/test attributes\n\t'time-dependent': 'timeDependent',\n\tadaptive: 'adaptive',\n\ttitle: 'title',\n\tlabel: 'label',\n\n\t// Test structure attributes\n\t'navigation-mode': 'navigationMode',\n\t'submission-mode': 'submissionMode',\n\t'item-session-control': 'itemSessionControl',\n\t'time-limits': 'timeLimits',\n\n\t// Time limits\n\t'min-time': 'minTime',\n\t'max-time': 'maxTime',\n\t'allow-late-submission': 'allowLateSubmission',\n\n\t// Item session control\n\t'max-attempts': 'maxAttempts',\n\t'show-feedback': 'showFeedback',\n\t'allow-review': 'allowReview',\n\t'show-solution': 'showSolution',\n\t'allow-comment': 'allowComment',\n\t'allow-skipping': 'allowSkipping',\n\t'validate-responses': 'validateResponses',\n\n\t// Processing attributes\n\ttemplate: 'template',\n\t'template-location': 'templateLocation',\n\n\t// Expression attributes\n\t'field-identifier': 'fieldIdentifier',\n\t'base-value': 'baseValue',\n\t'tolerance-mode': 'toleranceMode',\n\t'include-category': 'includeCategory',\n\t'exclude-category': 'excludeCategory',\n\t'section-identifier': 'sectionIdentifier',\n\t'weight-identifier': 'weightIdentifier',\n\n\t// Mapping attributes\n\t'map-key': 'mapKey',\n\t'mapped-value': 'mappedValue',\n\t'case-sensitive': 'caseSensitive',\n\t'default-value': 'defaultValue',\n\t// Note: lower-bound and upper-bound already defined above (used in slider and mapping contexts)\n\n\t// Interpolation attributes\n\t'source-value': 'sourceValue',\n\t'target-value': 'targetValue',\n\t'include-boundary': 'includeBoundary',\n\n\t// Ordering attributes\n\t'keep-together': 'keepTogether',\n\n\t// Selection attributes\n\tselect: 'select',\n\t'with-replacement': 'withReplacement',\n\n\t// Pre-conditions and branching\n\t'pre-condition': 'preCondition',\n\t'branch-rule': 'branchRule',\n\n\t// Catalog/accessibility attributes\n\t'data-catalog-idref': 'dataCatalogIdref',\n\tsupport: 'support',\n\t'card-idref': 'cardIdref',\n\n\t// PCI attributes\n\thook: 'hook',\n\tmodule: 'module',\n\t'entry-point': 'entryPoint',\n\n\t// Object attributes\n\tdata: 'data',\n\ttype: 'type',\n\twidth: 'width',\n\theight: 'height',\n\tcodetype: 'codetype',\n\tcodebase: 'codebase',\n\tarchive: 'archive',\n\n\t// Param attributes\n\tname: 'name',\n\tvalue: 'value',\n\tvaluetype: 'valuetype',\n\n\t// Stylesheet attributes\n\thref: 'href',\n\tmedia: 'media',\n\n\t// Math operator attributes\n\toperator: 'operator',\n\n\t// Stats operator attributes\n\t'stats-operator': 'statsOperator',\n\n\t// Rounding attributes\n\t'rounding-mode': 'roundingMode',\n\tfigures: 'figures',\n\n\t// Variable matching\n\t'variable-identifier': 'variableIdentifier',\n\n\t// Index attributes\n\tn: 'n',\n\n\t// String matching\n\t'substring-match': 'substringMatch',\n\n\t// Container attributes\n\t'ordered-container': 'orderedContainer',\n\n\t// Custom operator\n\tclass: 'class',\n\tdefinition: 'definition',\n\n\t// Standard XML attributes (pass through)\n\tlang: 'lang',\n\t'xml:lang': 'xml:lang',\n\t'xml:base': 'xml:base',\n\tid: 'id',\n\txmlns: 'xmlns',\n} as const;\n\n/**\n * QTI 3.0 attribute name mapper.\n *\n * QTI 3.0 uses kebab-case for attribute names. This mapper converts\n * between kebab-case (QTI 3.0) and camelCase (internal canonical form).\n *\n * @example\n * const mapper = new Qti3AttributeNameMapper();\n * mapper.toCanonical('response-identifier'); // => 'responseIdentifier'\n * mapper.toCanonical('max-choices'); // => 'maxChoices'\n * mapper.toNative('responseIdentifier'); // => 'response-identifier'\n * mapper.toNative('maxChoices'); // => 'max-choices'\n */\nexport class Qti3AttributeNameMapper implements AttributeNameMapper {\n\treadonly version = '3.0';\n\n\t// Reverse mapping cache (camelCase -> kebab-case)\n\tprivate reverseMap: Map<string, string> | null = null;\n\n\t/**\n\t * Convert QTI 3.0 kebab-case attribute to canonical camelCase.\n\t */\n\ttoCanonical(attributeName: string): string {\n\t\t// Direct lookup\n\t\tconst canonical = QTI3_ATTRIBUTE_MAPPINGS[attributeName];\n\t\tif (canonical) {\n\t\t\treturn canonical;\n\t\t}\n\n\t\t// If already in camelCase (no hyphens), return as-is\n\t\tif (!attributeName.includes('-')) {\n\t\t\treturn attributeName;\n\t\t}\n\n\t\t// Fallback: convert kebab-case to camelCase programmatically\n\t\treturn this.kebabToCamelCase(attributeName);\n\t}\n\n\t/**\n\t * Convert canonical camelCase to QTI 3.0 kebab-case.\n\t */\n\ttoNative(canonicalName: string): string {\n\t\t// Build reverse map on first use\n\t\tif (!this.reverseMap) {\n\t\t\tthis.reverseMap = new Map();\n\t\t\tfor (const [kebab, camel] of Object.entries(QTI3_ATTRIBUTE_MAPPINGS)) {\n\t\t\t\tthis.reverseMap.set(camel, kebab);\n\t\t\t}\n\t\t}\n\n\t\t// Direct lookup\n\t\tconst native = this.reverseMap.get(canonicalName);\n\t\tif (native) {\n\t\t\treturn native;\n\t\t}\n\n\t\t// If already in kebab-case, return as-is\n\t\tif (canonicalName.includes('-')) {\n\t\t\treturn canonicalName;\n\t\t}\n\n\t\t// Fallback: convert camelCase to kebab-case programmatically\n\t\treturn this.camelToKebabCase(canonicalName);\n\t}\n\n\t/**\n\t * Check if attribute name is valid kebab-case.\n\t */\n\tisValidAttributeName(attributeName: string): boolean {\n\t\t// Standard XML attributes are always valid\n\t\tif (\n\t\t\tattributeName.startsWith('xml:') ||\n\t\t\tattributeName.startsWith('xmlns') ||\n\t\t\tattributeName === 'id'\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// QTI 3.0 attributes should be kebab-case (lowercase with hyphens)\n\t\t// or simple lowercase (like 'shuffle', 'type', 'value')\n\t\treturn /^[a-z][a-z0-9-]*$/.test(attributeName);\n\t}\n\n\t/**\n\t * Convert kebab-case to camelCase.\n\t * @private\n\t */\n\tprivate kebabToCamelCase(str: string): string {\n\t\treturn str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());\n\t}\n\n\t/**\n\t * Convert camelCase to kebab-case.\n\t * @private\n\t */\n\tprivate camelToKebabCase(str: string): string {\n\t\treturn str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n\t}\n}\n\n/**\n * Get all QTI 3.0 attribute names (kebab-case).\n */\nexport function getQti3AttributeNames(): readonly string[] {\n\treturn Object.keys(QTI3_ATTRIBUTE_MAPPINGS);\n}\n\n/**\n * Get canonical name for a QTI 3.0 attribute.\n */\nexport function getCanonicalAttributeName(qti3AttributeName: string): string | undefined {\n\treturn QTI3_ATTRIBUTE_MAPPINGS[qti3AttributeName];\n}\n\n/**\n * Check if an attribute name is a valid QTI 3.0 attribute.\n */\nexport function isQti3Attribute(attributeName: string): boolean {\n\treturn attributeName in QTI3_ATTRIBUTE_MAPPINGS;\n}\n"]}
1
+ {"version":3,"file":"Qti3AttributeNameMapper.js","sourceRoot":"","sources":["../../src/element-mapper/Qti3AttributeNameMapper.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,uBAAuB;IAC1B,OAAO,GAAG,KAAK,CAAC;IAEzB,kDAAkD;IAC1C,UAAU,GAA+B,IAAI,CAAC;IAEtD;;OAEG;IACH,WAAW,CAAC,aAAqB;QAChC,gBAAgB;QAChB,MAAM,SAAS,GAAG,sBAAsB,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAC5D,IAAI,SAAS,EAAE,CAAC;YACf,OAAO,SAAS,CAAC;QAClB,CAAC;QAED,qDAAqD;QACrD,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAClC,OAAO,aA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C,WAAW,EAAE,CAAC,CAAC;IACtE,CAAC;IAED;;;OAGG;IACK,gBAAgB,CAAC,GAAW;QACnC,OAAO,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;IACtE,CAAC;CACD","sourcesContent":["import type { AttributeNameMapper } from './AttributeNameMapper.js';\nimport { QTI3_ATTRIBUTE_TO_QTI2 } from './qti3-attribute-map.js';\n\n/**\n * QTI 3.0 attribute name mapper.\n *\n * QTI 3.0 uses kebab-case for attribute names. This mapper converts\n * between kebab-case (QTI 3.0) and camelCase (internal canonical form).\n *\n * @example\n * const mapper = new Qti3AttributeNameMapper();\n * mapper.toCanonical('response-identifier'); // => 'responseIdentifier'\n * mapper.toCanonical('max-choices'); // => 'maxChoices'\n * mapper.toNative('responseIdentifier'); // => 'response-identifier'\n * mapper.toNative('maxChoices'); // => 'max-choices'\n */\nexport class Qti3AttributeNameMapper implements AttributeNameMapper {\n\treadonly version = '3.0';\n\n\t// Reverse mapping cache (camelCase -> kebab-case)\n\tprivate reverseMap: Map<string, string> | null = null;\n\n\t/**\n\t * Convert QTI 3.0 kebab-case attribute to canonical camelCase.\n\t */\n\ttoCanonical(attributeName: string): string {\n\t\t// Direct lookup\n\t\tconst canonical = QTI3_ATTRIBUTE_TO_QTI2.get(attributeName);\n\t\tif (canonical) {\n\t\t\treturn canonical;\n\t\t}\n\n\t\t// If already in camelCase (no hyphens), return as-is\n\t\tif (!attributeName.includes('-')) {\n\t\t\treturn attributeName;\n\t\t}\n\n\t\t// Fallback: convert kebab-case to camelCase programmatically\n\t\treturn this.kebabToCamelCase(attributeName);\n\t}\n\n\t/**\n\t * Convert canonical camelCase to QTI 3.0 kebab-case.\n\t */\n\ttoNative(canonicalName: string): string {\n\t\t// Build reverse map on first use\n\t\tif (!this.reverseMap) {\n\t\t\tthis.reverseMap = new Map();\n\t\t\tfor (const [kebab, camel] of QTI3_ATTRIBUTE_TO_QTI2) {\n\t\t\t\tthis.reverseMap.set(camel, kebab);\n\t\t\t}\n\t\t}\n\n\t\t// Direct lookup\n\t\tconst native = this.reverseMap.get(canonicalName);\n\t\tif (native) {\n\t\t\treturn native;\n\t\t}\n\n\t\t// If already in kebab-case, return as-is\n\t\tif (canonicalName.includes('-')) {\n\t\t\treturn canonicalName;\n\t\t}\n\n\t\t// Fallback: convert camelCase to kebab-case programmatically\n\t\treturn this.camelToKebabCase(canonicalName);\n\t}\n\n\t/**\n\t * Check if attribute name is valid kebab-case.\n\t */\n\tisValidAttributeName(attributeName: string): boolean {\n\t\t// Standard XML attributes are always valid\n\t\tif (\n\t\t\tattributeName.startsWith('xml:') ||\n\t\t\tattributeName.startsWith('xmlns') ||\n\t\t\tattributeName === 'id'\n\t\t) {\n\t\t\treturn true;\n\t\t}\n\n\t\t// QTI 3.0 attributes should be kebab-case (lowercase with hyphens)\n\t\t// or simple lowercase (like 'shuffle', 'type', 'value')\n\t\treturn /^[a-z][a-z0-9-]*$/.test(attributeName);\n\t}\n\n\t/**\n\t * Convert kebab-case to camelCase.\n\t * @private\n\t */\n\tprivate kebabToCamelCase(str: string): string {\n\t\treturn str.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());\n\t}\n\n\t/**\n\t * Convert camelCase to kebab-case.\n\t * @private\n\t */\n\tprivate camelToKebabCase(str: string): string {\n\t\treturn str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n\t}\n}\n"]}
@@ -4,3 +4,4 @@ export { Qti3ElementNameMapper } from './Qti3ElementNameMapper.js';
4
4
  export type { AttributeNameMapper } from './AttributeNameMapper.js';
5
5
  export { Qti2xAttributeNameMapper } from './Qti2xAttributeNameMapper.js';
6
6
  export { Qti3AttributeNameMapper } from './Qti3AttributeNameMapper.js';
7
+ export { QTI2_PROMPT_BEARING_INTERACTIONS, QTI3_ATTRIBUTE_TO_QTI2 } from './qti3-attribute-map.js';
@@ -2,4 +2,5 @@ export { Qti2xElementNameMapper } from './Qti2xElementNameMapper.js';
2
2
  export { Qti3ElementNameMapper } from './Qti3ElementNameMapper.js';
3
3
  export { Qti2xAttributeNameMapper } from './Qti2xAttributeNameMapper.js';
4
4
  export { Qti3AttributeNameMapper } from './Qti3AttributeNameMapper.js';
5
+ export { QTI2_PROMPT_BEARING_INTERACTIONS, QTI3_ATTRIBUTE_TO_QTI2 } from './qti3-attribute-map.js';
5
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/element-mapper/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC","sourcesContent":["export type { ElementNameMapper } from './ElementNameMapper.js';\nexport { Qti2xElementNameMapper } from './Qti2xElementNameMapper.js';\nexport { Qti3ElementNameMapper } from './Qti3ElementNameMapper.js';\n\nexport type { AttributeNameMapper } from './AttributeNameMapper.js';\nexport { Qti2xAttributeNameMapper } from './Qti2xAttributeNameMapper.js';\nexport { Qti3AttributeNameMapper } from './Qti3AttributeNameMapper.js';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/element-mapper/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAGnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,gCAAgC,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC","sourcesContent":["export type { ElementNameMapper } from './ElementNameMapper.js';\nexport { Qti2xElementNameMapper } from './Qti2xElementNameMapper.js';\nexport { Qti3ElementNameMapper } from './Qti3ElementNameMapper.js';\n\nexport type { AttributeNameMapper } from './AttributeNameMapper.js';\nexport { Qti2xAttributeNameMapper } from './Qti2xAttributeNameMapper.js';\nexport { Qti3AttributeNameMapper } from './Qti3AttributeNameMapper.js';\nexport { QTI2_PROMPT_BEARING_INTERACTIONS, QTI3_ATTRIBUTE_TO_QTI2 } from './qti3-attribute-map.js';\n"]}
@@ -0,0 +1,8 @@
1
+ /** QTI 3.0 kebab-case attribute name → QTI 2.x camelCase equivalent. 79 entries. */
2
+ export declare const QTI3_ATTRIBUTE_TO_QTI2: Map<string, string>;
3
+ /**
4
+ * QTI 2.2 interactions whose content model permits a `prompt` child (it must come first).
5
+ * The inline interactions are deliberately absent: moving a prompt into one would trade one
6
+ * schema violation for another.
7
+ */
8
+ export declare const QTI2_PROMPT_BEARING_INTERACTIONS: ReadonlySet<string>;