@pie-element/mc-populated-blank 0.2.11 → 0.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/package.json +3 -14
  2. package/dist/controller/index.test.d.ts +0 -63
  3. package/dist/controller/index.test.d.ts.map +0 -1
  4. package/dist/delivery/AudioPlayer.test.d.ts +0 -2
  5. package/dist/delivery/AudioPlayer.test.d.ts.map +0 -1
  6. package/dist/delivery/ChoiceRow.test.d.ts +0 -2
  7. package/dist/delivery/ChoiceRow.test.d.ts.map +0 -1
  8. package/dist/delivery/ClozeMarker.test.d.ts +0 -2
  9. package/dist/delivery/ClozeMarker.test.d.ts.map +0 -1
  10. package/dist/delivery/McPopulatedBlank.transcript.test.d.ts +0 -2
  11. package/dist/delivery/McPopulatedBlank.transcript.test.d.ts.map +0 -1
  12. package/dist/delivery/computeAudioMode.test.d.ts +0 -2
  13. package/dist/delivery/computeAudioMode.test.d.ts.map +0 -1
  14. package/dist/delivery/computeChoiceCorrectness.test.d.ts +0 -19
  15. package/dist/delivery/computeChoiceCorrectness.test.d.ts.map +0 -1
  16. package/dist/delivery/computeDisplayState.test.d.ts +0 -38
  17. package/dist/delivery/computeDisplayState.test.d.ts.map +0 -1
  18. package/dist/delivery/computeLayoutProfile.test.d.ts +0 -2
  19. package/dist/delivery/computeLayoutProfile.test.d.ts.map +0 -1
  20. package/dist/delivery/computeLayoutStyle.test.d.ts +0 -2
  21. package/dist/delivery/computeLayoutStyle.test.d.ts.map +0 -1
  22. package/src/author/Author.svelte +0 -41
  23. package/src/author/index.ts +0 -28
  24. package/src/controller/defaults.ts +0 -61
  25. package/src/controller/index.test.ts +0 -428
  26. package/src/controller/index.ts +0 -372
  27. package/src/delivery/AudioPlayer.svelte +0 -246
  28. package/src/delivery/AudioPlayer.test.ts +0 -149
  29. package/src/delivery/ChoiceRow.svelte +0 -222
  30. package/src/delivery/ChoiceRow.test.ts +0 -179
  31. package/src/delivery/ClozeMarker.svelte +0 -83
  32. package/src/delivery/ClozeMarker.test.ts +0 -128
  33. package/src/delivery/McPopulatedBlank.svelte +0 -739
  34. package/src/delivery/McPopulatedBlank.transcript.test.ts +0 -154
  35. package/src/delivery/computeAudioMode.test.ts +0 -40
  36. package/src/delivery/computeAudioMode.ts +0 -11
  37. package/src/delivery/computeChoiceCorrectness.test.ts +0 -120
  38. package/src/delivery/computeChoiceCorrectness.ts +0 -42
  39. package/src/delivery/computeDisplayState.test.ts +0 -274
  40. package/src/delivery/computeDisplayState.ts +0 -101
  41. package/src/delivery/computeLayoutProfile.test.ts +0 -163
  42. package/src/delivery/computeLayoutProfile.ts +0 -72
  43. package/src/delivery/computeLayoutStyle.test.ts +0 -168
  44. package/src/delivery/computeLayoutStyle.ts +0 -128
  45. package/src/delivery/cqt-css/sel-r1-base.css +0 -59
  46. package/src/delivery/cqt-css/sel-r1-g-stem.css +0 -14
  47. package/src/delivery/cqt-css/sel-r1-gg-plus.css +0 -12
  48. package/src/delivery/cqt-css/sel-r1-ggplus.css +0 -17
  49. package/src/delivery/cqt-css/sel-r1-gplusggg.css +0 -25
  50. package/src/delivery/cqt-css/sel-r1-plusggg.css +0 -17
  51. package/src/delivery/cqt-css/sel-r1-s3.css +0 -85
  52. package/src/delivery/cqt-css/sel-vic.css +0 -99
  53. package/src/delivery/cqt-css/sr-vic.css +0 -63
  54. package/src/delivery/index.ts +0 -94
  55. package/src/delivery/variant-css-map.ts +0 -124
  56. package/src/index.iife.ts +0 -13
  57. package/src/index.ts +0 -1
  58. package/src/print/Print.svelte +0 -95
  59. package/src/print/index.ts +0 -18
  60. package/src/shared/layoutLimits.ts +0 -76
  61. package/src/shared/types.ts +0 -84
  62. package/src/types/css-raw.d.ts +0 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/mc-populated-blank",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "description": "Multiple-choice option populates an inline blank in a sentence template (Svelte 5 PIE element)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -10,34 +10,28 @@
10
10
  },
11
11
  "exports": {
12
12
  ".": {
13
- "development": "./src/index.ts",
14
13
  "types": "./dist/index.d.ts",
15
14
  "default": "./dist/index.js"
16
15
  },
17
16
  "./delivery": {
18
- "development": "./src/delivery/index.ts",
19
17
  "types": "./dist/delivery/index.d.ts",
20
18
  "default": "./dist/delivery/index.js"
21
19
  },
22
20
  "./controller": {
23
- "development": "./src/controller/index.ts",
24
21
  "types": "./dist/controller/index.d.ts",
25
22
  "default": "./dist/controller/index.js"
26
23
  },
27
24
  "./author": {
28
- "development": "./src/author/index.ts",
29
25
  "types": "./dist/author/index.d.ts",
30
26
  "default": "./dist/author/index.js"
31
27
  },
32
28
  "./print": {
33
- "development": "./src/print/index.ts",
34
29
  "types": "./dist/print/index.d.ts",
35
30
  "default": "./dist/print/index.js"
36
31
  }
37
32
  },
38
33
  "files": [
39
34
  "dist",
40
- "src",
41
35
  "controller.js"
42
36
  ],
43
37
  "sideEffects": false,
@@ -46,14 +40,9 @@
46
40
  "dev": "vite",
47
41
  "clean": "rm -rf dist tsconfig.tsbuildinfo"
48
42
  },
49
- "dependencies": {
50
- "@pie-lib/delivery-events-svelte": "0.1.0",
51
- "@pie-lib/styling-svelte": "0.1.2"
52
- },
53
- "peerDependencies": {
54
- "svelte": "^5.0.0"
55
- },
56
43
  "devDependencies": {
44
+ "@pie-lib/delivery-events-svelte": "0.1.0",
45
+ "@pie-lib/styling-svelte": "0.1.2",
57
46
  "@sveltejs/vite-plugin-svelte": "^7.0.0",
58
47
  "svelte": "^5.54.0",
59
48
  "typescript": "^5.9.3",
@@ -1,63 +0,0 @@
1
- /**
2
- * Unit tests for the McPopulatedBlank controller.
3
- *
4
- * Cases are grouped by exported function.
5
- *
6
- * getCorrectness
7
- * G1. No session → unanswered
8
- * G2. No choiceId → unanswered
9
- * G3. Correct choice selected → correct
10
- * G4. Wrong choice selected → incorrect
11
- *
12
- * outcome
13
- * O1. Empty session → score 0, empty: true
14
- * O2. No choiceId → score 0, empty: true
15
- * O3. Correct choice → score 1, empty: false
16
- * O4. Wrong choice → score 0, empty: false
17
- * O5. traceLog includes mode, selected id, correct id, final score
18
- *
19
- * model — choice ordering
20
- * M1. shuffle=false → original order preserved
21
- * M2. shuffle=true, instructor role → original order locked
22
- * M3. shuffle=true, lockChoiceOrder=true → original order locked
23
- * M4. shuffle=true, stored shuffle in session.data.shuffledValues → restored
24
- * M5. shuffle=true, stored shuffle in session.shuffledValues (legacy) → restored
25
- * M6. shuffle=true, stored shuffle has unknown ids → extras appended at end
26
- * M7. shuffle=true, no stored shuffle → shuffled; updateSession called with new order
27
- * M8. shuffle=true, no stored shuffle, no updateSession → shuffled silently (no throw)
28
- *
29
- * model — output fields
30
- * M9. evaluate mode → correctness, responseCorrect, correctChoiceId present
31
- * M10. gather mode → correctness fields absent
32
- * M11. instructor + view mode → teacherInstructions included when enabled
33
- * M12. student role → teacherInstructions always null
34
- * M13. prompt included when promptEnabled=true
35
- * M14. prompt null when promptEnabled=false
36
- * M15. audioUrl null when hasAudio=false
37
- * M16. audioUrl passed through when hasAudio=true
38
- * M17. disabled=true in view/evaluate mode, false in gather
39
- *
40
- * validate
41
- * V1. Valid question → empty errors object
42
- * V2. promptEnabled + empty prompt → prompt error
43
- * V3. populate_blank with no blank token → template error
44
- * V4. populate_blank with two blank tokens → template error
45
- * V5. audio_mc_only with a blank token → template error
46
- * V6. Unknown interactionMode → interactionMode error
47
- * V7. Fewer than two choices → choices error
48
- * V8. Choice missing id → choices error
49
- * V9. Text mode choice missing labelHtml → choices error
50
- * V10. Image mode choice missing imageUrl → choices error
51
- * V11. Image mode choice missing imageAlt → choices error
52
- * V12. correctChoiceId not in choices → correctChoiceId error
53
- * V13. hasAudio=true with no audioUrl → audioUrl error
54
- * V14. layoutLimits with a non-positive value → layoutLimits error
55
- * V15. layoutLimits with a valid value → no error
56
- *
57
- * createCorrectResponseSession
58
- * CR1. Instructor + mode≠evaluate → session with correct choiceId
59
- * CR2. Student role → null
60
- * CR3. Evaluate mode → null
61
- */
62
- export {};
63
- //# sourceMappingURL=index.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/controller/index.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=AudioPlayer.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AudioPlayer.test.d.ts","sourceRoot":"","sources":["../../src/delivery/AudioPlayer.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ChoiceRow.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChoiceRow.test.d.ts","sourceRoot":"","sources":["../../src/delivery/ChoiceRow.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ClozeMarker.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ClozeMarker.test.d.ts","sourceRoot":"","sources":["../../src/delivery/ClozeMarker.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=McPopulatedBlank.transcript.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"McPopulatedBlank.transcript.test.d.ts","sourceRoot":"","sources":["../../src/delivery/McPopulatedBlank.transcript.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=computeAudioMode.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"computeAudioMode.test.d.ts","sourceRoot":"","sources":["../../src/delivery/computeAudioMode.test.ts"],"names":[],"mappings":""}
@@ -1,19 +0,0 @@
1
- /**
2
- * Unit tests for computeChoiceCorrectness.
3
- *
4
- * This is the harness for extracting the choiceCorrectnessById state machine
5
- * from McPopulatedBlank.svelte. The function takes five pure inputs and returns
6
- * a Map — no component rendering required.
7
- *
8
- * Cases:
9
- * C1. Not evaluate mode → empty map
10
- * C2. Evaluate mode, no correctChoiceId → empty map
11
- * C3. Reveal active, student chose correctly → { correctId: 'correct' } only
12
- * C4. Reveal active, student chose wrong → { correctId: 'correct' } only (student badge suppressed)
13
- * C5. Evaluate, unanswered → { correctId: 'incorrect' }
14
- * C6. Evaluate, student chose correctly → { correctId: 'correct' }
15
- * C7. Evaluate, student chose wrong → { studentId: 'incorrect', correctId: 'incorrect' }
16
- * C8. Empty-string ids treated as "no selection" → C5 path, not C7
17
- */
18
- export {};
19
- //# sourceMappingURL=computeChoiceCorrectness.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"computeChoiceCorrectness.test.d.ts","sourceRoot":"","sources":["../../src/delivery/computeChoiceCorrectness.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG"}
@@ -1,38 +0,0 @@
1
- /**
2
- * Unit tests for computeDisplayState.
3
- *
4
- * computeFeatureAudioSkin
5
- * A1. No locale, no overrides → default English skin
6
- * A2. Spanish locale (es-MX) → built-in es skin
7
- * A3. Exact locale match in byLocale → that skin
8
- * A4. No exact match, lang prefix match (es) → lang skin
9
- * A5. byLocale.default when no locale/lang match → byLocale.default skin
10
- * A6. customSingle fallback when byLocale empty → customSingle
11
- * A7. byLocale.default wins over customSingle
12
- *
13
- * computeDisplayChoiceId
14
- * D1. Normal gather: returns selectedId
15
- * D2. alwaysShowCorrect=true: returns correctChoiceId regardless
16
- * D3. alwaysShowCorrect=true, no correctChoiceId: returns selectedId
17
- * D4. evaluate + showCorrectAnswer=true: returns correctChoiceId
18
- * D5. evaluate + showCorrectAnswer=false: returns selectedId
19
- * D6. Not evaluate + showCorrectAnswer=true: returns selectedId (not overridden outside evaluate)
20
- *
21
- * computeResultText
22
- * R1. Not evaluate mode → empty string
23
- * R2. Evaluate + showCorrectAnswer=true → empty string (suppressed while reveal active)
24
- * R3. Evaluate + correct → 'Correct answer selected'
25
- * R4. Evaluate + incorrect + has selection → 'Incorrect answer selected'
26
- * R5. Evaluate + incorrect + no selection → empty string (unanswered, no message)
27
- * R6. Evaluate + unanswered (not correct, not incorrect) → empty string
28
- *
29
- * computeLegendText
30
- * L1. Plain text prompt under limit → prompt text as-is
31
- * L2. HTML prompt → tags stripped
32
- * L3. Prompt over legendMaxChars → truncated with ellipsis
33
- * L4. Empty prompt → answerChoicesLabel fallback
34
- * L5. legendMaxChars < 8 → clamped to 8 before truncation
35
- * L6. Whitespace-only prompt (after strip) → fallback
36
- */
37
- export {};
38
- //# sourceMappingURL=computeDisplayState.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"computeDisplayState.test.d.ts","sourceRoot":"","sources":["../../src/delivery/computeDisplayState.test.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=computeLayoutProfile.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"computeLayoutProfile.test.d.ts","sourceRoot":"","sources":["../../src/delivery/computeLayoutProfile.test.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=computeLayoutStyle.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"computeLayoutStyle.test.d.ts","sourceRoot":"","sources":["../../src/delivery/computeLayoutStyle.test.ts"],"names":[],"mappings":""}
@@ -1,41 +0,0 @@
1
- <svelte:options
2
- customElement={{
3
- shadow: 'none',
4
- props: {
5
- model: { type: 'Object' },
6
- },
7
- }}
8
- />
9
-
10
- <script lang="ts">
11
- // Keep the same prop shape expected by the wrapper.
12
- let { model = $bindable(), onChange }: { model?: any; onChange?: (model: any) => void } = $props();
13
- </script>
14
-
15
- <div class="mc-populated-blank-author-placeholder" role="status" aria-live="polite">
16
- <p class="title">Author view placeholder</p>
17
- <p class="body">This authoring interface is a placeholder and will be implemented later.</p>
18
- </div>
19
-
20
- <style>
21
- .mc-populated-blank-author-placeholder {
22
- max-width: 56rem;
23
- margin: 24px auto;
24
- padding: 20px;
25
- border: 1px dashed #cbd5e1;
26
- border-radius: 8px;
27
- background: #f8fafc;
28
- color: #334155;
29
- }
30
-
31
- .title {
32
- margin: 0 0 8px;
33
- font-size: 1rem;
34
- font-weight: 600;
35
- }
36
-
37
- .body {
38
- margin: 0;
39
- font-size: 0.9rem;
40
- }
41
- </style>
@@ -1,28 +0,0 @@
1
- import AuthorComponent from './Author.svelte';
2
-
3
- const SvelteElementClass = (AuthorComponent as any).element;
4
-
5
- class McPopulatedBlankAuthor extends SvelteElementClass {
6
- private _model: any = null;
7
- private _onChange: ((model: any) => void) | null = null;
8
-
9
- set model(m: any) {
10
- this._model = m;
11
- super.model = m;
12
- }
13
-
14
- get model() {
15
- return this._model;
16
- }
17
-
18
- set onChange(fn: (model: any) => void) {
19
- this._onChange = fn;
20
- (this as any).onChange = fn;
21
- }
22
-
23
- get onChange() {
24
- return this._onChange || (() => {});
25
- }
26
- }
27
-
28
- export default McPopulatedBlankAuthor;
@@ -1,61 +0,0 @@
1
- import { DEFAULT_LAYOUT_LIMITS } from '../shared/layoutLimits';
2
-
3
- export { DEFAULT_LAYOUT_LIMITS };
4
-
5
- /** Token authors must include exactly once in `template` (HTML). */
6
- export const BLANK_TOKEN = '{{blank}}';
7
-
8
- export default {
9
- model: {
10
- id: '1',
11
- element: 'mc-populated-blank',
12
- prompt: '<p><strong>Demo prompt</strong></p>',
13
- promptEnabled: true,
14
- interactionMode: 'populate_blank' as const,
15
- layoutProfile: '',
16
- choiceLayout: '',
17
- layoutProfilePresets: {},
18
- layoutLimits: { ...DEFAULT_LAYOUT_LIMITS },
19
- audioButtonSkin: null,
20
- audioButtonSkinsByLocale: {},
21
- uiText: {
22
- answerChoices: 'Answer choices',
23
- selectedAnswerInSentence: 'blank',
24
- showCorrectAnswer: 'Show correct answer',
25
- hideCorrectAnswer: 'Hide correct answer',
26
- clickToEnableAutoplay: 'Click to enable audio autoplay',
27
- audioResourceUnavailable: 'Audio is enabled but no playable audio URL is configured.',
28
- transcriptLabel: 'Transcript',
29
- listenLabelEn: 'Listen',
30
- listenLabelEs: 'Escuchar',
31
- listenSilentAlt: 'Repeat instructions',
32
- listenPlayingAlt: 'Instructions are playing',
33
- listenSilentAltEs: 'Escuchar. Repetir las instrucciones.',
34
- listenPlayingAltEs: 'Escuchar. Estas son las instrucciones.',
35
- },
36
- sentenceHtml: '',
37
- template: `<p>The answer is ${BLANK_TOKEN}.</p>`,
38
- choiceMode: 'text' as const,
39
- choices: [
40
- { id: 'c1', labelHtml: '<p>Option A</p>' },
41
- { id: 'c2', labelHtml: '<p>Option B</p>' },
42
- { id: 'c3', labelHtml: '<p>Option C</p>' },
43
- ],
44
- correctChoiceId: 'c2',
45
- hasAudio: false,
46
- autoplayAudioEnabled: false,
47
- completeAudioEnabled: false,
48
- audioUrl: '',
49
- audioTranscript: '',
50
- showVisibleTranscript: false,
51
- locale: '',
52
- teacherInstructions: '',
53
- teacherInstructionsEnabled: false,
54
- },
55
- configuration: {
56
- prompt: {
57
- label: 'Prompt',
58
- settings: true,
59
- },
60
- },
61
- };