@pie-element/mc-populated-blank 0.2.9 → 0.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pie-element/mc-populated-blank",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
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",
@@ -195,6 +195,7 @@ export const model = async (question: any, session: any, env: any, updateSession
195
195
  audioUrl: normalizedQuestion.hasAudio ? normalizedQuestion.audioUrl : null,
196
196
  audioTranscript: normalizedQuestion.hasAudio ? normalizedQuestion.audioTranscript : null,
197
197
  showVisibleTranscript: !!normalizedQuestion.showVisibleTranscript,
198
+ customType: normalizedQuestion.customType || '',
198
199
  useFeatureButtonAudio:
199
200
  typeof normalizedQuestion.useFeatureButtonAudio === 'boolean'
200
201
  ? normalizedQuestion.useFeatureButtonAudio
@@ -12,6 +12,11 @@
12
12
 
13
13
  <script lang="ts">
14
14
  import { color } from '@pie-lib/styling-svelte';
15
+ import {
16
+ ensureVariantCssInjected,
17
+ getVariantCssConfig,
18
+ getVariantRootClass,
19
+ } from './variant-css-map';
15
20
  /** Must match controller `BLANK_TOKEN` (kept local to avoid pulling controller into delivery). */
16
21
  const BLANK_TOKEN = '{{blank}}';
17
22
  const DEFAULT_LAYOUT_LIMITS = {
@@ -122,6 +127,8 @@ const isBlankOnlyTemplate = $derived.by(() => {
122
127
  return plain === BLANK_TOKEN;
123
128
  });
124
129
  const layoutProfile = $derived(model?.layoutProfile || '');
130
+ const variantCssConfig = $derived(getVariantCssConfig(model?.customType));
131
+ const variantRootClass = $derived(getVariantRootClass(model?.customType));
125
132
  const choiceLayout = $derived(
126
133
  model?.choiceLayout || (isAudioOnlyMode || isBlankOnlyTemplate ? 'horizontal' : 'vertical')
127
134
  );
@@ -275,6 +282,7 @@ const displayChoiceId = $derived.by(() => {
275
282
  });
276
283
 
277
284
  const displayChoice = $derived.by(() => choices.find((c: any) => c.id === displayChoiceId));
285
+ const displayChoiceLabelHtml = $derived.by(() => String(displayChoice?.labelHtml || ''));
278
286
 
279
287
  const legendText = $derived.by(() => {
280
288
  const plain = (model?.prompt || '')
@@ -562,10 +570,14 @@ $effect(() => {
562
570
  });
563
571
  }
564
572
  });
573
+
574
+ $effect(() => {
575
+ ensureVariantCssInjected(variantCssConfig);
576
+ });
565
577
  </script>
566
578
 
567
579
  <div
568
- class={`p-4 mc-populated-blank-root pie-element pie-element-mc-populated-blank pie-delivery-root layout-${layoutProfile} ${hasInlineSentenceAudioLayout ? 'has-inline-audio' : ''}`}
580
+ class={`p-4 mc-populated-blank-root pie-element pie-element-mc-populated-blank pie-delivery-root layout-${layoutProfile} ${variantRootClass} ${hasInlineSentenceAudioLayout ? 'has-inline-audio' : ''}`}
569
581
  lang={lang}
570
582
  style={rootStyle}
571
583
  >
@@ -729,8 +741,8 @@ $effect(() => {
729
741
  class="w-auto object-contain pie-blank-image"
730
742
  style="max-height:var(--mpb-selected-image-max-height, 4rem);"
731
743
  />
732
- {:else if displayChoice?.labelHtml}
733
- <span class="blank-inner choice-label pie-blank-value">{@html displayChoice.labelHtml}</span>
744
+ {:else if displayChoiceLabelHtml}
745
+ <span class="choice-html pie-blank-value">{@html displayChoiceLabelHtml}</span>
734
746
  {:else}
735
747
  <span class="blank-inner-empty" aria-hidden="true">&nbsp;</span>
736
748
  {/if}
@@ -775,7 +787,7 @@ $effect(() => {
775
787
  style="max-height:var(--mpb-choice-image-max-height, 5rem);"
776
788
  />
777
789
  {:else}
778
- <span class="choice-label pie-choice-label">{@html c.labelHtml || ''}</span>
790
+ <span class="choice-html pie-choice-label">{@html c.labelHtml || ''}</span>
779
791
  {/if}
780
792
  </span>
781
793
  <input
@@ -811,7 +823,7 @@ $effect(() => {
811
823
  style="max-height:var(--mpb-choice-image-max-height, 5rem);"
812
824
  />
813
825
  {:else}
814
- <span class="choice-label pie-choice-label">{@html c.labelHtml || ''}</span>
826
+ <span class="choice-html pie-choice-label">{@html c.labelHtml || ''}</span>
815
827
  {/if}
816
828
  </label>
817
829
  {/if}
@@ -984,6 +996,10 @@ $effect(() => {
984
996
  background: var(--pie-correct-answer-choice-hover-bg, #ececec);
985
997
  }
986
998
 
999
+ .pie-choice-horizontal:not(.is-selected):not(:hover) .pie-choice-tile {
1000
+ background: transparent;
1001
+ }
1002
+
987
1003
  .choice-row-horizontal.is-selected .choice-tile {
988
1004
  background: var(--pie-correct-answer-choice-selected-bg, #f1f1f1);
989
1005
  }
@@ -992,6 +1008,23 @@ $effect(() => {
992
1008
  background: var(--pie-correct-answer-choice-selected-bg, #f1f1f1);
993
1009
  }
994
1010
 
1011
+ .pie-choice:not(.pie-choice-horizontal):hover .pie-choice-label-wrap {
1012
+ background: var(--pie-correct-answer-choice-hover-bg, #ececec);
1013
+ }
1014
+
1015
+ .pie-choice:not(.pie-choice-horizontal):not(.is-selected):not(:hover) .pie-choice-label-wrap {
1016
+ background: transparent;
1017
+ }
1018
+
1019
+ .pie-choice:not(.pie-choice-horizontal).is-selected .pie-choice-label-wrap {
1020
+ background: var(--pie-correct-answer-choice-selected-bg, #f1f1f1);
1021
+ border-radius: 6px;
1022
+ }
1023
+
1024
+ .pie-choice:not(.pie-choice-horizontal).is-selected:hover .pie-choice-label-wrap {
1025
+ background: var(--pie-correct-answer-choice-selected-bg, #f1f1f1);
1026
+ }
1027
+
995
1028
  .pie-choice.choice-correct {
996
1029
  border-left: 3px solid var(--pie-correct-answer-choice-correct-border, #0ea449);
997
1030
  }
@@ -1035,12 +1068,11 @@ $effect(() => {
1035
1068
  text-align: center;
1036
1069
  }
1037
1070
 
1038
- .choice-label :global(p),
1039
- .blank-inner :global(p) {
1071
+ .choice-html :global(p) {
1040
1072
  margin: 0;
1041
1073
  }
1042
1074
 
1043
- .blank-inner {
1075
+ .choice-html {
1044
1076
  width: 100%;
1045
1077
  display: inline-flex;
1046
1078
  align-items: center;
@@ -0,0 +1,29 @@
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
+ }
@@ -0,0 +1,29 @@
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
+ }
@@ -0,0 +1,34 @@
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
+ }
@@ -0,0 +1,20 @@
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
+ }
@@ -0,0 +1,20 @@
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
+ }
@@ -0,0 +1,91 @@
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
+ }
@@ -0,0 +1,38 @@
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
+ }
@@ -0,0 +1,14 @@
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
+ }
@@ -0,0 +1,110 @@
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
+ };
@@ -0,0 +1,4 @@
1
+ declare module '*.css?raw' {
2
+ const css: string;
3
+ export default css;
4
+ }