@pie-element/mc-populated-blank 0.2.10 → 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 (55) hide show
  1. package/README.md +0 -2
  2. package/dist/author/index.js +186 -152
  3. package/dist/author/index.js.map +1 -1
  4. package/dist/controller/defaults.d.ts +41 -73
  5. package/dist/controller/defaults.d.ts.map +1 -1
  6. package/dist/controller/index.d.ts +154 -10
  7. package/dist/controller/index.d.ts.map +1 -1
  8. package/dist/controller/index.js +29 -30
  9. package/dist/controller/index.js.map +1 -1
  10. package/dist/delivery/computeAudioMode.d.ts +7 -0
  11. package/dist/delivery/computeAudioMode.d.ts.map +1 -0
  12. package/dist/delivery/computeChoiceCorrectness.d.ts +18 -0
  13. package/dist/delivery/computeChoiceCorrectness.d.ts.map +1 -0
  14. package/dist/delivery/computeDisplayState.d.ts +47 -0
  15. package/dist/delivery/computeDisplayState.d.ts.map +1 -0
  16. package/dist/delivery/computeLayoutProfile.d.ts +18 -0
  17. package/dist/delivery/computeLayoutProfile.d.ts.map +1 -0
  18. package/dist/delivery/computeLayoutStyle.d.ts +27 -0
  19. package/dist/delivery/computeLayoutStyle.d.ts.map +1 -0
  20. package/dist/delivery/index.d.ts.map +1 -1
  21. package/dist/delivery/index.js +1591 -927
  22. package/dist/delivery/index.js.map +1 -1
  23. package/dist/delivery/variant-css-map.d.ts.map +1 -1
  24. package/dist/index.iife.d.ts +151 -10
  25. package/dist/index.iife.d.ts.map +1 -1
  26. package/dist/index.iife.js +233 -114
  27. package/dist/index.js +1591 -927
  28. package/dist/index.js.map +1 -1
  29. package/dist/print/index.js +194 -166
  30. package/dist/print/index.js.map +1 -1
  31. package/dist/shared/layoutLimits.d.ts +40 -0
  32. package/dist/shared/layoutLimits.d.ts.map +1 -0
  33. package/dist/shared/types.d.ts +82 -0
  34. package/dist/shared/types.d.ts.map +1 -0
  35. package/package.json +5 -14
  36. package/src/author/Author.svelte +0 -41
  37. package/src/author/index.ts +0 -28
  38. package/src/controller/defaults.ts +0 -91
  39. package/src/controller/index.ts +0 -359
  40. package/src/delivery/McPopulatedBlank.svelte +0 -1246
  41. package/src/delivery/cqt-css/sel-r1-g-stem.css +0 -29
  42. package/src/delivery/cqt-css/sel-r1-gg-plus.css +0 -29
  43. package/src/delivery/cqt-css/sel-r1-ggplus.css +0 -34
  44. package/src/delivery/cqt-css/sel-r1-gplusggg.css +0 -20
  45. package/src/delivery/cqt-css/sel-r1-plusggg.css +0 -20
  46. package/src/delivery/cqt-css/sel-r1-s3.css +0 -91
  47. package/src/delivery/cqt-css/sel-vic.css +0 -38
  48. package/src/delivery/cqt-css/sr-vic.css +0 -14
  49. package/src/delivery/index.ts +0 -103
  50. package/src/delivery/variant-css-map.ts +0 -110
  51. package/src/index.iife.ts +0 -13
  52. package/src/index.ts +0 -1
  53. package/src/print/Print.svelte +0 -95
  54. package/src/print/index.ts +0 -18
  55. package/src/types/css-raw.d.ts +0 -4
@@ -1,29 +0,0 @@
1
- /* Source baseline: https://global-pr-ibvcustomfiles.renaissance-go.com/learnosity/sel_r1-g_plusggg/0.0.1/question.css */
2
- .mc-populated-blank-root.variant-sel-r1-g-stem {
3
- font-family: Starial, Arial, sans-serif;
4
- max-width: 875px;
5
- margin-inline: auto;
6
- --mpb-listen-button-size: 128px;
7
- --mpb-choice-width-px: 155px;
8
- --mpb-choice-tile-min-height: 11.25rem;
9
- --mpb-choice-content-min-height: 9.375rem;
10
- --pie-correct-answer-choice-hover-bg: #e2e2e2;
11
- --pie-correct-answer-choice-selected-bg: #fcfcd3;
12
- }
13
-
14
- .mc-populated-blank-root.variant-sel-r1-g-stem .pie-audio-transcript {
15
- font-family: Roboto, Arial, sans-serif;
16
- font-size: 16px;
17
- font-style: normal;
18
- font-weight: 400;
19
- }
20
-
21
- .mc-populated-blank-root.variant-sel-r1-g-stem .pie-choice-label {
22
- font-size: 1.9em;
23
- line-height: 89px;
24
- }
25
-
26
- .mc-populated-blank-root.variant-sel-r1-g-stem.layout-token_sequence {
27
- grid-template-columns: minmax(260px, auto) auto;
28
- justify-content: center;
29
- }
@@ -1,29 +0,0 @@
1
- /* Source baseline: https://global-pr-ibvcustomfiles.renaissance-go.com/learnosity/sel_r1-gg_plusggg/0.0.1/question.css */
2
- .mc-populated-blank-root.variant-sel-r1-gg-plus {
3
- font-family: Starial, Arial, sans-serif;
4
- max-width: 875px;
5
- margin-inline: auto;
6
- --mpb-listen-button-size: 128px;
7
- --mpb-choice-width-px: 155px;
8
- --mpb-choice-tile-min-height: 11.25rem;
9
- --mpb-choice-content-min-height: 9.375rem;
10
- --pie-correct-answer-choice-hover-bg: #e2e2e2;
11
- --pie-correct-answer-choice-selected-bg: #fcfcd3;
12
- }
13
-
14
- .mc-populated-blank-root.variant-sel-r1-gg-plus .pie-audio-transcript {
15
- font-family: Roboto, Arial, sans-serif;
16
- font-size: 16px;
17
- font-style: normal;
18
- font-weight: 400;
19
- }
20
-
21
- .mc-populated-blank-root.variant-sel-r1-gg-plus .pie-choice-label {
22
- font-size: 1.9em;
23
- line-height: 89px;
24
- }
25
-
26
- .mc-populated-blank-root.variant-sel-r1-gg-plus.layout-token_sequence {
27
- grid-template-columns: minmax(260px, auto) auto;
28
- justify-content: center;
29
- }
@@ -1,34 +0,0 @@
1
- /* Source baseline: https://global-pr-ibvcustomfiles.renaissance-go.com/learnosity/sel_r1-_ggplusggg/0.0.1/question.css */
2
- .mc-populated-blank-root.variant-sel-r1-ggplus {
3
- font-family: Starial, Arial, sans-serif;
4
- max-width: 875px;
5
- margin-inline: auto;
6
- --mpb-listen-button-size: 128px;
7
- --mpb-choice-width-px: 155px;
8
- --mpb-choice-tile-min-height: 11.25rem;
9
- --mpb-choice-content-min-height: 9.375rem;
10
- --pie-correct-answer-choice-hover-bg: #e2e2e2;
11
- --pie-correct-answer-choice-selected-bg: #fcfcd3;
12
- }
13
-
14
- .mc-populated-blank-root.variant-sel-r1-ggplus .pie-audio-transcript {
15
- font-family: Roboto, Arial, sans-serif;
16
- font-size: 16px;
17
- font-style: normal;
18
- font-weight: 400;
19
- }
20
-
21
- .mc-populated-blank-root.variant-sel-r1-ggplus .pie-choice-label {
22
- font-size: 1.9em;
23
- line-height: 89px;
24
- }
25
-
26
- .mc-populated-blank-root.variant-sel-r1-ggplus.layout-token_sequence {
27
- grid-template-columns: minmax(260px, auto) auto;
28
- justify-content: center;
29
- }
30
-
31
- /* In this variant, the blank appears before trailing tokens; avoid offsetting it. */
32
- .mc-populated-blank-root.variant-sel-r1-ggplus.layout-token_sequence .pie-blank-slot {
33
- margin-left: 0;
34
- }
@@ -1,20 +0,0 @@
1
- /* Source baseline: https://global-pr-ibvcustomfiles.renaissance-go.com/learnosity/sel_r1-_gplusggg/0.0.1/question.css */
2
- .mc-populated-blank-root.variant-sel-r1-gplusggg {
3
- font-family: Starial, Arial, sans-serif;
4
- --mpb-listen-button-size: 128px;
5
- --mpb-choice-width-px: 155px;
6
- --mpb-choice-tile-min-height: 11.25rem;
7
- --mpb-choice-content-min-height: 9.375rem;
8
- }
9
-
10
- .mc-populated-blank-root.variant-sel-r1-gplusggg .pie-audio-transcript {
11
- font-family: Roboto, Arial, sans-serif;
12
- font-size: 16px;
13
- font-style: normal;
14
- font-weight: 400;
15
- }
16
-
17
- .mc-populated-blank-root.variant-sel-r1-gplusggg .pie-choice-label {
18
- font-size: 1.9em;
19
- line-height: 89px;
20
- }
@@ -1,20 +0,0 @@
1
- /* Source baseline: https://global-pr-ibvcustomfiles.renaissance-go.com/learnosity/sel_r1-_plusggg/0.0.1/question.css */
2
- .mc-populated-blank-root.variant-sel-r1-plusggg {
3
- font-family: Starial, Arial, sans-serif;
4
- --mpb-listen-button-size: 128px;
5
- --mpb-choice-width-px: 155px;
6
- --mpb-choice-tile-min-height: 11.25rem;
7
- --mpb-choice-content-min-height: 9.375rem;
8
- }
9
-
10
- .mc-populated-blank-root.variant-sel-r1-plusggg .pie-audio-transcript {
11
- font-family: Roboto, Arial, sans-serif;
12
- font-size: 16px;
13
- font-style: normal;
14
- font-weight: 400;
15
- }
16
-
17
- .mc-populated-blank-root.variant-sel-r1-plusggg .pie-choice-label {
18
- font-size: 1.9em;
19
- line-height: 89px;
20
- }
@@ -1,91 +0,0 @@
1
- /* Source baseline: https://global-pr-ibvcustomfiles.renaissance-go.com/learnosity/sel_r1-s3_plusggg/0.0.1/question.css */
2
- .mc-populated-blank-root.variant-sel-r1-s3 {
3
- font-family: Starial, Arial, sans-serif;
4
- max-width: 860px;
5
- margin-inline: auto;
6
- --mpb-listen-button-size: 128px;
7
- --mpb-choice-width-px: 155px;
8
- --mpb-choice-tile-min-height: 11.25rem;
9
- --mpb-choice-content-min-height: 9.375rem;
10
- --mpb-choice-group-gap: 0.35rem;
11
- --mpb-choice-row-gap: 0.35rem;
12
- --mpb-horizontal-choice-radio-top-margin: 0.25rem;
13
- --mpb-stimulus-min-column: 240px;
14
- --mpb-stimulus-grid-column-gap: 1.1rem;
15
- --mpb-stimulus-choices-margin-top: 0.85rem;
16
- --mpb-audio-blank-template-margin-bottom: 0.9rem;
17
- --mpb-blank-wide-width: 6.8rem;
18
- }
19
-
20
- .mc-populated-blank-root.variant-sel-r1-s3 .pie-audio-transcript {
21
- font-family: Roboto, Arial, sans-serif;
22
- font-size: 16px;
23
- font-style: normal;
24
- font-weight: 400;
25
- }
26
-
27
- .mc-populated-blank-root.variant-sel-r1-s3 .pie-choice-label,
28
- .mc-populated-blank-root.variant-sel-r1-s3 .pie-choice-label :is(span, p, div) {
29
- font-size: 1.9em;
30
- line-height: 89px;
31
- font-weight: 500;
32
- }
33
-
34
- .mc-populated-blank-root.variant-sel-r1-s3 .pie-blank-value,
35
- .mc-populated-blank-root.variant-sel-r1-s3 .pie-blank-value :is(span, p, div) {
36
- font-size: 1.9em;
37
- line-height: 1.1;
38
- white-space: nowrap;
39
- }
40
-
41
- .mc-populated-blank-root.variant-sel-r1-s3 .pie-choice-horizontal .pie-choice-tile {
42
- border-radius: 6px;
43
- background: #f1f1f1;
44
- }
45
-
46
- .mc-populated-blank-root.variant-sel-r1-s3.layout-stimulus_image_blank {
47
- grid-template-columns: minmax(220px, auto) auto auto;
48
- grid-template-areas:
49
- "sentence template audio"
50
- "choices choices choices";
51
- justify-content: center;
52
- }
53
-
54
- .mc-populated-blank-root.variant-sel-r1-s3.layout-stimulus_image_blank .pie-template-line {
55
- grid-area: template;
56
- justify-self: center;
57
- }
58
-
59
- .mc-populated-blank-root.variant-sel-r1-s3.layout-stimulus_image_blank .pie-sentence-line {
60
- justify-self: end;
61
- }
62
-
63
- .mc-populated-blank-root.variant-sel-r1-s3.layout-stimulus_image_blank .pie-audio-container {
64
- justify-self: start;
65
- align-self: start;
66
- }
67
-
68
- .mc-populated-blank-root.variant-sel-r1-s3.layout-stimulus_image_blank .pie-choices-fieldset {
69
- justify-self: center;
70
- width: fit-content;
71
- }
72
-
73
- .mc-populated-blank-root.variant-sel-r1-s3 .pie-sentence-line img {
74
- max-width: 100%;
75
- height: auto;
76
- }
77
-
78
- .mc-populated-blank-root.variant-sel-r1-s3 .pie-choice-horizontal:hover .pie-choice-tile {
79
- background: #e2e2e2;
80
- }
81
-
82
- .mc-populated-blank-root.variant-sel-r1-s3 .pie-choice-horizontal.is-selected .pie-choice-tile,
83
- .mc-populated-blank-root.variant-sel-r1-s3
84
- .pie-choice-horizontal.is-selected:hover
85
- .pie-choice-tile {
86
- background: #fcfcd3;
87
- }
88
-
89
- .mc-populated-blank-root.variant-sel-r1-s3 .pie-choice-horizontal .pie-choice-radio {
90
- transform: scale(0.85);
91
- }
@@ -1,38 +0,0 @@
1
- /* Source baseline: https://global-pr-ibvcustomfiles.renaissance-go.com/learnosity/sel_vic/0.0.1/question.css */
2
- .mc-populated-blank-root.variant-sel-vic {
3
- font-family: Starial, Arial, sans-serif;
4
- font-size: 1.5em;
5
- max-width: 800px;
6
- margin-inline: auto;
7
- --mpb-inline-grid-column-gap: 1rem;
8
- --mpb-inline-grid-row-gap: 0.5rem;
9
- --mpb-inline-template-margin-top: 0.2rem;
10
- --mpb-inline-choices-margin-top: 0.2rem;
11
- --pie-correct-answer-choice-hover-bg: #e2e2e2;
12
- --pie-correct-answer-choice-selected-bg: #fcfcd3;
13
- }
14
-
15
- .mc-populated-blank-root.variant-sel-vic .pie-audio-transcript {
16
- font-family: Roboto, Arial, sans-serif;
17
- font-size: 16px;
18
- font-style: normal;
19
- font-weight: 400;
20
- }
21
-
22
- .mc-populated-blank-root.variant-sel-vic .pie-template-line,
23
- .mc-populated-blank-root.variant-sel-vic .pie-blank-value,
24
- .mc-populated-blank-root.variant-sel-vic .pie-choice-label {
25
- line-height: 123%;
26
- }
27
-
28
- .mc-populated-blank-root.variant-sel-vic .pie-audio-container {
29
- min-height: 128px;
30
- }
31
-
32
- @media (min-width: 620px) {
33
- .mc-populated-blank-root.variant-sel-vic .pie-audio-transcript {
34
- min-width: 620px;
35
- max-width: 800px;
36
- transform: translateX(-55px);
37
- }
38
- }
@@ -1,14 +0,0 @@
1
- /* Source baseline: https://global-pr-ibvcustomfiles.renaissance-go.com/learnosity/sr-vic/0.0.1/question.css */
2
- .mc-populated-blank-root.variant-sr-vic {
3
- font-family: Starial, Arial, sans-serif;
4
- --mpb-inline-grid-column-gap: 1rem;
5
- --mpb-inline-grid-row-gap: 0.5rem;
6
- --mpb-inline-template-margin-top: 0.2rem;
7
- --mpb-inline-choices-margin-top: 0.2rem;
8
- }
9
-
10
- .mc-populated-blank-root.variant-sr-vic .pie-template-line,
11
- .mc-populated-blank-root.variant-sr-vic .pie-blank-value,
12
- .mc-populated-blank-root.variant-sr-vic .pie-choice-label {
13
- line-height: 123%;
14
- }
@@ -1,103 +0,0 @@
1
- import McPopulatedBlankComponent from './McPopulatedBlank.svelte';
2
- import { isComplete as isControllerComplete } from '../controller';
3
-
4
- const SvelteElementClass = (McPopulatedBlankComponent as any).element;
5
-
6
- class McPopulatedBlankElement extends SvelteElementClass {
7
- _internalSession: any = null;
8
- _model: any = null;
9
- _options: any = null;
10
- audioComplete = false;
11
-
12
- _dispatchModelSet = () => {
13
- this.dispatchEvent(
14
- new CustomEvent('model-set', {
15
- bubbles: true,
16
- composed: true,
17
- detail: {
18
- complete: this._isComplete(),
19
- component: this.tagName.toLowerCase(),
20
- hasModel: this._model !== undefined,
21
- },
22
- })
23
- );
24
- };
25
-
26
- _dispatchSessionChanged = () => {
27
- this.dispatchEvent(
28
- new CustomEvent('session-changed', {
29
- bubbles: true,
30
- composed: true,
31
- detail: {
32
- complete: this._isComplete(),
33
- component: this.tagName.toLowerCase(),
34
- },
35
- })
36
- );
37
- };
38
-
39
- set model(m: any) {
40
- this._model = m;
41
- this.audioComplete = false;
42
- super.model = m;
43
- this._dispatchModelSet();
44
- }
45
-
46
- get model() {
47
- return this._model;
48
- }
49
-
50
- set session(s: any) {
51
- this._internalSession = s;
52
- super.session = s;
53
- this._dispatchSessionChanged();
54
- }
55
-
56
- get session() {
57
- return this._internalSession;
58
- }
59
-
60
- set options(o: any) {
61
- this._options = o;
62
- super.options = o;
63
- }
64
-
65
- get options() {
66
- return this._options;
67
- }
68
-
69
- onSessionChange = (updatedSession: any) => {
70
- this._internalSession = updatedSession;
71
- super.session = updatedSession;
72
- this._dispatchSessionChanged();
73
- };
74
-
75
- onAudioStarted = () => {
76
- this._internalSession = {
77
- ...(this._internalSession || {}),
78
- audioStartTime: new Date().getTime(),
79
- };
80
- };
81
-
82
- onAudioEnded = () => {
83
- this.audioComplete = true;
84
- this._internalSession = {
85
- ...(this._internalSession || {}),
86
- audioEndTime: new Date().getTime(),
87
- };
88
- this._dispatchSessionChanged();
89
- };
90
-
91
- _isComplete = () => {
92
- return isControllerComplete(this._model, this._internalSession, this.audioComplete);
93
- };
94
-
95
- connectedCallback() {
96
- super.connectedCallback();
97
- (this as any).onSessionChange = this.onSessionChange;
98
- (this as any).onAudioStarted = this.onAudioStarted;
99
- (this as any).onAudioEnded = this.onAudioEnded;
100
- }
101
- }
102
-
103
- export default McPopulatedBlankElement;
@@ -1,110 +0,0 @@
1
- import selR1PlusgggCss from './cqt-css/sel-r1-plusggg.css?raw';
2
- import srVicCss from './cqt-css/sr-vic.css?raw';
3
- import selVicCss from './cqt-css/sel-vic.css?raw';
4
- import selR1GplusgggCss from './cqt-css/sel-r1-gplusggg.css?raw';
5
- import selR1GStemCss from './cqt-css/sel-r1-g-stem.css?raw';
6
- import selR1GgPlusCss from './cqt-css/sel-r1-gg-plus.css?raw';
7
- import selR1GgplusCss from './cqt-css/sel-r1-ggplus.css?raw';
8
- import selR1S3Css from './cqt-css/sel-r1-s3.css?raw';
9
-
10
- export type VariantCssConfig = {
11
- variantId: string;
12
- variantClass: string;
13
- sourceUrl: string;
14
- cssText: string;
15
- };
16
-
17
- const VARIANT_BY_CUSTOM_TYPE: Record<string, VariantCssConfig> = {
18
- 'sel_r1-_plusggg': {
19
- variantId: 'sel-r1-plusggg',
20
- variantClass: 'variant-sel-r1-plusggg',
21
- sourceUrl:
22
- 'https://global-pr-ibvcustomfiles.renaissance-go.com/learnosity/sel_r1-_plusggg/0.0.1/question.css',
23
- cssText: selR1PlusgggCss,
24
- },
25
- 'sr-vic': {
26
- variantId: 'sr-vic',
27
- variantClass: 'variant-sr-vic',
28
- sourceUrl:
29
- 'https://global-pr-ibvcustomfiles.renaissance-go.com/learnosity/sr-vic/0.0.1/question.css',
30
- cssText: srVicCss,
31
- },
32
- sel_vic: {
33
- variantId: 'sel-vic',
34
- variantClass: 'variant-sel-vic',
35
- sourceUrl:
36
- 'https://global-pr-ibvcustomfiles.renaissance-go.com/learnosity/sel_vic/0.0.1/question.css',
37
- cssText: selVicCss,
38
- },
39
- 'sel_r1-_gplusggg': {
40
- variantId: 'sel-r1-gplusggg',
41
- variantClass: 'variant-sel-r1-gplusggg',
42
- sourceUrl:
43
- 'https://global-pr-ibvcustomfiles.renaissance-go.com/learnosity/sel_r1-_gplusggg/0.0.1/question.css',
44
- cssText: selR1GplusgggCss,
45
- },
46
- 'sel_r1-g_plusggg': {
47
- variantId: 'sel-r1-g-stem',
48
- variantClass: 'variant-sel-r1-g-stem',
49
- sourceUrl:
50
- 'https://global-pr-ibvcustomfiles.renaissance-go.com/learnosity/sel_r1-g_plusggg/0.0.1/question.css',
51
- cssText: selR1GStemCss,
52
- },
53
- 'sel_r1-gg_plusggg': {
54
- variantId: 'sel-r1-gg-plus',
55
- variantClass: 'variant-sel-r1-gg-plus',
56
- sourceUrl:
57
- 'https://global-pr-ibvcustomfiles.renaissance-go.com/learnosity/sel_r1-gg_plusggg/0.0.1/question.css',
58
- cssText: selR1GgPlusCss,
59
- },
60
- 'sel_r1-_ggplusggg': {
61
- variantId: 'sel-r1-ggplus',
62
- variantClass: 'variant-sel-r1-ggplus',
63
- sourceUrl:
64
- 'https://global-pr-ibvcustomfiles.renaissance-go.com/learnosity/sel_r1-_ggplusggg/0.0.1/question.css',
65
- cssText: selR1GgplusCss,
66
- },
67
- 'sel_r1-s3_plusggg': {
68
- variantId: 'sel-r1-s3',
69
- variantClass: 'variant-sel-r1-s3',
70
- sourceUrl:
71
- 'https://global-pr-ibvcustomfiles.renaissance-go.com/learnosity/sel_r1-s3_plusggg/0.0.1/question.css',
72
- cssText: selR1S3Css,
73
- },
74
- };
75
-
76
- const normalizeCustomType = (value: unknown): string => {
77
- const normalized = String(value || '')
78
- .trim()
79
- .toLowerCase();
80
- // Accept both base custom types and version-suffixed tags like "...v0.0.1".
81
- return normalized.replace(/v\d+\.\d+\.\d+$/i, '');
82
- };
83
-
84
- export const getVariantCssConfig = (customType: unknown): VariantCssConfig | undefined => {
85
- const normalized = normalizeCustomType(customType);
86
- return VARIANT_BY_CUSTOM_TYPE[normalized];
87
- };
88
-
89
- export const getVariantRootClass = (customType: unknown): string => {
90
- return getVariantCssConfig(customType)?.variantClass || '';
91
- };
92
-
93
- export const ensureVariantCssInjected = (config?: VariantCssConfig): void => {
94
- if (!config || !config.cssText || typeof document === 'undefined') {
95
- return;
96
- }
97
- const styleId = `mc-populated-blank-css-${config.variantId}`;
98
- const existing = document.getElementById(styleId) as HTMLStyleElement | null;
99
- if (existing) {
100
- if (existing.textContent !== config.cssText) {
101
- existing.textContent = config.cssText;
102
- }
103
- return;
104
- }
105
- const style = document.createElement('style');
106
- style.id = styleId;
107
- style.setAttribute('data-mpb-variant', config.variantId);
108
- style.textContent = config.cssText;
109
- document.head.appendChild(style);
110
- };
package/src/index.iife.ts DELETED
@@ -1,13 +0,0 @@
1
- /**
2
- * IIFE entry for mc-populated-blank delivery.
3
- * Registration is handled by PIE players/loaders, not by the element bundle itself.
4
- */
5
- import Element from './delivery';
6
- import * as controllerModule from './controller';
7
-
8
- // Ensure the IIFE package exposes a plain controller object with callable
9
- // `model`/`outcome` functions on the top-level `controller` property.
10
- const controller = { ...controllerModule };
11
-
12
- export { controller };
13
- export default Element;
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export { default } from './delivery/index';
@@ -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,4 +0,0 @@
1
- declare module '*.css?raw' {
2
- const css: string;
3
- export default css;
4
- }