@doenet/v06-to-v07 0.7.0-beta11 → 0.7.0-beta12
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/core-info/core.d.ts.map +1 -1
- package/index.js +418 -23
- package/index.js.map +1 -1
- package/package.json +1 -1
package/core-info/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core-info/core.ts"],"names":[],"mappings":"AAAA,OAAa,EACT,kBAAkB,IAAI,sBAAsB,EAO/C,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAyB,QAAQ,EAAS,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/core-info/core.ts"],"names":[],"mappings":"AAAA,OAAa,EACT,kBAAkB,IAAI,sBAAsB,EAO/C,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAyB,QAAQ,EAAS,MAAM,gBAAgB,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAqCxE,MAAM,MAAM,oBAAoB,GAAG,OAAO,CACtC,UAAU,CAAC,OAAO,mBAAmB,CAAC,CACzC,CAAC,sBAAsB,CAAC,CAAC;AAE1B,wBAAsB,mBAAmB,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,EAAE,QAAQ,CAAA;CAAE;;;iCA8E9B,MAAM;GAS7C"}
|
package/index.js
CHANGED
|
@@ -10442,7 +10442,8 @@ function pretzelSugar(node) {
|
|
|
10442
10442
|
name: "_pretzelArranger",
|
|
10443
10443
|
children: node.children,
|
|
10444
10444
|
attributes: {},
|
|
10445
|
-
source_doc: node.source_doc
|
|
10445
|
+
source_doc: node.source_doc,
|
|
10446
|
+
position: node.position
|
|
10446
10447
|
}
|
|
10447
10448
|
];
|
|
10448
10449
|
}
|
|
@@ -61901,15 +61902,25 @@ class BaseComponent {
|
|
|
61901
61902
|
adapterSourceHidden: {
|
|
61902
61903
|
dependencyType: "adapterSourceStateVariable",
|
|
61903
61904
|
variableName: "hidden"
|
|
61905
|
+
},
|
|
61906
|
+
parentChildrenToHide: {
|
|
61907
|
+
dependencyType: "parentStateVariable",
|
|
61908
|
+
variableName: "childrenToHide"
|
|
61904
61909
|
}
|
|
61905
61910
|
}),
|
|
61906
|
-
definition: ({ dependencyValues }) =>
|
|
61907
|
-
|
|
61908
|
-
|
|
61909
|
-
|
|
61910
|
-
|
|
61911
|
-
|
|
61912
|
-
|
|
61911
|
+
definition: ({ dependencyValues, componentIdx }) => {
|
|
61912
|
+
return {
|
|
61913
|
+
setValue: {
|
|
61914
|
+
hidden: Boolean(
|
|
61915
|
+
dependencyValues.parentHidden || dependencyValues.sourceCompositeHidden || dependencyValues.adapterSourceHidden || dependencyValues.hide || Array.isArray(
|
|
61916
|
+
dependencyValues.parentChildrenToHide
|
|
61917
|
+
) && dependencyValues.parentChildrenToHide.includes(
|
|
61918
|
+
componentIdx
|
|
61919
|
+
)
|
|
61920
|
+
)
|
|
61921
|
+
}
|
|
61922
|
+
};
|
|
61923
|
+
},
|
|
61913
61924
|
markStale: () => ({ updateParentRenderedChildren: true }),
|
|
61914
61925
|
inverseDefinition({ desiredStateVariableValues }) {
|
|
61915
61926
|
return {
|
|
@@ -67637,12 +67648,16 @@ function returnScoredSectionStateVariableDefinition() {
|
|
|
67637
67648
|
sectionWideCheckWork: {
|
|
67638
67649
|
dependencyType: "stateVariable",
|
|
67639
67650
|
variableName: "sectionWideCheckWork"
|
|
67651
|
+
},
|
|
67652
|
+
parentChildrenAggregateScores: {
|
|
67653
|
+
dependencyType: "parentStateVariable",
|
|
67654
|
+
variableName: "childrenAggregateScores"
|
|
67640
67655
|
}
|
|
67641
67656
|
}),
|
|
67642
67657
|
definition({ dependencyValues }) {
|
|
67643
67658
|
return {
|
|
67644
67659
|
setValue: {
|
|
67645
|
-
aggregateScores: dependencyValues.aggregateScoresPreliminary || dependencyValues.sectionWideCheckWork
|
|
67660
|
+
aggregateScores: dependencyValues.aggregateScoresPreliminary || dependencyValues.sectionWideCheckWork || dependencyValues.parentChildrenAggregateScores
|
|
67646
67661
|
}
|
|
67647
67662
|
};
|
|
67648
67663
|
}
|
|
@@ -81078,6 +81093,12 @@ class SectioningComponent extends BlockComponent {
|
|
|
81078
81093
|
defaultValue: false,
|
|
81079
81094
|
public: true
|
|
81080
81095
|
};
|
|
81096
|
+
attributes.noAutoTitle = {
|
|
81097
|
+
createComponentOfType: "boolean",
|
|
81098
|
+
createStateVariable: "noAutoTitle",
|
|
81099
|
+
defaultValue: false,
|
|
81100
|
+
public: true
|
|
81101
|
+
};
|
|
81081
81102
|
attributes.includeAutoNameIfNoTitle = {
|
|
81082
81103
|
createComponentOfType: "boolean",
|
|
81083
81104
|
createStateVariable: "includeAutoNameIfNoTitle",
|
|
@@ -81101,6 +81122,16 @@ class SectioningComponent extends BlockComponent {
|
|
|
81101
81122
|
attributes.renameTo = {
|
|
81102
81123
|
createComponentOfType: "text"
|
|
81103
81124
|
};
|
|
81125
|
+
attributes.completedColor = {
|
|
81126
|
+
createComponentOfType: "text",
|
|
81127
|
+
createStateVariable: "completedColor",
|
|
81128
|
+
defaultValue: "var(--lightGreen)"
|
|
81129
|
+
};
|
|
81130
|
+
attributes.inProgressColor = {
|
|
81131
|
+
createComponentOfType: "text",
|
|
81132
|
+
createStateVariable: "inProgressColor",
|
|
81133
|
+
defaultValue: "var(--mainGray)"
|
|
81134
|
+
};
|
|
81104
81135
|
return attributes;
|
|
81105
81136
|
}
|
|
81106
81137
|
static returnChildGroups() {
|
|
@@ -81287,6 +81318,22 @@ class SectioningComponent extends BlockComponent {
|
|
|
81287
81318
|
};
|
|
81288
81319
|
}
|
|
81289
81320
|
};
|
|
81321
|
+
stateVariableDefinitions.hideChildren = {
|
|
81322
|
+
returnDependencies: () => ({
|
|
81323
|
+
parentChildrenToHideChildren: {
|
|
81324
|
+
dependencyType: "parentStateVariable",
|
|
81325
|
+
variableName: "childrenToHideChildren"
|
|
81326
|
+
}
|
|
81327
|
+
}),
|
|
81328
|
+
definition({ dependencyValues, componentIdx }) {
|
|
81329
|
+
let hideChildren = Boolean(
|
|
81330
|
+
dependencyValues.parentChildrenToHideChildren?.includes(
|
|
81331
|
+
componentIdx
|
|
81332
|
+
)
|
|
81333
|
+
);
|
|
81334
|
+
return { setValue: { hideChildren } };
|
|
81335
|
+
}
|
|
81336
|
+
};
|
|
81290
81337
|
stateVariableDefinitions.childIndicesToRender = {
|
|
81291
81338
|
returnDependencies: () => ({
|
|
81292
81339
|
titleChildren: {
|
|
@@ -81312,7 +81359,7 @@ class SectioningComponent extends BlockComponent {
|
|
|
81312
81359
|
}
|
|
81313
81360
|
}),
|
|
81314
81361
|
definition({ dependencyValues, componentInfoObjects: componentInfoObjects2 }) {
|
|
81315
|
-
|
|
81362
|
+
const childIndicesToRender = [];
|
|
81316
81363
|
let allTitleChildNames = dependencyValues.titleChildren.map(
|
|
81317
81364
|
(x2) => x2.componentIdx
|
|
81318
81365
|
);
|
|
@@ -81334,7 +81381,39 @@ class SectioningComponent extends BlockComponent {
|
|
|
81334
81381
|
}
|
|
81335
81382
|
}
|
|
81336
81383
|
return { setValue: { childIndicesToRender } };
|
|
81337
|
-
}
|
|
81384
|
+
},
|
|
81385
|
+
markStale: () => ({ updateRenderedChildren: true })
|
|
81386
|
+
};
|
|
81387
|
+
stateVariableDefinitions.childrenToHide = {
|
|
81388
|
+
returnDependencies: () => ({
|
|
81389
|
+
allChildren: {
|
|
81390
|
+
dependencyType: "child",
|
|
81391
|
+
childGroups: [
|
|
81392
|
+
"anything",
|
|
81393
|
+
"variantControls",
|
|
81394
|
+
"titles",
|
|
81395
|
+
"setups"
|
|
81396
|
+
]
|
|
81397
|
+
},
|
|
81398
|
+
titleChildName: {
|
|
81399
|
+
dependencyType: "stateVariable",
|
|
81400
|
+
variableName: "titleChildName"
|
|
81401
|
+
},
|
|
81402
|
+
hideChildren: {
|
|
81403
|
+
dependencyType: "stateVariable",
|
|
81404
|
+
variableName: "hideChildren"
|
|
81405
|
+
}
|
|
81406
|
+
}),
|
|
81407
|
+
definition({ dependencyValues }) {
|
|
81408
|
+
const childrenToHide = [];
|
|
81409
|
+
for (let child of dependencyValues.allChildren) {
|
|
81410
|
+
if (dependencyValues.hideChildren && child.componentIdx !== dependencyValues.titleChildName) {
|
|
81411
|
+
childrenToHide.push(child.componentIdx);
|
|
81412
|
+
}
|
|
81413
|
+
}
|
|
81414
|
+
return { setValue: { childrenToHide } };
|
|
81415
|
+
},
|
|
81416
|
+
markStale: () => ({ updateRenderedChildren: true })
|
|
81338
81417
|
};
|
|
81339
81418
|
stateVariableDefinitions.startsWithIntroduction = {
|
|
81340
81419
|
additionalStateVariablesDefined: [
|
|
@@ -81418,14 +81497,18 @@ class SectioningComponent extends BlockComponent {
|
|
|
81418
81497
|
includeAutoNumberIfNoTitle: {
|
|
81419
81498
|
dependencyType: "stateVariable",
|
|
81420
81499
|
variableName: "includeAutoNumberIfNoTitle"
|
|
81500
|
+
},
|
|
81501
|
+
noAutoTitle: {
|
|
81502
|
+
dependencyType: "stateVariable",
|
|
81503
|
+
variableName: "noAutoTitle"
|
|
81421
81504
|
}
|
|
81422
81505
|
}),
|
|
81423
81506
|
definition({ dependencyValues }) {
|
|
81424
81507
|
let titlePrefix = "";
|
|
81425
81508
|
let title2 = "";
|
|
81426
81509
|
const haveTitleChild = dependencyValues.titleChild.length > 0;
|
|
81427
|
-
let includeAutoNumber = (dependencyValues.includeAutoNumber || !haveTitleChild && dependencyValues.includeAutoNumberIfNoTitle) && !dependencyValues.prerender;
|
|
81428
|
-
let includeAutoName = dependencyValues.includeAutoName || !haveTitleChild && dependencyValues.includeAutoNameIfNoTitle;
|
|
81510
|
+
let includeAutoNumber = (dependencyValues.includeAutoNumber || !haveTitleChild && dependencyValues.includeAutoNumberIfNoTitle && !dependencyValues.noAutoTitle) && !dependencyValues.prerender;
|
|
81511
|
+
let includeAutoName = dependencyValues.includeAutoName || !haveTitleChild && dependencyValues.includeAutoNameIfNoTitle && !dependencyValues.noAutoTitle;
|
|
81429
81512
|
if (includeAutoNumber) {
|
|
81430
81513
|
if (includeAutoName) {
|
|
81431
81514
|
titlePrefix = dependencyValues.sectionName + " ";
|
|
@@ -81451,6 +81534,53 @@ class SectioningComponent extends BlockComponent {
|
|
|
81451
81534
|
return { setValue: { title: title2, titlePrefix } };
|
|
81452
81535
|
}
|
|
81453
81536
|
};
|
|
81537
|
+
stateVariableDefinitions.titleColor = {
|
|
81538
|
+
// Note: currently title color is used only when boxed or collapsible
|
|
81539
|
+
forRenderer: true,
|
|
81540
|
+
returnDependencies: () => ({
|
|
81541
|
+
completedColor: {
|
|
81542
|
+
dependencyType: "stateVariable",
|
|
81543
|
+
variableName: "completedColor"
|
|
81544
|
+
},
|
|
81545
|
+
inProgressColor: {
|
|
81546
|
+
dependencyType: "stateVariable",
|
|
81547
|
+
variableName: "inProgressColor"
|
|
81548
|
+
},
|
|
81549
|
+
parentCompletedColor: {
|
|
81550
|
+
dependencyType: "parentStateVariable",
|
|
81551
|
+
variableName: "completedColor"
|
|
81552
|
+
},
|
|
81553
|
+
parentInProgressColor: {
|
|
81554
|
+
dependencyType: "parentStateVariable",
|
|
81555
|
+
variableName: "inProgressColor"
|
|
81556
|
+
},
|
|
81557
|
+
creditAchieved: {
|
|
81558
|
+
dependencyType: "stateVariable",
|
|
81559
|
+
variableName: "creditAchieved"
|
|
81560
|
+
}
|
|
81561
|
+
}),
|
|
81562
|
+
definition({ dependencyValues, usedDefault }) {
|
|
81563
|
+
let titleColor = dependencyValues.inProgressColor;
|
|
81564
|
+
if (dependencyValues.creditAchieved === 1) {
|
|
81565
|
+
if (!usedDefault.completedColor) {
|
|
81566
|
+
titleColor = dependencyValues.completedColor;
|
|
81567
|
+
} else if (typeof dependencyValues.parentCompletedColor === "string") {
|
|
81568
|
+
titleColor = dependencyValues.parentCompletedColor;
|
|
81569
|
+
} else {
|
|
81570
|
+
titleColor = dependencyValues.completedColor;
|
|
81571
|
+
}
|
|
81572
|
+
} else {
|
|
81573
|
+
if (!usedDefault.inProgressColor) {
|
|
81574
|
+
titleColor = dependencyValues.inProgressColor;
|
|
81575
|
+
} else if (typeof dependencyValues.parentInProgressColor === "string") {
|
|
81576
|
+
titleColor = dependencyValues.parentInProgressColor;
|
|
81577
|
+
} else {
|
|
81578
|
+
titleColor = dependencyValues.inProgressColor;
|
|
81579
|
+
}
|
|
81580
|
+
}
|
|
81581
|
+
return { setValue: { titleColor } };
|
|
81582
|
+
}
|
|
81583
|
+
};
|
|
81454
81584
|
stateVariableDefinitions.containerTag = {
|
|
81455
81585
|
forRenderer: true,
|
|
81456
81586
|
returnDependencies: () => ({}),
|
|
@@ -179176,6 +179306,12 @@ class SelectFromSequence extends Sequence {
|
|
|
179176
179306
|
attributes.excludeCombinations = {
|
|
179177
179307
|
createComponentOfType: "_componentListOfListsWithSelectableType"
|
|
179178
179308
|
};
|
|
179309
|
+
attributes.coprimeCombinations = {
|
|
179310
|
+
createComponentOfType: "boolean",
|
|
179311
|
+
createStateVariable: "coprimeCombinations",
|
|
179312
|
+
defaultValue: false,
|
|
179313
|
+
public: true
|
|
179314
|
+
};
|
|
179179
179315
|
return attributes;
|
|
179180
179316
|
}
|
|
179181
179317
|
static returnStateVariableDefinitions() {
|
|
@@ -179194,9 +179330,20 @@ class SelectFromSequence extends Sequence {
|
|
|
179194
179330
|
numToSelect: {
|
|
179195
179331
|
dependencyType: "stateVariable",
|
|
179196
179332
|
variableName: "numToSelect"
|
|
179333
|
+
},
|
|
179334
|
+
coprimeCombinations: {
|
|
179335
|
+
dependencyType: "stateVariable",
|
|
179336
|
+
variableName: "coprimeCombinations"
|
|
179197
179337
|
}
|
|
179198
179338
|
}),
|
|
179199
179339
|
definition: function({ dependencyValues }) {
|
|
179340
|
+
const warnings = [];
|
|
179341
|
+
if (dependencyValues.coprimeCombinations && dependencyValues.type !== "number") {
|
|
179342
|
+
warnings.push({
|
|
179343
|
+
message: "coprimeCombinations ignored since not selecting numbers",
|
|
179344
|
+
level: 1
|
|
179345
|
+
});
|
|
179346
|
+
}
|
|
179200
179347
|
if (dependencyValues.excludeCombinations !== null) {
|
|
179201
179348
|
let excludedCombinations = dependencyValues.excludeCombinations.stateValues.lists.map(
|
|
179202
179349
|
(x2) => x2.slice(0, dependencyValues.numToSelect)
|
|
@@ -179214,12 +179361,24 @@ class SelectFromSequence extends Sequence {
|
|
|
179214
179361
|
break;
|
|
179215
179362
|
}
|
|
179216
179363
|
}
|
|
179364
|
+
if (dependencyValues.coprimeCombinations) {
|
|
179365
|
+
warnings.push({
|
|
179366
|
+
message: "coprimeCombinations ignored since excludeCombinations specified",
|
|
179367
|
+
level: 1
|
|
179368
|
+
});
|
|
179369
|
+
}
|
|
179217
179370
|
}
|
|
179218
179371
|
return {
|
|
179219
|
-
setValue: { excludedCombinations }
|
|
179372
|
+
setValue: { excludedCombinations },
|
|
179373
|
+
sendWarnings: warnings
|
|
179220
179374
|
};
|
|
179221
179375
|
} else {
|
|
179222
|
-
return {
|
|
179376
|
+
return {
|
|
179377
|
+
setValue: {
|
|
179378
|
+
excludedCombinations: []
|
|
179379
|
+
},
|
|
179380
|
+
sendWarnings: warnings
|
|
179381
|
+
};
|
|
179223
179382
|
}
|
|
179224
179383
|
}
|
|
179225
179384
|
};
|
|
@@ -179280,6 +179439,10 @@ class SelectFromSequence extends Sequence {
|
|
|
179280
179439
|
dependencyType: "stateVariable",
|
|
179281
179440
|
variableName: "excludedCombinations"
|
|
179282
179441
|
},
|
|
179442
|
+
coprimeCombinations: {
|
|
179443
|
+
dependencyType: "stateVariable",
|
|
179444
|
+
variableName: "coprimeCombinations"
|
|
179445
|
+
},
|
|
179283
179446
|
type: {
|
|
179284
179447
|
dependencyType: "stateVariable",
|
|
179285
179448
|
variableName: "type"
|
|
@@ -179426,6 +179589,15 @@ class SelectFromSequence extends Sequence {
|
|
|
179426
179589
|
return { success: false };
|
|
179427
179590
|
}
|
|
179428
179591
|
}
|
|
179592
|
+
let coprimeCombinationsComponent = serializedComponent.attributes.coprimeCombinations?.component;
|
|
179593
|
+
if (coprimeCombinationsComponent) {
|
|
179594
|
+
if (!(coprimeCombinationsComponent.componentType === "boolean" && coprimeCombinationsComponent.children?.length === 1 && typeof coprimeCombinationsComponent.children[0] === "string" && coprimeCombinationsComponent.children[0].trim().toLowerCase() === "false")) {
|
|
179595
|
+
console.log(
|
|
179596
|
+
`cannot determine unique variants of selectFromSequence as cannot determine coprimeCombinations is always false.`
|
|
179597
|
+
);
|
|
179598
|
+
return { success: false };
|
|
179599
|
+
}
|
|
179600
|
+
}
|
|
179429
179601
|
let withReplacementComponent = serializedComponent.attributes.withReplacement?.component;
|
|
179430
179602
|
if (withReplacementComponent) {
|
|
179431
179603
|
if (withReplacementComponent.componentType === "boolean") {
|
|
@@ -179878,16 +180050,57 @@ function makeSelection$1({ dependencyValues }) {
|
|
|
179878
180050
|
}
|
|
179879
180051
|
}
|
|
179880
180052
|
let numCombinationsExcluded = dependencyValues.excludedCombinations.length;
|
|
180053
|
+
let coprimeCombinations = dependencyValues.coprimeCombinations;
|
|
179881
180054
|
if (dependencyValues.type === "number") {
|
|
180055
|
+
let errorMessage = null;
|
|
179882
180056
|
numCombinationsExcluded = estimateNumberOfNumberCombinationsExcluded({
|
|
179883
180057
|
excludedCombinations: dependencyValues.excludedCombinations,
|
|
179884
180058
|
numValues: dependencyValues.length - dependencyValues.exclude.length,
|
|
179885
180059
|
withReplacement: dependencyValues.withReplacement,
|
|
179886
180060
|
numToSelect: dependencyValues.numToSelect
|
|
179887
180061
|
});
|
|
180062
|
+
if (coprimeCombinations) {
|
|
180063
|
+
const lastNumber = dependencyValues.from + (dependencyValues.length - 1) * dependencyValues.step;
|
|
180064
|
+
if (numCombinationsExcluded > 0) {
|
|
180065
|
+
coprimeCombinations = false;
|
|
180066
|
+
} else if (!Number.isInteger(dependencyValues.from) || !Number.isInteger(dependencyValues.step) || dependencyValues.from <= 0 || lastNumber <= 0) {
|
|
180067
|
+
errorMessage = "Cannot select coprime combinations as not selecting positive integers.";
|
|
180068
|
+
} else if (Context.math.gcd(dependencyValues.from, dependencyValues.step) !== 1) {
|
|
180069
|
+
errorMessage = `Cannot select coprime numbers. All possible values share a common factor. (Specified values of "from" or "to" must be coprime with "step".)`;
|
|
180070
|
+
} else if (dependencyValues.numToSelect === 1) {
|
|
180071
|
+
coprimeCombinations = false;
|
|
180072
|
+
} else if (dependencyValues.length - dependencyValues.exclude.length <= 1) {
|
|
180073
|
+
if (dependencyValues.from > 1 || dependencyValues.exclude.includes(1)) {
|
|
180074
|
+
if (dependencyValues.length <= 1) {
|
|
180075
|
+
errorMessage = "Cannot select coprime combinations from a single number that is not 1.";
|
|
180076
|
+
} else {
|
|
180077
|
+
const possibleValues = returnSequenceValues(dependencyValues);
|
|
180078
|
+
if (possibleValues.length <= 1) {
|
|
180079
|
+
errorMessage = "Cannot select coprime combinations from a single number that is not 1.";
|
|
180080
|
+
}
|
|
180081
|
+
}
|
|
180082
|
+
}
|
|
180083
|
+
}
|
|
180084
|
+
}
|
|
180085
|
+
if (errorMessage) {
|
|
180086
|
+
return {
|
|
180087
|
+
setEssentialValue: {
|
|
180088
|
+
errorMessage,
|
|
180089
|
+
selectedValues: null,
|
|
180090
|
+
selectedIndices: null
|
|
180091
|
+
},
|
|
180092
|
+
setValue: {
|
|
180093
|
+
errorMessage,
|
|
180094
|
+
selectedValues: null,
|
|
180095
|
+
selectedIndices: null
|
|
180096
|
+
}
|
|
180097
|
+
};
|
|
180098
|
+
}
|
|
180099
|
+
} else {
|
|
180100
|
+
coprimeCombinations = false;
|
|
179888
180101
|
}
|
|
179889
180102
|
let selectedValues, selectedIndices;
|
|
179890
|
-
if (numCombinationsExcluded === 0) {
|
|
180103
|
+
if (numCombinationsExcluded === 0 && !coprimeCombinations) {
|
|
179891
180104
|
let selectedObj = selectValuesAndIndices({
|
|
179892
180105
|
stateValues: dependencyValues,
|
|
179893
180106
|
numUniqueRequired,
|
|
@@ -180023,11 +180236,19 @@ function makeSelection$1({ dependencyValues }) {
|
|
|
180023
180236
|
})) {
|
|
180024
180237
|
continue;
|
|
180025
180238
|
}
|
|
180239
|
+
if (coprimeCombinations && Context.math.gcd(...selectedValues) !== 1) {
|
|
180240
|
+
continue;
|
|
180241
|
+
}
|
|
180026
180242
|
foundValidCombination = true;
|
|
180027
180243
|
break;
|
|
180028
180244
|
}
|
|
180029
180245
|
if (!foundValidCombination) {
|
|
180030
|
-
let errorMessage
|
|
180246
|
+
let errorMessage;
|
|
180247
|
+
if (coprimeCombinations) {
|
|
180248
|
+
errorMessage = "Could not select coprime numbers. All possible values share a common factor.";
|
|
180249
|
+
} else {
|
|
180250
|
+
errorMessage = "By extremely unlikely fluke, couldn't select combination of random values";
|
|
180251
|
+
}
|
|
180031
180252
|
return {
|
|
180032
180253
|
setEssentialValue: {
|
|
180033
180254
|
errorMessage,
|
|
@@ -201226,10 +201447,6 @@ class PretzelArranger extends CompositeComponent {
|
|
|
201226
201447
|
stateVariableDefinitions.statements = {
|
|
201227
201448
|
additionalStateVariablesDefined: ["givenAnswers", "validProblems"],
|
|
201228
201449
|
returnDependencies: () => ({
|
|
201229
|
-
numProblems: {
|
|
201230
|
-
dependencyType: "stateVariable",
|
|
201231
|
-
variableName: "numProblems"
|
|
201232
|
-
},
|
|
201233
201450
|
serializedProblemChildren: {
|
|
201234
201451
|
dependencyType: "stateVariable",
|
|
201235
201452
|
variableName: "serializedProblemChildren"
|
|
@@ -201306,7 +201523,19 @@ class PretzelArranger extends CompositeComponent {
|
|
|
201306
201523
|
const problemIdx = problemOrder[i2] - 1;
|
|
201307
201524
|
const thisStatement = statements[problemIdx];
|
|
201308
201525
|
const prevAnswer = givenAnswers[(problemIdx - 1 + numProblems) % numProblems];
|
|
201309
|
-
|
|
201526
|
+
if (prevAnswer === null) {
|
|
201527
|
+
replacements.push({
|
|
201528
|
+
type: "serialized",
|
|
201529
|
+
componentType: "span",
|
|
201530
|
+
componentIdx: nComponents++,
|
|
201531
|
+
attributes: {},
|
|
201532
|
+
doenetAttributes: {},
|
|
201533
|
+
state: {},
|
|
201534
|
+
children: []
|
|
201535
|
+
});
|
|
201536
|
+
} else {
|
|
201537
|
+
replacements.push(prevAnswer);
|
|
201538
|
+
}
|
|
201310
201539
|
replacements.push({
|
|
201311
201540
|
type: "serialized",
|
|
201312
201541
|
componentType: "textInput",
|
|
@@ -201332,7 +201561,19 @@ class PretzelArranger extends CompositeComponent {
|
|
|
201332
201561
|
state: {},
|
|
201333
201562
|
children: []
|
|
201334
201563
|
});
|
|
201335
|
-
|
|
201564
|
+
if (thisStatement === null) {
|
|
201565
|
+
replacements.push({
|
|
201566
|
+
type: "serialized",
|
|
201567
|
+
componentType: "statement",
|
|
201568
|
+
componentIdx: nComponents++,
|
|
201569
|
+
attributes: {},
|
|
201570
|
+
doenetAttributes: {},
|
|
201571
|
+
state: {},
|
|
201572
|
+
children: []
|
|
201573
|
+
});
|
|
201574
|
+
} else {
|
|
201575
|
+
replacements.push(thisStatement);
|
|
201576
|
+
}
|
|
201336
201577
|
}
|
|
201337
201578
|
return {
|
|
201338
201579
|
replacements,
|
|
@@ -201456,6 +201697,158 @@ class PretzelArranger extends CompositeComponent {
|
|
|
201456
201697
|
return { success: true, desiredVariant };
|
|
201457
201698
|
}
|
|
201458
201699
|
}
|
|
201700
|
+
class Cascade extends SectioningComponent {
|
|
201701
|
+
static componentType = "cascade";
|
|
201702
|
+
static rendererType = "section";
|
|
201703
|
+
static includeBlankStringChildren = false;
|
|
201704
|
+
static createAttributesObject() {
|
|
201705
|
+
let attributes = super.createAttributesObject();
|
|
201706
|
+
attributes.hideFutureSections = {
|
|
201707
|
+
createComponentOfType: "boolean",
|
|
201708
|
+
createStateVariable: "hideFutureSections",
|
|
201709
|
+
defaultValue: false,
|
|
201710
|
+
public: true
|
|
201711
|
+
};
|
|
201712
|
+
attributes.noAutoTitle.defaultValue = true;
|
|
201713
|
+
attributes.revealAll = {
|
|
201714
|
+
createComponentOfType: "boolean",
|
|
201715
|
+
createStateVariable: "revealAllPreliminary",
|
|
201716
|
+
defaultValue: false
|
|
201717
|
+
};
|
|
201718
|
+
return attributes;
|
|
201719
|
+
}
|
|
201720
|
+
static returnStateVariableDefinitions() {
|
|
201721
|
+
let stateVariableDefinitions = super.returnStateVariableDefinitions();
|
|
201722
|
+
stateVariableDefinitions.childrenAggregateScores = {
|
|
201723
|
+
returnDependencies: () => ({}),
|
|
201724
|
+
definition: () => ({ setValue: { childrenAggregateScores: true } })
|
|
201725
|
+
};
|
|
201726
|
+
stateVariableDefinitions.childCreditAchieved = {
|
|
201727
|
+
returnDependencies: () => ({
|
|
201728
|
+
children: {
|
|
201729
|
+
dependencyType: "child",
|
|
201730
|
+
childGroups: ["anything"],
|
|
201731
|
+
variableNames: ["creditAchieved"],
|
|
201732
|
+
variablesOptional: true
|
|
201733
|
+
}
|
|
201734
|
+
}),
|
|
201735
|
+
definition({ dependencyValues }) {
|
|
201736
|
+
const childCreditAchieved = dependencyValues.children.map(
|
|
201737
|
+
(child) => child.stateValues?.creditAchieved ?? null
|
|
201738
|
+
);
|
|
201739
|
+
return { setValue: { childCreditAchieved } };
|
|
201740
|
+
}
|
|
201741
|
+
};
|
|
201742
|
+
stateVariableDefinitions.numCompleted = {
|
|
201743
|
+
public: true,
|
|
201744
|
+
shadowingInstructions: {
|
|
201745
|
+
createComponentOfType: "integer"
|
|
201746
|
+
},
|
|
201747
|
+
returnDependencies: () => ({
|
|
201748
|
+
childCreditAchieved: {
|
|
201749
|
+
dependencyType: "stateVariable",
|
|
201750
|
+
variableName: "childCreditAchieved"
|
|
201751
|
+
}
|
|
201752
|
+
}),
|
|
201753
|
+
definition({ dependencyValues }) {
|
|
201754
|
+
let numCompleted = 0;
|
|
201755
|
+
for (const childCredit of dependencyValues.childCreditAchieved) {
|
|
201756
|
+
if (childCredit === 1 || childCredit === null) {
|
|
201757
|
+
numCompleted++;
|
|
201758
|
+
} else {
|
|
201759
|
+
break;
|
|
201760
|
+
}
|
|
201761
|
+
}
|
|
201762
|
+
return { setValue: { numCompleted } };
|
|
201763
|
+
}
|
|
201764
|
+
};
|
|
201765
|
+
stateVariableDefinitions.revealAll = {
|
|
201766
|
+
returnDependencies: () => ({
|
|
201767
|
+
cascadeAncestor: {
|
|
201768
|
+
dependencyType: "ancestor",
|
|
201769
|
+
componentType: "cascade",
|
|
201770
|
+
variableNames: ["revealAll"]
|
|
201771
|
+
},
|
|
201772
|
+
revealAllPreliminary: {
|
|
201773
|
+
dependencyType: "stateVariable",
|
|
201774
|
+
variableName: "revealAllPreliminary"
|
|
201775
|
+
}
|
|
201776
|
+
}),
|
|
201777
|
+
definition({ dependencyValues, usedDefault }) {
|
|
201778
|
+
let revealAll = false;
|
|
201779
|
+
if (!usedDefault.revealAllPreliminary) {
|
|
201780
|
+
revealAll = dependencyValues.revealAllPreliminary;
|
|
201781
|
+
} else if (dependencyValues.cascadeAncestor) {
|
|
201782
|
+
revealAll = dependencyValues.cascadeAncestor.stateValues.revealAll;
|
|
201783
|
+
} else {
|
|
201784
|
+
dependencyValues.revealAllPreliminary;
|
|
201785
|
+
}
|
|
201786
|
+
return { setValue: { revealAll } };
|
|
201787
|
+
}
|
|
201788
|
+
};
|
|
201789
|
+
stateVariableDefinitions.childrenToHide = {
|
|
201790
|
+
additionalStateVariablesDefined: ["childrenToHideChildren"],
|
|
201791
|
+
returnDependencies: () => ({
|
|
201792
|
+
hideFutureSections: {
|
|
201793
|
+
dependencyType: "stateVariable",
|
|
201794
|
+
variableName: "hideFutureSections"
|
|
201795
|
+
},
|
|
201796
|
+
numCompleted: {
|
|
201797
|
+
dependencyType: "stateVariable",
|
|
201798
|
+
variableName: "numCompleted"
|
|
201799
|
+
},
|
|
201800
|
+
children: {
|
|
201801
|
+
dependencyType: "child",
|
|
201802
|
+
childGroups: ["anything"]
|
|
201803
|
+
},
|
|
201804
|
+
revealAll: {
|
|
201805
|
+
dependencyType: "stateVariable",
|
|
201806
|
+
variableName: "revealAll"
|
|
201807
|
+
},
|
|
201808
|
+
hideChildren: {
|
|
201809
|
+
dependencyType: "stateVariable",
|
|
201810
|
+
variableName: "hideChildren"
|
|
201811
|
+
}
|
|
201812
|
+
}),
|
|
201813
|
+
definition({ dependencyValues, componentInfoObjects: componentInfoObjects2 }) {
|
|
201814
|
+
if (dependencyValues.revealAll) {
|
|
201815
|
+
return {
|
|
201816
|
+
setValue: {
|
|
201817
|
+
childrenToHide: [],
|
|
201818
|
+
childrenToHideChildren: []
|
|
201819
|
+
}
|
|
201820
|
+
};
|
|
201821
|
+
}
|
|
201822
|
+
const childrenToHide = [];
|
|
201823
|
+
const childrenToHideChildren = [];
|
|
201824
|
+
for (const [
|
|
201825
|
+
idx,
|
|
201826
|
+
child
|
|
201827
|
+
] of dependencyValues.children.entries()) {
|
|
201828
|
+
if (idx <= dependencyValues.numCompleted) {
|
|
201829
|
+
if (dependencyValues.hideChildren) {
|
|
201830
|
+
childrenToHide.push(child.componentIdx);
|
|
201831
|
+
}
|
|
201832
|
+
} else if (!dependencyValues.hideChildren && !dependencyValues.hideFutureSections && componentInfoObjects2.isInheritedComponentType({
|
|
201833
|
+
inheritedComponentType: child.componentType,
|
|
201834
|
+
baseComponentType: "_sectioningComponent"
|
|
201835
|
+
})) {
|
|
201836
|
+
childrenToHideChildren.push(child.componentIdx);
|
|
201837
|
+
} else {
|
|
201838
|
+
childrenToHide.push(child.componentIdx);
|
|
201839
|
+
}
|
|
201840
|
+
}
|
|
201841
|
+
return {
|
|
201842
|
+
setValue: {
|
|
201843
|
+
childrenToHide,
|
|
201844
|
+
childrenToHideChildren
|
|
201845
|
+
}
|
|
201846
|
+
};
|
|
201847
|
+
}
|
|
201848
|
+
};
|
|
201849
|
+
return stateVariableDefinitions;
|
|
201850
|
+
}
|
|
201851
|
+
}
|
|
201459
201852
|
const unitConversions = {
|
|
201460
201853
|
"": 1,
|
|
201461
201854
|
px: 1,
|
|
@@ -205399,6 +205792,7 @@ const componentTypeArray = [
|
|
|
205399
205792
|
StickyGroup,
|
|
205400
205793
|
Pretzel,
|
|
205401
205794
|
PretzelArranger,
|
|
205795
|
+
Cascade,
|
|
205402
205796
|
BaseComponent,
|
|
205403
205797
|
InlineComponent,
|
|
205404
205798
|
BlockComponent,
|
|
@@ -207045,6 +207439,7 @@ const defaultFlags = {
|
|
|
207045
207439
|
allowSaveState: true,
|
|
207046
207440
|
allowLocalState: false,
|
|
207047
207441
|
allowSaveEvents: true,
|
|
207442
|
+
messageParent: false,
|
|
207048
207443
|
autoSubmit: false
|
|
207049
207444
|
};
|
|
207050
207445
|
async function createCoreForLookup({ dast }) {
|