@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
@@ -1,95 +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
- const BLANK_TOKEN = '{{blank}}';
12
-
13
- let { model = null }: { model?: any } = $props();
14
-
15
- let prompt = $state('');
16
- let template = $state('');
17
- $effect(() => {
18
- prompt = model?.prompt || '';
19
- template = model?.template || '';
20
- });
21
-
22
- const parts = $derived.by(() => {
23
- const idx = template.indexOf(BLANK_TOKEN);
24
- if (idx < 0) return { before: template, after: '' };
25
- return { before: template.slice(0, idx), after: template.slice(idx + BLANK_TOKEN.length) };
26
- });
27
-
28
- const choices = $derived(Array.isArray(model?.choices) ? model.choices : []);
29
- const correct = $derived(model?.choices?.find((c: any) => c.id === model?.correctChoiceId));
30
- const mode = $derived(model?.choiceMode || 'text');
31
- const isAudioOnlyMode = $derived(model?.interactionMode === 'audio_mc_only');
32
- const showAnswerKey = $derived(model?.printAnswerKey !== false);
33
- </script>
34
-
35
- <div class="p-4 print:p-0">
36
- {#if prompt && model?.promptEnabled !== false}
37
- <div class="mb-4 prose prose-sm">{@html prompt}</div>
38
- {/if}
39
-
40
- {#if model?.sentenceHtml}
41
- <div class="mb-2 prose prose-sm">{@html model.sentenceHtml}</div>
42
- {/if}
43
-
44
- {#if !isAudioOnlyMode}
45
- <div class="mb-4 prose prose-sm">
46
- {@html parts.before}
47
- <span class="inline-block min-w-[6rem] border-b-2 border-gray-600 print:border-black px-1">
48
- {#if showAnswerKey && mode === 'image' && correct?.imageUrl}
49
- <img src={correct.imageUrl} alt={correct.imageAlt || ''} class="max-h-14 object-contain" />
50
- {:else if showAnswerKey && correct?.labelHtml}
51
- {@html correct.labelHtml}
52
- {:else}
53
- ________
54
- {/if}
55
- </span>
56
- {@html parts.after}
57
- </div>
58
- {/if}
59
-
60
- {#if model?.hasAudio}
61
- <div class="text-sm mb-4">
62
- {#if model?.audioUrl}
63
- <div><strong>Audio:</strong> {model.audioUrl}</div>
64
- {/if}
65
- {#if model?.audioTranscript}
66
- <div><strong>Transcript:</strong> {model.audioTranscript}</div>
67
- {/if}
68
- </div>
69
- {/if}
70
-
71
- <ul class="text-sm list-disc pl-5">
72
- {#each choices as c}
73
- <li>
74
- {#if mode === 'image'}
75
- <span class="font-medium">{c.id}</span>
76
- {#if showAnswerKey && c.id === model?.correctChoiceId}(key){/if}
77
- {:else}
78
- {@html c.labelHtml || ''}
79
- {#if showAnswerKey && c.id === model?.correctChoiceId}
80
- <span class="font-medium"> (key)</span>
81
- {/if}
82
- {/if}
83
- </li>
84
- {/each}
85
- </ul>
86
- </div>
87
-
88
- <style>
89
- .prose :global(p) {
90
- margin: 0.5em 0;
91
- }
92
- .prose :global(strong) {
93
- font-weight: 600;
94
- }
95
- </style>
@@ -1,18 +0,0 @@
1
- import PrintComponent from './Print.svelte';
2
-
3
- const SvelteElementClass = (PrintComponent as any).element;
4
-
5
- class McPopulatedBlankPrint extends SvelteElementClass {
6
- private _model: any = null;
7
-
8
- set model(m: any) {
9
- this._model = m;
10
- super.model = m;
11
- }
12
-
13
- get model() {
14
- return this._model;
15
- }
16
- }
17
-
18
- export default McPopulatedBlankPrint;
@@ -1,76 +0,0 @@
1
- export type LayoutLimits = {
2
- blankStandaloneWidthRem: number;
3
- blankWideWidthRem: number;
4
- blankUnderlineWidthPx: number;
5
- blankUnderlineWideWidthPx: number;
6
- horizontalChoiceWidthPx: number;
7
- horizontalChoiceWidthVw: number;
8
- horizontalChoiceTileMinHeightRem: number;
9
- horizontalChoiceContentMinHeightRem: number;
10
- selectedImageMaxHeightRem: number;
11
- choiceImageMaxHeightRem: number;
12
- listenButtonSizePx: number;
13
- stimulusMinColumnPx: number;
14
- textMinColumnPx: number;
15
- legendMaxChars: number;
16
- choiceGroupGapRem: number;
17
- choiceRowGapRem: number;
18
- toggleButtonGapRem: number;
19
- horizontalChoiceRadioTopMarginRem: number;
20
- audioBlankTemplateMarginTopRem: number;
21
- audioBlankTemplateMarginBottomRem: number;
22
- audioInstructionsMaxWidthPx: number;
23
- narrowHorizontalChoiceMaxWidthPx: number;
24
- stimulusGridColumnGapRem: number;
25
- stimulusGridRowGapRem: number;
26
- stimulusSentenceMarginTopRem: number;
27
- stimulusChoicesMarginTopRem: number;
28
- tokenGridColumnGapRem: number;
29
- tokenGridRowGapRem: number;
30
- tokenTemplateMarginTopRem: number;
31
- tokenInlineTokenGapRem: number;
32
- tokenChoicesMarginTopRem: number;
33
- inlineGridColumnGapRem: number;
34
- inlineGridRowGapRem: number;
35
- inlineTemplateMarginTopRem: number;
36
- inlineChoicesMarginTopRem: number;
37
- };
38
-
39
- /** Baseline values tuned to match historical CQT visuals; override via model.layoutLimits. */
40
- export const DEFAULT_LAYOUT_LIMITS: LayoutLimits = {
41
- blankStandaloneWidthRem: 7,
42
- blankWideWidthRem: 10,
43
- blankUnderlineWidthPx: 2,
44
- blankUnderlineWideWidthPx: 4,
45
- horizontalChoiceWidthPx: 170,
46
- horizontalChoiceWidthVw: 30,
47
- horizontalChoiceTileMinHeightRem: 11,
48
- horizontalChoiceContentMinHeightRem: 7.5,
49
- selectedImageMaxHeightRem: 4,
50
- choiceImageMaxHeightRem: 5,
51
- listenButtonSizePx: 128,
52
- stimulusMinColumnPx: 210,
53
- textMinColumnPx: 260,
54
- legendMaxChars: 120,
55
- choiceGroupGapRem: 0.5,
56
- choiceRowGapRem: 0.5,
57
- toggleButtonGapRem: 0.5,
58
- horizontalChoiceRadioTopMarginRem: 0.5,
59
- audioBlankTemplateMarginTopRem: 0.8,
60
- audioBlankTemplateMarginBottomRem: 1.8,
61
- audioInstructionsMaxWidthPx: 875,
62
- narrowHorizontalChoiceMaxWidthPx: 230,
63
- stimulusGridColumnGapRem: 2,
64
- stimulusGridRowGapRem: 0.7,
65
- stimulusSentenceMarginTopRem: 0.2,
66
- stimulusChoicesMarginTopRem: 0.9,
67
- tokenGridColumnGapRem: 1.5,
68
- tokenGridRowGapRem: 0.8,
69
- tokenTemplateMarginTopRem: 0.6,
70
- tokenInlineTokenGapRem: 0.35,
71
- tokenChoicesMarginTopRem: 0.2,
72
- inlineGridColumnGapRem: 1.5,
73
- inlineGridRowGapRem: 0.65,
74
- inlineTemplateMarginTopRem: 0.45,
75
- inlineChoicesMarginTopRem: 0.25,
76
- };
@@ -1,84 +0,0 @@
1
- import type { LayoutLimits } from './layoutLimits';
2
-
3
- export type McpbChoiceMode = 'text' | 'image';
4
- export type McpbInteractionMode = 'populate_blank' | 'audio_mc_only';
5
- export type McpbDeliveryMode = 'gather' | 'view' | 'evaluate' | 'authoring' | 'print';
6
- export type McpbRole = 'student' | 'instructor';
7
- export type McpbCorrectness = 'correct' | 'incorrect' | 'unanswered';
8
-
9
- export interface McpbChoice {
10
- id: string;
11
- labelHtml?: string;
12
- imageUrl?: string;
13
- imageAlt?: string;
14
- }
15
-
16
- export interface McpbAudioButtonSkin {
17
- silentUrl: string;
18
- playingUrl: string;
19
- }
20
-
21
- export interface McpbUiText {
22
- answerChoices?: string;
23
- selectedAnswerInSentence?: string;
24
- showCorrectAnswer?: string;
25
- hideCorrectAnswer?: string;
26
- clickToEnableAutoplay?: string;
27
- audioResourceUnavailable?: string;
28
- transcriptLabel?: string;
29
- listenLabelEn?: string;
30
- listenLabelEs?: string;
31
- listenSilentAlt?: string;
32
- listenPlayingAlt?: string;
33
- listenSilentAltEs?: string;
34
- listenPlayingAltEs?: string;
35
- }
36
-
37
- export interface McpbQuestion {
38
- id?: string;
39
- element?: string;
40
- prompt?: string;
41
- promptEnabled?: boolean;
42
- interactionMode?: McpbInteractionMode;
43
- layoutProfile?: string;
44
- choiceLayout?: string;
45
- layoutProfilePresets?: Record<string, Partial<LayoutLimits>>;
46
- layoutLimits?: Partial<LayoutLimits>;
47
- audioButtonSkin?: McpbAudioButtonSkin | null;
48
- audioButtonSkinsByLocale?: Record<string, McpbAudioButtonSkin>;
49
- uiText?: McpbUiText;
50
- sentenceHtml?: string;
51
- template?: string;
52
- choiceMode?: McpbChoiceMode;
53
- choices?: McpbChoice[];
54
- correctChoiceId?: string;
55
- hasAudio?: boolean;
56
- autoplayAudioEnabled?: boolean;
57
- completeAudioEnabled?: boolean;
58
- audioUrl?: string;
59
- audioTranscript?: string;
60
- showVisibleTranscript?: boolean;
61
- useFeatureButtonAudio?: boolean;
62
- locale?: string;
63
- shuffle?: boolean;
64
- lockChoiceOrder?: boolean;
65
- teacherInstructions?: string;
66
- teacherInstructionsEnabled?: boolean;
67
- customType?: string;
68
- }
69
-
70
- export interface McpbSession {
71
- id?: string;
72
- element?: string;
73
- choiceId?: string;
74
- audioStartTime?: number;
75
- audioEndTime?: number;
76
- shuffledValues?: string[];
77
- data?: { shuffledValues?: string[] };
78
- }
79
-
80
- export interface McpbEnv {
81
- mode?: McpbDeliveryMode;
82
- role?: McpbRole;
83
- '@pie-element'?: { lockChoiceOrder?: boolean };
84
- }
@@ -1,4 +0,0 @@
1
- declare module '*.css?raw' {
2
- const css: string;
3
- export default css;
4
- }