@doenet/v06-to-v07 0.7.20-dev.307 → 0.7.20-dev.308
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/{index-C0ofSjwe.js → index-BmXW0q7U.js} +436 -26
- package/{index-C0ofSjwe.js.map → index-BmXW0q7U.js.map} +1 -1
- package/index.js +1 -1
- package/package.json +1 -1
- package/{sha256-C0vj3HDn-ILc8kzpi-tZRzzwtP.js → sha256-C0vj3HDn-Cy4MoSBb-D7vYyaIg.js} +2 -2
- package/{sha256-C0vj3HDn-ILc8kzpi-tZRzzwtP.js.map → sha256-C0vj3HDn-Cy4MoSBb-D7vYyaIg.js.map} +1 -1
|
@@ -10899,6 +10899,50 @@ function answerSugar(node) {
|
|
|
10899
10899
|
node.children = [answerElement, videoCreditMessage, callActionElement];
|
|
10900
10900
|
}
|
|
10901
10901
|
}
|
|
10902
|
+
const SCORED_SECTION_COMPONENT_TYPES = [
|
|
10903
|
+
"document",
|
|
10904
|
+
"section",
|
|
10905
|
+
"subsection",
|
|
10906
|
+
"subsubsection",
|
|
10907
|
+
"paragraphs",
|
|
10908
|
+
"aside",
|
|
10909
|
+
"objectives",
|
|
10910
|
+
"problem",
|
|
10911
|
+
"exercise",
|
|
10912
|
+
"question",
|
|
10913
|
+
"activity",
|
|
10914
|
+
"example",
|
|
10915
|
+
"definition",
|
|
10916
|
+
"note",
|
|
10917
|
+
"theorem",
|
|
10918
|
+
"part",
|
|
10919
|
+
"task",
|
|
10920
|
+
"proof",
|
|
10921
|
+
"problems",
|
|
10922
|
+
"exercises",
|
|
10923
|
+
"standinForFutureLayoutTag",
|
|
10924
|
+
"externalContent",
|
|
10925
|
+
"cascade",
|
|
10926
|
+
"div",
|
|
10927
|
+
"span",
|
|
10928
|
+
"ol",
|
|
10929
|
+
"ul",
|
|
10930
|
+
"li",
|
|
10931
|
+
"p"
|
|
10932
|
+
];
|
|
10933
|
+
function renamedScoredSectionAttribute(oldName, newName) {
|
|
10934
|
+
const rule = {
|
|
10935
|
+
to: newName,
|
|
10936
|
+
warningMessage: `[deprecation] Attribute \`${oldName}\` is deprecated; use \`${newName}\` instead.`,
|
|
10937
|
+
conflictWarningMessage: `[deprecation] Attribute \`${oldName}\` is deprecated and ignored because \`${newName}\` is also specified.`
|
|
10938
|
+
};
|
|
10939
|
+
return Object.fromEntries(
|
|
10940
|
+
SCORED_SECTION_COMPONENT_TYPES.map((comp) => [
|
|
10941
|
+
comp,
|
|
10942
|
+
{ [oldName]: rule }
|
|
10943
|
+
])
|
|
10944
|
+
);
|
|
10945
|
+
}
|
|
10902
10946
|
function ignoredAttributes(componentName, attributeNames) {
|
|
10903
10947
|
return Object.fromEntries(
|
|
10904
10948
|
attributeNames.map((attributeName) => [
|
|
@@ -10909,9 +10953,19 @@ function ignoredAttributes(componentName, attributeNames) {
|
|
|
10909
10953
|
])
|
|
10910
10954
|
);
|
|
10911
10955
|
}
|
|
10956
|
+
const SCORED_SECTION_COLORING_RENAMES = renamedScoredSectionAttribute(
|
|
10957
|
+
"forceIndividualAnswerColoring",
|
|
10958
|
+
"colorAnswersSeparately"
|
|
10959
|
+
);
|
|
10912
10960
|
const DEPRECATION_REGISTRY = {
|
|
10913
10961
|
attributeRenames: {
|
|
10962
|
+
// Merge per-component rules, spreading scored-section rename rules
|
|
10963
|
+
// first so component-specific rules take precedence on conflict.
|
|
10964
|
+
...SCORED_SECTION_COLORING_RENAMES,
|
|
10914
10965
|
document: {
|
|
10966
|
+
// document already has a scored-section rename (spread above) plus
|
|
10967
|
+
// its own documentWideCheckWork rename.
|
|
10968
|
+
...SCORED_SECTION_COLORING_RENAMES["document"],
|
|
10915
10969
|
documentWideCheckWork: {
|
|
10916
10970
|
to: "sectionWideCheckWork",
|
|
10917
10971
|
warningMessage: "[deprecation] Attribute `documentWideCheckWork` on `<document>` is deprecated; use `sectionWideCheckWork` instead.",
|
|
@@ -40909,7 +40963,7 @@ async function cidFromArrayBuffer(data) {
|
|
|
40909
40963
|
await crypto.subtle.digest("SHA-256", new Uint8Array());
|
|
40910
40964
|
digest = (data2) => crypto.subtle.digest("SHA-256", data2);
|
|
40911
40965
|
} catch (e22) {
|
|
40912
|
-
const sha256 = (await import("./sha256-C0vj3HDn-
|
|
40966
|
+
const sha256 = (await import("./sha256-C0vj3HDn-Cy4MoSBb-D7vYyaIg.js").then((n2) => n2.s)).default;
|
|
40913
40967
|
digest = (data2) => sha256(data2, {
|
|
40914
40968
|
asBytes: true
|
|
40915
40969
|
});
|
|
@@ -57252,6 +57306,30 @@ const _UnlinkedCopySourceDependency = class _UnlinkedCopySourceDependency2 exten
|
|
|
57252
57306
|
};
|
|
57253
57307
|
_UnlinkedCopySourceDependency.dependencyType = "unlinkedCopySource";
|
|
57254
57308
|
let UnlinkedCopySourceDependency = _UnlinkedCopySourceDependency;
|
|
57309
|
+
const _ShadowInfoDependency = class _ShadowInfoDependency2 extends Dependency {
|
|
57310
|
+
setUpParameters() {
|
|
57311
|
+
if (this.definition.componentIdx != void 0) {
|
|
57312
|
+
this.componentIdx = this.definition.componentIdx;
|
|
57313
|
+
} else {
|
|
57314
|
+
this.componentIdx = this.upstreamComponentIdx;
|
|
57315
|
+
}
|
|
57316
|
+
}
|
|
57317
|
+
async getValue() {
|
|
57318
|
+
const component = this.dependencyHandler._components[this.componentIdx];
|
|
57319
|
+
if (!component?.shadows) {
|
|
57320
|
+
return { value: null, changes: {} };
|
|
57321
|
+
}
|
|
57322
|
+
return {
|
|
57323
|
+
value: {
|
|
57324
|
+
componentIdx: component.shadows.componentIdx,
|
|
57325
|
+
propVariable: component.shadows.propVariable ?? null
|
|
57326
|
+
},
|
|
57327
|
+
changes: {}
|
|
57328
|
+
};
|
|
57329
|
+
}
|
|
57330
|
+
};
|
|
57331
|
+
_ShadowInfoDependency.dependencyType = "shadowInfo";
|
|
57332
|
+
let ShadowInfoDependency = _ShadowInfoDependency;
|
|
57255
57333
|
const _PrimaryShadowDependency = class _PrimaryShadowDependency2 extends Dependency {
|
|
57256
57334
|
setUpParameters() {
|
|
57257
57335
|
if (this.definition.componentIdx != void 0) {
|
|
@@ -58400,6 +58478,7 @@ const dependencyTypeClasses = [
|
|
|
58400
58478
|
ShadowSourceDependency,
|
|
58401
58479
|
UnlinkedCopySourceDependency,
|
|
58402
58480
|
PrimaryShadowDependency,
|
|
58481
|
+
ShadowInfoDependency,
|
|
58403
58482
|
AdapterSourceStateVariableDependency,
|
|
58404
58483
|
AdapterSourceDependency,
|
|
58405
58484
|
CountAmongSiblingsDependency,
|
|
@@ -74964,12 +75043,12 @@ function returnScoredSectionAttributes() {
|
|
|
74964
75043
|
groupName: "scoring",
|
|
74965
75044
|
description: "Whether to color-code the answers it contains based on correctness."
|
|
74966
75045
|
},
|
|
74967
|
-
|
|
75046
|
+
colorAnswersSeparately: {
|
|
74968
75047
|
createComponentOfType: "boolean",
|
|
74969
|
-
createStateVariable: "
|
|
75048
|
+
createStateVariable: "colorAnswersSeparately",
|
|
74970
75049
|
defaultValue: false,
|
|
74971
75050
|
groupName: "scoring",
|
|
74972
|
-
description: "
|
|
75051
|
+
description: "When section-wide check work is enabled, color each answer based on its own correctness rather than the section's overall credit."
|
|
74973
75052
|
},
|
|
74974
75053
|
submitLabel: {
|
|
74975
75054
|
createComponentOfType: "text",
|
|
@@ -75415,9 +75494,9 @@ function returnScoredSectionStateVariableDefinition() {
|
|
|
75415
75494
|
dependencyType: "stateVariable",
|
|
75416
75495
|
variableName: "sectionWideCheckWork"
|
|
75417
75496
|
},
|
|
75418
|
-
|
|
75497
|
+
colorAnswersSeparately: {
|
|
75419
75498
|
dependencyType: "stateVariable",
|
|
75420
|
-
variableName: "
|
|
75499
|
+
variableName: "colorAnswersSeparately"
|
|
75421
75500
|
},
|
|
75422
75501
|
ancestorDeterminingSubmit: {
|
|
75423
75502
|
dependencyType: "ancestor",
|
|
@@ -75437,7 +75516,7 @@ function returnScoredSectionStateVariableDefinition() {
|
|
|
75437
75516
|
} else if (dependencyValues.sectionWideCheckWork) {
|
|
75438
75517
|
createSubmitAllButton = true;
|
|
75439
75518
|
suppressAnswerSubmitButtons = true;
|
|
75440
|
-
if (!dependencyValues.
|
|
75519
|
+
if (!dependencyValues.colorAnswersSeparately) {
|
|
75441
75520
|
descendantColorCorrectnessBasedOnIdx = componentIdx;
|
|
75442
75521
|
}
|
|
75443
75522
|
}
|
|
@@ -111064,7 +111143,8 @@ class Input extends InlineComponent {
|
|
|
111064
111143
|
"nextCreditFactor",
|
|
111065
111144
|
"forceFullCheckWorkButton",
|
|
111066
111145
|
"forceSmallCheckWorkButton",
|
|
111067
|
-
"labelsForAnswer"
|
|
111146
|
+
"labelsForAnswer",
|
|
111147
|
+
"colorInputsSeparately"
|
|
111068
111148
|
]
|
|
111069
111149
|
}
|
|
111070
111150
|
}),
|
|
@@ -111151,7 +111231,8 @@ class Input extends InlineComponent {
|
|
|
111151
111231
|
"justSubmitted",
|
|
111152
111232
|
"creditAchieved",
|
|
111153
111233
|
"showCorrectness",
|
|
111154
|
-
"colorCorrectness"
|
|
111234
|
+
"colorCorrectness",
|
|
111235
|
+
"colorInputsSeparately"
|
|
111155
111236
|
],
|
|
111156
111237
|
variablesOptional: true
|
|
111157
111238
|
};
|
|
@@ -111236,18 +111317,63 @@ class Input extends InlineComponent {
|
|
|
111236
111317
|
return { setValue: { colorCorrectness } };
|
|
111237
111318
|
}
|
|
111238
111319
|
};
|
|
111320
|
+
const variableForImplicitProp = this.variableForImplicitProp ?? "value";
|
|
111239
111321
|
stateVariableDefinitions.creditAchieved = {
|
|
111240
111322
|
forRenderer: true,
|
|
111241
|
-
|
|
111242
|
-
|
|
111243
|
-
|
|
111244
|
-
|
|
111323
|
+
stateVariablesDeterminingDependencies: [
|
|
111324
|
+
"answerAncestor",
|
|
111325
|
+
"answerSpecifiedInForAnswer"
|
|
111326
|
+
],
|
|
111327
|
+
returnDependencies({ stateValues }) {
|
|
111328
|
+
const deps = {
|
|
111329
|
+
componentDeterminingDisplayedCorrectness: {
|
|
111330
|
+
dependencyType: "stateVariable",
|
|
111331
|
+
variableName: "componentDeterminingDisplayedCorrectness"
|
|
111332
|
+
}
|
|
111333
|
+
};
|
|
111334
|
+
if (stateValues.answerAncestor?.stateValues.colorInputsSeparately) {
|
|
111335
|
+
deps.answerCreditAchievedPerInput = {
|
|
111336
|
+
dependencyType: "ancestor",
|
|
111337
|
+
componentType: "answer",
|
|
111338
|
+
variableNames: ["creditAchievedPerInput"]
|
|
111339
|
+
};
|
|
111340
|
+
} else if (stateValues.answerSpecifiedInForAnswer !== null) {
|
|
111341
|
+
deps.answerColoringState = {
|
|
111342
|
+
dependencyType: "multipleStateVariables",
|
|
111343
|
+
componentIdx: stateValues.answerSpecifiedInForAnswer,
|
|
111344
|
+
variableNames: [
|
|
111345
|
+
"colorInputsSeparately",
|
|
111346
|
+
"creditAchievedPerInput"
|
|
111347
|
+
],
|
|
111348
|
+
variablesOptional: true
|
|
111349
|
+
};
|
|
111245
111350
|
}
|
|
111246
|
-
|
|
111247
|
-
|
|
111351
|
+
return deps;
|
|
111352
|
+
},
|
|
111353
|
+
definition: function({ dependencyValues, componentIdx }) {
|
|
111248
111354
|
let creditAchieved = 0;
|
|
111249
|
-
|
|
111250
|
-
|
|
111355
|
+
const comp = dependencyValues.componentDeterminingDisplayedCorrectness;
|
|
111356
|
+
if (comp) {
|
|
111357
|
+
const overallCredit = comp.stateValues.creditAchieved ?? 0;
|
|
111358
|
+
const creditAchievedPerInput = dependencyValues.answerCreditAchievedPerInput?.stateValues.creditAchievedPerInput ?? (dependencyValues.answerColoringState?.stateValues?.colorInputsSeparately ? dependencyValues.answerColoringState.stateValues.creditAchievedPerInput : void 0);
|
|
111359
|
+
if (comp.stateValues.colorInputsSeparately && creditAchievedPerInput) {
|
|
111360
|
+
const key = `${componentIdx}/${variableForImplicitProp}`;
|
|
111361
|
+
let perInputCredit = creditAchievedPerInput[key];
|
|
111362
|
+
if (perInputCredit === void 0 && variableForImplicitProp !== "value") {
|
|
111363
|
+
const keyPrefix = `${componentIdx}/`;
|
|
111364
|
+
const candidateCredits = Object.entries(
|
|
111365
|
+
creditAchievedPerInput
|
|
111366
|
+
).filter(
|
|
111367
|
+
([entryKey]) => entryKey.startsWith(keyPrefix)
|
|
111368
|
+
).map(([, credit]) => credit);
|
|
111369
|
+
if (candidateCredits.length > 0) {
|
|
111370
|
+
perInputCredit = Math.max(...candidateCredits);
|
|
111371
|
+
}
|
|
111372
|
+
}
|
|
111373
|
+
creditAchieved = perInputCredit !== void 0 ? perInputCredit : overallCredit;
|
|
111374
|
+
} else {
|
|
111375
|
+
creditAchieved = overallCredit;
|
|
111376
|
+
}
|
|
111251
111377
|
}
|
|
111252
111378
|
return {
|
|
111253
111379
|
setValue: { creditAchieved }
|
|
@@ -115698,6 +115824,88 @@ class FractionInput extends Input {
|
|
|
115698
115824
|
}
|
|
115699
115825
|
})
|
|
115700
115826
|
};
|
|
115827
|
+
stateVariableDefinitions.componentIdx = {
|
|
115828
|
+
returnDependencies: () => ({}),
|
|
115829
|
+
definition({ componentIdx }) {
|
|
115830
|
+
return { setValue: { componentIdx } };
|
|
115831
|
+
}
|
|
115832
|
+
};
|
|
115833
|
+
stateVariableDefinitions.colorInputsSeparately = {
|
|
115834
|
+
stateVariablesDeterminingDependencies: [
|
|
115835
|
+
"answerSpecifiedInForAnswer"
|
|
115836
|
+
],
|
|
115837
|
+
returnDependencies({ stateValues }) {
|
|
115838
|
+
const deps = {
|
|
115839
|
+
answerAncestor: {
|
|
115840
|
+
dependencyType: "stateVariable",
|
|
115841
|
+
variableName: "answerAncestor"
|
|
115842
|
+
}
|
|
115843
|
+
};
|
|
115844
|
+
if (stateValues.answerSpecifiedInForAnswer !== null) {
|
|
115845
|
+
deps.forAnswerColorInputsSeparately = {
|
|
115846
|
+
dependencyType: "stateVariable",
|
|
115847
|
+
componentIdx: stateValues.answerSpecifiedInForAnswer,
|
|
115848
|
+
variableName: "colorInputsSeparately",
|
|
115849
|
+
variablesOptional: true
|
|
115850
|
+
};
|
|
115851
|
+
}
|
|
115852
|
+
return deps;
|
|
115853
|
+
},
|
|
115854
|
+
definition({ dependencyValues }) {
|
|
115855
|
+
if (dependencyValues.answerAncestor) {
|
|
115856
|
+
return {
|
|
115857
|
+
setValue: {
|
|
115858
|
+
colorInputsSeparately: dependencyValues.answerAncestor.stateValues.colorInputsSeparately ?? false
|
|
115859
|
+
}
|
|
115860
|
+
};
|
|
115861
|
+
}
|
|
115862
|
+
return {
|
|
115863
|
+
setValue: {
|
|
115864
|
+
colorInputsSeparately: dependencyValues.forAnswerColorInputsSeparately ?? false
|
|
115865
|
+
}
|
|
115866
|
+
};
|
|
115867
|
+
}
|
|
115868
|
+
};
|
|
115869
|
+
stateVariableDefinitions.creditAchievedPerInput = {
|
|
115870
|
+
stateVariablesDeterminingDependencies: [
|
|
115871
|
+
"colorInputsSeparately",
|
|
115872
|
+
"answerAncestor",
|
|
115873
|
+
"answerSpecifiedInForAnswer"
|
|
115874
|
+
],
|
|
115875
|
+
returnDependencies({ stateValues }) {
|
|
115876
|
+
if (!stateValues.colorInputsSeparately) {
|
|
115877
|
+
return {};
|
|
115878
|
+
}
|
|
115879
|
+
if (stateValues.answerAncestor) {
|
|
115880
|
+
return {
|
|
115881
|
+
answerCreditAchievedPerInput: {
|
|
115882
|
+
dependencyType: "ancestor",
|
|
115883
|
+
componentType: "answer",
|
|
115884
|
+
variableNames: ["creditAchievedPerInput"]
|
|
115885
|
+
}
|
|
115886
|
+
};
|
|
115887
|
+
}
|
|
115888
|
+
if (stateValues.answerSpecifiedInForAnswer !== null) {
|
|
115889
|
+
return {
|
|
115890
|
+
answerCreditAchievedPerInput: {
|
|
115891
|
+
dependencyType: "stateVariable",
|
|
115892
|
+
componentIdx: stateValues.answerSpecifiedInForAnswer,
|
|
115893
|
+
variableName: "creditAchievedPerInput",
|
|
115894
|
+
returnAsComponentObject: true,
|
|
115895
|
+
variablesOptional: true
|
|
115896
|
+
}
|
|
115897
|
+
};
|
|
115898
|
+
}
|
|
115899
|
+
return {};
|
|
115900
|
+
},
|
|
115901
|
+
definition({ dependencyValues }) {
|
|
115902
|
+
return {
|
|
115903
|
+
setValue: {
|
|
115904
|
+
creditAchievedPerInput: dependencyValues.answerCreditAchievedPerInput?.stateValues?.creditAchievedPerInput ?? {}
|
|
115905
|
+
}
|
|
115906
|
+
};
|
|
115907
|
+
}
|
|
115908
|
+
};
|
|
115701
115909
|
return stateVariableDefinitions;
|
|
115702
115910
|
}
|
|
115703
115911
|
static adapters = [
|
|
@@ -115834,18 +116042,49 @@ class FractionComponentInput extends BaseComponent {
|
|
|
115834
116042
|
};
|
|
115835
116043
|
stateVariableDefinitions.creditAchieved = {
|
|
115836
116044
|
forRenderer: true,
|
|
115837
|
-
|
|
115838
|
-
|
|
116045
|
+
stateVariablesDeterminingDependencies: ["part"],
|
|
116046
|
+
returnDependencies({ stateValues }) {
|
|
116047
|
+
const deps = {
|
|
116048
|
+
parentCreditAchieved: {
|
|
116049
|
+
dependencyType: "parentStateVariable",
|
|
116050
|
+
parentComponentType: "fractionInput",
|
|
116051
|
+
variableName: "creditAchieved"
|
|
116052
|
+
},
|
|
116053
|
+
parentColorInputsSeparately: {
|
|
116054
|
+
dependencyType: "parentStateVariable",
|
|
116055
|
+
parentComponentType: "fractionInput",
|
|
116056
|
+
variableName: "colorInputsSeparately"
|
|
116057
|
+
}
|
|
116058
|
+
};
|
|
116059
|
+
deps.parentCreditAchievedPerInput = {
|
|
115839
116060
|
dependencyType: "parentStateVariable",
|
|
115840
116061
|
parentComponentType: "fractionInput",
|
|
115841
|
-
variableName: "
|
|
115842
|
-
}
|
|
115843
|
-
|
|
116062
|
+
variableName: "creditAchievedPerInput"
|
|
116063
|
+
};
|
|
116064
|
+
deps.parentComponentIdx = {
|
|
116065
|
+
dependencyType: "parentStateVariable",
|
|
116066
|
+
parentComponentType: "fractionInput",
|
|
116067
|
+
variableName: "componentIdx"
|
|
116068
|
+
};
|
|
116069
|
+
deps.part = {
|
|
116070
|
+
dependencyType: "stateVariable",
|
|
116071
|
+
variableName: "part"
|
|
116072
|
+
};
|
|
116073
|
+
return deps;
|
|
116074
|
+
},
|
|
115844
116075
|
definition({ dependencyValues }) {
|
|
116076
|
+
const fallback = dependencyValues.parentCreditAchieved ?? 0;
|
|
116077
|
+
if (dependencyValues.parentColorInputsSeparately && dependencyValues.parentCreditAchievedPerInput && dependencyValues.parentComponentIdx !== void 0 && dependencyValues.part) {
|
|
116078
|
+
const key = `${dependencyValues.parentComponentIdx}/${dependencyValues.part}`;
|
|
116079
|
+
const perPartCredit = dependencyValues.parentCreditAchievedPerInput[key];
|
|
116080
|
+
return {
|
|
116081
|
+
setValue: {
|
|
116082
|
+
creditAchieved: perPartCredit !== void 0 ? perPartCredit : fallback
|
|
116083
|
+
}
|
|
116084
|
+
};
|
|
116085
|
+
}
|
|
115845
116086
|
return {
|
|
115846
|
-
setValue: {
|
|
115847
|
-
creditAchieved: dependencyValues.parentCreditAchieved ?? 0
|
|
115848
|
-
}
|
|
116087
|
+
setValue: { creditAchieved: fallback }
|
|
115849
116088
|
};
|
|
115850
116089
|
}
|
|
115851
116090
|
};
|
|
@@ -135761,6 +136000,13 @@ class Answer extends InlineComponent {
|
|
|
135761
136000
|
public: true,
|
|
135762
136001
|
description: "Maximum number of matching awards whose credits are summed."
|
|
135763
136002
|
};
|
|
136003
|
+
attributes.colorInputsSeparately = {
|
|
136004
|
+
createComponentOfType: "boolean",
|
|
136005
|
+
createStateVariable: "colorInputsSeparately",
|
|
136006
|
+
defaultValue: false,
|
|
136007
|
+
public: true,
|
|
136008
|
+
description: "Attempt to color each input separately based on the awards that reference it, rather than all inputs sharing the same overall credit color."
|
|
136009
|
+
};
|
|
135764
136010
|
attributes.allowedErrorInNumbers = {
|
|
135765
136011
|
createComponentOfType: "number",
|
|
135766
136012
|
createStateVariable: "allowedErrorInNumbers",
|
|
@@ -136584,6 +136830,35 @@ class Answer extends InlineComponent {
|
|
|
136584
136830
|
return { setValue: { inputChildWithValues } };
|
|
136585
136831
|
}
|
|
136586
136832
|
};
|
|
136833
|
+
stateVariableDefinitions.allInputComponentIdxs = {
|
|
136834
|
+
stateVariablesDeterminingDependencies: [
|
|
136835
|
+
"inputChildRelativeIndices"
|
|
136836
|
+
],
|
|
136837
|
+
returnDependencies: ({ stateValues }) => ({
|
|
136838
|
+
inputChildren: {
|
|
136839
|
+
dependencyType: "child",
|
|
136840
|
+
childGroups: ["inputs"],
|
|
136841
|
+
childIndices: stateValues.inputChildRelativeIndices
|
|
136842
|
+
},
|
|
136843
|
+
inputsForAnswer: {
|
|
136844
|
+
dependencyType: "stateVariable",
|
|
136845
|
+
variableName: "inputsForAnswer"
|
|
136846
|
+
}
|
|
136847
|
+
}),
|
|
136848
|
+
definition({ dependencyValues }) {
|
|
136849
|
+
const allInputComponentIdxs = /* @__PURE__ */ new Set([
|
|
136850
|
+
...dependencyValues.inputChildren.map(
|
|
136851
|
+
(c2) => c2.componentIdx
|
|
136852
|
+
),
|
|
136853
|
+
...dependencyValues.inputsForAnswer.map(
|
|
136854
|
+
(c2) => c2.componentIdx
|
|
136855
|
+
)
|
|
136856
|
+
]);
|
|
136857
|
+
return {
|
|
136858
|
+
setValue: { allInputComponentIdxs }
|
|
136859
|
+
};
|
|
136860
|
+
}
|
|
136861
|
+
};
|
|
136587
136862
|
stateVariableDefinitions.inputComponentIdxForLabel = {
|
|
136588
136863
|
stateVariablesDeterminingDependencies: ["inputChildrenWithValues"],
|
|
136589
136864
|
additionalStateVariablesDefined: [
|
|
@@ -137414,6 +137689,50 @@ class Answer extends InlineComponent {
|
|
|
137414
137689
|
};
|
|
137415
137690
|
}
|
|
137416
137691
|
};
|
|
137692
|
+
stateVariableDefinitions.creditAchievedPerInput = {
|
|
137693
|
+
returnDependencies: () => ({
|
|
137694
|
+
awardChildren: {
|
|
137695
|
+
dependencyType: "child",
|
|
137696
|
+
childGroups: ["awards"],
|
|
137697
|
+
variableNames: [
|
|
137698
|
+
"awarded",
|
|
137699
|
+
"creditAchieved",
|
|
137700
|
+
"credit",
|
|
137701
|
+
"referencedInputStateVars"
|
|
137702
|
+
]
|
|
137703
|
+
}
|
|
137704
|
+
}),
|
|
137705
|
+
definition({ dependencyValues }) {
|
|
137706
|
+
const maxCreditByKey = {};
|
|
137707
|
+
const actualCreditByKey = {};
|
|
137708
|
+
for (const award of dependencyValues.awardChildren) {
|
|
137709
|
+
const referencedInputStateVars = award.stateValues.referencedInputStateVars;
|
|
137710
|
+
const credit = award.stateValues.credit;
|
|
137711
|
+
const awarded = award.stateValues.awarded;
|
|
137712
|
+
const creditAchieved = award.stateValues.creditAchieved;
|
|
137713
|
+
for (const {
|
|
137714
|
+
componentIdx,
|
|
137715
|
+
propVariable
|
|
137716
|
+
} of referencedInputStateVars) {
|
|
137717
|
+
const key = `${componentIdx}/${propVariable}`;
|
|
137718
|
+
if (maxCreditByKey[key] === void 0 || credit > maxCreditByKey[key]) {
|
|
137719
|
+
maxCreditByKey[key] = credit;
|
|
137720
|
+
}
|
|
137721
|
+
if (awarded && (actualCreditByKey[key] === void 0 || creditAchieved > actualCreditByKey[key])) {
|
|
137722
|
+
actualCreditByKey[key] = creditAchieved;
|
|
137723
|
+
}
|
|
137724
|
+
}
|
|
137725
|
+
}
|
|
137726
|
+
const creditAchievedPerInput = {};
|
|
137727
|
+
for (const key of Object.keys(maxCreditByKey)) {
|
|
137728
|
+
const maxCredit = maxCreditByKey[key];
|
|
137729
|
+
if (maxCredit > 0) {
|
|
137730
|
+
creditAchievedPerInput[key] = (actualCreditByKey[key] ?? 0) / maxCredit;
|
|
137731
|
+
}
|
|
137732
|
+
}
|
|
137733
|
+
return { setValue: { creditAchievedPerInput } };
|
|
137734
|
+
}
|
|
137735
|
+
};
|
|
137417
137736
|
stateVariableDefinitions.numPreviousIncorrectSubmissions = {
|
|
137418
137737
|
defaultValue: 0,
|
|
137419
137738
|
hasEssential: true,
|
|
@@ -138490,6 +138809,60 @@ class Award extends BaseComponent {
|
|
|
138490
138809
|
targetVariableName: "feedback1",
|
|
138491
138810
|
description: "The first feedback message produced by this award."
|
|
138492
138811
|
};
|
|
138812
|
+
stateVariableDefinitions.colorInputsSeparatelyFromAnswer = {
|
|
138813
|
+
returnDependencies: () => ({
|
|
138814
|
+
colorInputsSeparately: {
|
|
138815
|
+
dependencyType: "parentStateVariable",
|
|
138816
|
+
variableName: "colorInputsSeparately"
|
|
138817
|
+
}
|
|
138818
|
+
}),
|
|
138819
|
+
definition({ dependencyValues }) {
|
|
138820
|
+
return {
|
|
138821
|
+
setValue: {
|
|
138822
|
+
colorInputsSeparatelyFromAnswer: dependencyValues.colorInputsSeparately ?? false
|
|
138823
|
+
}
|
|
138824
|
+
};
|
|
138825
|
+
}
|
|
138826
|
+
};
|
|
138827
|
+
stateVariableDefinitions.referencedInputStateVars = {
|
|
138828
|
+
stateVariablesDeterminingDependencies: [
|
|
138829
|
+
"colorInputsSeparatelyFromAnswer"
|
|
138830
|
+
],
|
|
138831
|
+
returnDependencies({ stateValues }) {
|
|
138832
|
+
const deps = {
|
|
138833
|
+
colorInputsSeparatelyFromAnswer: {
|
|
138834
|
+
dependencyType: "parentStateVariable",
|
|
138835
|
+
variableName: "colorInputsSeparately"
|
|
138836
|
+
}
|
|
138837
|
+
};
|
|
138838
|
+
if (stateValues.colorInputsSeparatelyFromAnswer) {
|
|
138839
|
+
deps.allInputComponentIdxs = {
|
|
138840
|
+
dependencyType: "parentStateVariable",
|
|
138841
|
+
variableName: "allInputComponentIdxs"
|
|
138842
|
+
};
|
|
138843
|
+
deps.whenChild = {
|
|
138844
|
+
dependencyType: "child",
|
|
138845
|
+
childGroups: ["whens"],
|
|
138846
|
+
variableNames: ["referencedStateVars"]
|
|
138847
|
+
};
|
|
138848
|
+
}
|
|
138849
|
+
return deps;
|
|
138850
|
+
},
|
|
138851
|
+
definition({ dependencyValues }) {
|
|
138852
|
+
if (!dependencyValues.colorInputsSeparatelyFromAnswer) {
|
|
138853
|
+
return { setValue: { referencedInputStateVars: [] } };
|
|
138854
|
+
}
|
|
138855
|
+
const allInputComponentIdxs = dependencyValues.allInputComponentIdxs ?? /* @__PURE__ */ new Set();
|
|
138856
|
+
const referencedStateVars = dependencyValues.whenChild?.[0]?.stateValues.referencedStateVars ?? [];
|
|
138857
|
+
return {
|
|
138858
|
+
setValue: {
|
|
138859
|
+
referencedInputStateVars: referencedStateVars.filter(
|
|
138860
|
+
(ref) => allInputComponentIdxs.has(ref.componentIdx)
|
|
138861
|
+
)
|
|
138862
|
+
}
|
|
138863
|
+
};
|
|
138864
|
+
}
|
|
138865
|
+
};
|
|
138493
138866
|
return stateVariableDefinitions;
|
|
138494
138867
|
}
|
|
138495
138868
|
static standardizedFeedback = {
|
|
@@ -138721,6 +139094,43 @@ class When extends BooleanComponent {
|
|
|
138721
139094
|
};
|
|
138722
139095
|
}
|
|
138723
139096
|
};
|
|
139097
|
+
stateVariableDefinitions._descendantIdxs = {
|
|
139098
|
+
returnDependencies: () => ({
|
|
139099
|
+
allDescendants: {
|
|
139100
|
+
dependencyType: "descendant",
|
|
139101
|
+
componentTypes: ["_base"]
|
|
139102
|
+
}
|
|
139103
|
+
}),
|
|
139104
|
+
definition({ dependencyValues }) {
|
|
139105
|
+
return {
|
|
139106
|
+
setValue: {
|
|
139107
|
+
_descendantIdxs: (dependencyValues.allDescendants ?? []).map((d2) => d2.componentIdx)
|
|
139108
|
+
}
|
|
139109
|
+
};
|
|
139110
|
+
}
|
|
139111
|
+
};
|
|
139112
|
+
stateVariableDefinitions.referencedStateVars = {
|
|
139113
|
+
stateVariablesDeterminingDependencies: ["_descendantIdxs"],
|
|
139114
|
+
returnDependencies({ stateValues }) {
|
|
139115
|
+
const deps = {};
|
|
139116
|
+
for (const idx of stateValues._descendantIdxs ?? []) {
|
|
139117
|
+
deps[`shadowInfo_${idx}`] = {
|
|
139118
|
+
dependencyType: "shadowInfo",
|
|
139119
|
+
componentIdx: idx
|
|
139120
|
+
};
|
|
139121
|
+
}
|
|
139122
|
+
return deps;
|
|
139123
|
+
},
|
|
139124
|
+
definition({ dependencyValues }) {
|
|
139125
|
+
const referencedStateVars = [];
|
|
139126
|
+
for (const [key, value] of Object.entries(dependencyValues)) {
|
|
139127
|
+
if (key.startsWith("shadowInfo_") && value !== null) {
|
|
139128
|
+
referencedStateVars.push(value);
|
|
139129
|
+
}
|
|
139130
|
+
}
|
|
139131
|
+
return { setValue: { referencedStateVars } };
|
|
139132
|
+
}
|
|
139133
|
+
};
|
|
138724
139134
|
return stateVariableDefinitions;
|
|
138725
139135
|
}
|
|
138726
139136
|
// "when" does not adapt to "text", even though boolean does
|
|
@@ -228313,4 +228723,4 @@ export {
|
|
|
228313
228723
|
getDefaultExportFromCjs as g,
|
|
228314
228724
|
updateSyntaxFromV06toV07 as u
|
|
228315
228725
|
};
|
|
228316
|
-
//# sourceMappingURL=index-
|
|
228726
|
+
//# sourceMappingURL=index-BmXW0q7U.js.map
|