@pie-element/mc-populated-blank 0.2.0 → 0.2.2
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/README.md +9 -3
- package/dist/controller/defaults.d.ts +4 -0
- package/dist/controller/defaults.d.ts.map +1 -1
- package/dist/controller/index.d.ts.map +1 -1
- package/dist/controller/index.js +7 -6
- package/dist/controller/index.js.map +1 -1
- package/dist/delivery/index.js +670 -296
- package/dist/delivery/index.js.map +1 -1
- package/dist/index.iife.d.ts +2 -1
- package/dist/index.iife.d.ts.map +1 -1
- package/dist/index.iife.js +20 -5
- package/dist/index.js +670 -296
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
- package/src/controller/defaults.ts +2 -0
- package/src/controller/index.ts +5 -6
- package/src/delivery/McPopulatedBlank.svelte +429 -104
- package/src/index.iife.ts +2 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/mc-populated-blank",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
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",
|
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
"clean": "rm -rf dist tsconfig.tsbuildinfo"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
+
"@pie-lib-svelte/styling": "workspace:*",
|
|
46
47
|
"lodash-es": "^4.17.21"
|
|
47
48
|
},
|
|
48
49
|
"peerDependencies": {
|
|
@@ -22,6 +22,8 @@ export const DEFAULT_LAYOUT_LIMITS = {
|
|
|
22
22
|
horizontalChoiceRadioTopMarginRem: 0.5,
|
|
23
23
|
audioBlankTemplateMarginTopRem: 0.8,
|
|
24
24
|
audioBlankTemplateMarginBottomRem: 1.8,
|
|
25
|
+
audioInstructionsMaxWidthPx: 875,
|
|
26
|
+
narrowHorizontalChoiceMaxWidthPx: 230,
|
|
25
27
|
stimulusGridColumnGapRem: 2,
|
|
26
28
|
stimulusGridRowGapRem: 0.7,
|
|
27
29
|
stimulusSentenceMarginTopRem: 0.2,
|
package/src/controller/index.ts
CHANGED
|
@@ -91,14 +91,14 @@ const shouldLockChoices = (question: any, env: any) => {
|
|
|
91
91
|
return env?.role === 'instructor';
|
|
92
92
|
};
|
|
93
93
|
|
|
94
|
-
|
|
94
|
+
function shuffleArray<T>(items: T[]): T[] {
|
|
95
95
|
const out = [...items];
|
|
96
96
|
for (let i = out.length - 1; i > 0; i--) {
|
|
97
97
|
const j = Math.floor(Math.random() * (i + 1));
|
|
98
98
|
[out[i], out[j]] = [out[j], out[i]];
|
|
99
99
|
}
|
|
100
100
|
return out;
|
|
101
|
-
}
|
|
101
|
+
}
|
|
102
102
|
|
|
103
103
|
const getStoredShuffle = (session: any): string[] =>
|
|
104
104
|
Array.isArray(session?.data?.shuffledValues)
|
|
@@ -163,10 +163,7 @@ export const model = async (question: any, session: any, env: any, updateSession
|
|
|
163
163
|
typeof normalizedQuestion.layoutProfilePresets === 'object'
|
|
164
164
|
? normalizedQuestion.layoutProfilePresets
|
|
165
165
|
: {},
|
|
166
|
-
layoutLimits: {
|
|
167
|
-
...DEFAULT_LAYOUT_LIMITS,
|
|
168
|
-
...(normalizedQuestion.layoutLimits || {}),
|
|
169
|
-
},
|
|
166
|
+
layoutLimits: normalizedQuestion.layoutLimits || { ...DEFAULT_LAYOUT_LIMITS },
|
|
170
167
|
audioButtonSkin:
|
|
171
168
|
normalizedQuestion.audioButtonSkin && typeof normalizedQuestion.audioButtonSkin === 'object'
|
|
172
169
|
? normalizedQuestion.audioButtonSkin
|
|
@@ -324,6 +321,8 @@ export const validate = (model: any = {}, _config: any = {}) => {
|
|
|
324
321
|
'horizontalChoiceRadioTopMarginRem',
|
|
325
322
|
'audioBlankTemplateMarginTopRem',
|
|
326
323
|
'audioBlankTemplateMarginBottomRem',
|
|
324
|
+
'audioInstructionsMaxWidthPx',
|
|
325
|
+
'narrowHorizontalChoiceMaxWidthPx',
|
|
327
326
|
'stimulusGridColumnGapRem',
|
|
328
327
|
'stimulusGridRowGapRem',
|
|
329
328
|
'stimulusSentenceMarginTopRem',
|