@doenet/v06-to-v07 0.7.0-beta-18 → 0.7.0-beta-20

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.js CHANGED
@@ -30700,29 +30700,31 @@ const f$2 = function(e4) {
30700
30700
  if (t2 && (i2 = remove_units(i2, r2)), "number" == typeof i2) return i2;
30701
30701
  if ("string" == typeof i2) return "pi" === i2 && math$1.define_pi ? Math.PI : "e" === i2 && math$1.define_e ? Math.E : "i" === i2 && math$1.define_i ? { re: 0, im: 1 } : n3 ? NaN : null;
30702
30702
  if (!Array.isArray(i2)) return n3 ? NaN : null;
30703
- var a2 = n3 ? NaN : null;
30703
+ var a2 = [];
30704
+ a2.push([["^", "x", ["/", "m", "n"]], ["^", ["apply", "nthRoot", ["tuple", "x", "n"]], "m"], { variables: { x: (e5) => e5 < 0, n: (e5) => Number.isInteger(e5) && Number.isInteger((e5 - 1) / 2), m: (e5) => Number.isInteger(e5) } }]), a2.push([["^", "x", ["-", ["/", "m", "n"]]], ["^", ["apply", "nthRoot", ["tuple", "x", "n"]], ["-", "m"]], { variables: { x: (e5) => e5 < 0, n: (e5) => Number.isInteger(e5) && Number.isInteger((e5 - 1) / 2), m: (e5) => Number.isInteger(e5) } }]), i2 = applyAllTransformations(i2, a2, 40);
30705
+ var o2 = n3 ? NaN : null;
30704
30706
  try {
30705
- a2 = f$2(i2)();
30707
+ o2 = f$2(i2)();
30706
30708
  } catch (e5) {
30707
30709
  }
30708
- if (!Number.isNaN(a2) && ("number" == typeof a2 || "number" == typeof a2?.re && "number" == typeof a2?.im)) {
30709
- if (a2.re === 1 / 0 || a2.re === -1 / 0 || a2.im === 1 / 0 || a2.im === -1 / 0) {
30710
+ if (!Number.isNaN(o2) && ("number" == typeof o2 || "number" == typeof o2?.re && "number" == typeof o2?.im)) {
30711
+ if (o2.re === 1 / 0 || o2.re === -1 / 0 || o2.im === 1 / 0 || o2.im === -1 / 0) {
30710
30712
  let e5;
30711
- if ("number" == typeof a2?.re && "number" == typeof a2?.im) if (0 === a2.im) e5 = a2.re;
30713
+ if ("number" == typeof o2?.re && "number" == typeof o2?.im) if (0 === o2.im) e5 = o2.re;
30712
30714
  else {
30713
30715
  let t3;
30714
- t3 = 1 === a2.im ? "i" : -1 === a2.im ? ["-", "i"] : ["*", a2.im, "i"], e5 = 0 === a2.re ? t3 : ["+", a2.re, t3];
30716
+ t3 = 1 === o2.im ? "i" : -1 === o2.im ? ["-", "i"] : ["*", o2.im, "i"], e5 = 0 === o2.re ? t3 : ["+", o2.re, t3];
30715
30717
  }
30716
- else e5 = a2;
30717
- a2 = n3 ? NaN : null;
30718
+ else e5 = o2;
30719
+ o2 = n3 ? NaN : null;
30718
30720
  try {
30719
- a2 = f$2(e5)();
30721
+ o2 = f$2(e5)();
30720
30722
  } catch (e6) {
30721
30723
  }
30722
- } else 0 === a2.im && (a2 = a2.re);
30723
- return a2;
30724
+ } else 0 === o2.im && (o2 = o2.re);
30725
+ return o2;
30724
30726
  }
30725
- return "object" == typeof a2 && (a2 = n3 ? NaN : null), a2;
30727
+ return "object" == typeof o2 && (o2 = n3 ? NaN : null), o2;
30726
30728
  };
30727
30729
  function factorial_to_gamma_function(e4) {
30728
30730
  return e4.transform((function(e5, t2, r2) {
@@ -39937,6 +39939,10 @@ let styleAttributes = {
39937
39939
  textColorWord: { componentType: "text" },
39938
39940
  textColorDarkMode: { componentType: "text" },
39939
39941
  textColorWordDarkMode: { componentType: "text" },
39942
+ highContrastColor: { componentType: "text" },
39943
+ highContrastColorWord: { componentType: "text" },
39944
+ highContrastColorDarkMode: { componentType: "text" },
39945
+ highContrastColorWordDarkMode: { componentType: "text" },
39940
39946
  backgroundColor: { componentType: "text" },
39941
39947
  backgroundColorWord: { componentType: "text" },
39942
39948
  backgroundColorDarkMode: { componentType: "text" },
@@ -39968,7 +39974,11 @@ let defaultStyle = {
39968
39974
  textColor: "black",
39969
39975
  textColorWord: "black",
39970
39976
  textColorDarkMode: "white",
39971
- textColorWordDarkMode: "white"
39977
+ textColorWordDarkMode: "white",
39978
+ highContrastColor: "#2963FF",
39979
+ highContrastColorWord: "blue",
39980
+ highContrastColorDarkMode: "#2963FF",
39981
+ highContrastColorWordDarkMode: "blue"
39972
39982
  };
39973
39983
  function returnDefaultStyleDefinitions() {
39974
39984
  return {
@@ -39998,7 +40008,11 @@ function returnDefaultStyleDefinitions() {
39998
40008
  textColor: "black",
39999
40009
  textColorWord: "black",
40000
40010
  textColorDarkMode: "white",
40001
- textColorWordDarkMode: "white"
40011
+ textColorWordDarkMode: "white",
40012
+ highContrastColor: "#2963FF",
40013
+ highContrastColorWord: "blue",
40014
+ highContrastColorDarkMode: "#2963FF",
40015
+ highContrastColorWordDarkMode: "blue"
40002
40016
  },
40003
40017
  2: {
40004
40018
  lineColor: "#D4042D",
@@ -40026,7 +40040,11 @@ function returnDefaultStyleDefinitions() {
40026
40040
  textColor: "#D4042D",
40027
40041
  textColorWord: "red",
40028
40042
  textColorDarkMode: "#D4042D",
40029
- textColorWordDarkMode: "red"
40043
+ textColorWordDarkMode: "red",
40044
+ highContrastColor: "#D4042D",
40045
+ highContrastColorWord: "red",
40046
+ highContrastColorDarkMode: "#D4042D",
40047
+ highContrastColorWordDarkMode: "red"
40030
40048
  },
40031
40049
  3: {
40032
40050
  lineColor: "#F19143",
@@ -40051,10 +40069,14 @@ function returnDefaultStyleDefinitions() {
40051
40069
  fillColorDarkMode: "#F19143",
40052
40070
  fillColorWordDarkMode: "orange",
40053
40071
  fillOpacity: 0.3,
40054
- textColor: "#F19143",
40072
+ textColor: "#BE5A0E",
40055
40073
  textColorWord: "orange",
40056
- textColorDarkMode: "#F19143",
40057
- textColorWordDarkMode: "orange"
40074
+ textColorDarkMode: "#BE5A0E",
40075
+ textColorWordDarkMode: "orange",
40076
+ highContrastColor: "#BE5A0E",
40077
+ highContrastColorWord: "orange",
40078
+ highContrastColorDarkMode: "#BE5A0E",
40079
+ highContrastColorWordDarkMode: "orange"
40058
40080
  },
40059
40081
  4: {
40060
40082
  lineColor: "#644CD6",
@@ -40082,7 +40104,11 @@ function returnDefaultStyleDefinitions() {
40082
40104
  textColor: "#644CD6",
40083
40105
  textColorWord: "purple",
40084
40106
  textColorDarkMode: "#644CD6",
40085
- textColorWordDarkMode: "purple"
40107
+ textColorWordDarkMode: "purple",
40108
+ highContrastColor: "#644CD6",
40109
+ highContrastColorWord: "purple",
40110
+ highContrastColorDarkMode: "#644CD6",
40111
+ highContrastColorWordDarkMode: "purple"
40086
40112
  },
40087
40113
  5: {
40088
40114
  lineColor: "black",
@@ -40110,7 +40136,11 @@ function returnDefaultStyleDefinitions() {
40110
40136
  textColor: "black",
40111
40137
  textColorWord: "black",
40112
40138
  textColorDarkMode: "white",
40113
- textColorWordDarkMode: "white"
40139
+ textColorWordDarkMode: "white",
40140
+ highContrastColor: "black",
40141
+ highContrastColorWord: "black",
40142
+ highContrastColorDarkMode: "black",
40143
+ highContrastColorWordDarkMode: "black"
40114
40144
  },
40115
40145
  6: {
40116
40146
  lineColor: "gray",
@@ -40135,10 +40165,14 @@ function returnDefaultStyleDefinitions() {
40135
40165
  fillColorDarkMode: "gray",
40136
40166
  fillColorWordDarkMode: "gray",
40137
40167
  fillOpacity: 0.3,
40138
- textColor: "gray",
40168
+ textColor: "#757575",
40139
40169
  textColorWord: "gray",
40140
- textColorDarkMode: "gray",
40141
- textColorWordDarkMode: "gray"
40170
+ textColorDarkMode: "#757575",
40171
+ textColorWordDarkMode: "gray",
40172
+ highContrastColor: "#757575",
40173
+ highContrastColorWord: "gray",
40174
+ highContrastColorDarkMode: "#757575",
40175
+ highContrastColorWordDarkMode: "gray"
40142
40176
  }
40143
40177
  };
40144
40178
  }
@@ -42069,6 +42103,7 @@ function applySugar({
42069
42103
  });
42070
42104
  newComponent.children = expandResult.components;
42071
42105
  errors.push(...expandResult.errors);
42106
+ warnings.push(...expandResult.warnings);
42072
42107
  nComponents = expandResult.nComponents;
42073
42108
  } else {
42074
42109
  console.log(
@@ -42107,6 +42142,7 @@ function applySugar({
42107
42142
  expandResult.attributes
42108
42143
  );
42109
42144
  errors.push(...expandResult.errors);
42145
+ warnings.push(...expandResult.warnings);
42110
42146
  nComponents = expandResult.nComponents;
42111
42147
  } else {
42112
42148
  console.log(
@@ -42637,6 +42673,7 @@ async function normalizedDastToSerializedComponents(normalized_root, componentIn
42637
42673
  if (typeof documentIdx === "string" || normalized_root.children.length !== 1) {
42638
42674
  throw Error("Root of dast should be a single document");
42639
42675
  }
42676
+ const errors = [];
42640
42677
  const warnings = [];
42641
42678
  const unflattenedDocument = unflattenDastNodes(
42642
42679
  [documentIdx],
@@ -42660,7 +42697,8 @@ async function normalizedDastToSerializedComponents(normalized_root, componentIn
42660
42697
  });
42661
42698
  let expandedRoot = expandResult.components;
42662
42699
  nComponents = expandResult.nComponents;
42663
- const errors = expandResult.errors;
42700
+ errors.push(...expandResult.errors);
42701
+ warnings.push(...expandResult.warnings);
42664
42702
  expandedRoot = removeBlankStringChildren(
42665
42703
  expandedRoot,
42666
42704
  componentInfoObjects2
@@ -42688,7 +42726,8 @@ function expandUnflattenedToSerializedComponents({
42688
42726
  ignoreErrors = false,
42689
42727
  init = true
42690
42728
  }) {
42691
- let errors = [];
42729
+ const errors = [];
42730
+ const warnings = [];
42692
42731
  let newComponents = [];
42693
42732
  for (let component of serializedComponents) {
42694
42733
  if (typeof component === "string") {
@@ -42711,6 +42750,7 @@ function expandUnflattenedToSerializedComponents({
42711
42750
  });
42712
42751
  let attributes = expandResult.attributes;
42713
42752
  errors.push(...expandResult.errors);
42753
+ warnings.push(...expandResult.warnings);
42714
42754
  nComponents = expandResult.nComponents;
42715
42755
  const defaultPrimitiveResult = addDefaultPrimitiveAttributes({
42716
42756
  unflattenedAttributes: component.attributes,
@@ -42721,6 +42761,7 @@ function expandUnflattenedToSerializedComponents({
42721
42761
  });
42722
42762
  attributes = defaultPrimitiveResult.attributes;
42723
42763
  errors.push(...defaultPrimitiveResult.errors);
42764
+ warnings.push(...defaultPrimitiveResult.warnings);
42724
42765
  nComponents = defaultPrimitiveResult.nComponents;
42725
42766
  let extending = void 0;
42726
42767
  if (component.extending) {
@@ -42736,6 +42777,7 @@ function expandUnflattenedToSerializedComponents({
42736
42777
  const refResolution = refResolutionResult.refResolution;
42737
42778
  extending = addSource(refResolution, component.extending);
42738
42779
  errors.push(...refResolutionResult.errors);
42780
+ warnings.push(...refResolutionResult.warnings);
42739
42781
  nComponents = refResolutionResult.nComponents;
42740
42782
  }
42741
42783
  newComponent = {
@@ -42768,13 +42810,14 @@ function expandUnflattenedToSerializedComponents({
42768
42810
  });
42769
42811
  newComponent.children = res.components;
42770
42812
  errors.push(...res.errors);
42813
+ warnings.push(...res.warnings);
42771
42814
  nComponents = res.nComponents;
42772
42815
  newComponents.push(newComponent);
42773
42816
  }
42774
42817
  if (init) {
42775
42818
  newComponents = decodeXMLEntities(newComponents);
42776
42819
  }
42777
- return { errors, components: newComponents, nComponents };
42820
+ return { errors, warnings, components: newComponents, nComponents };
42778
42821
  }
42779
42822
  function expandUnflattenedRefResolution({
42780
42823
  unflattenedRefResolution,
@@ -42783,7 +42826,8 @@ function expandUnflattenedRefResolution({
42783
42826
  ignoreErrors
42784
42827
  }) {
42785
42828
  let unresolvedPath = null;
42786
- let errors = [];
42829
+ const errors = [];
42830
+ const warnings = [];
42787
42831
  if (unflattenedRefResolution.unresolvedPath) {
42788
42832
  const res2 = expandUnflattenedPath({
42789
42833
  unflattenedPath: unflattenedRefResolution.unresolvedPath,
@@ -42794,6 +42838,7 @@ function expandUnflattenedRefResolution({
42794
42838
  unresolvedPath = res2.expandedPath;
42795
42839
  nComponents = res2.nComponents;
42796
42840
  errors.push(...res2.errors);
42841
+ warnings.push(...res2.warnings);
42797
42842
  }
42798
42843
  const res = expandUnflattenedPath({
42799
42844
  unflattenedPath: unflattenedRefResolution.originalPath,
@@ -42804,6 +42849,7 @@ function expandUnflattenedRefResolution({
42804
42849
  const originalPath = res.expandedPath;
42805
42850
  nComponents = res.nComponents;
42806
42851
  errors.push(...res.errors);
42852
+ warnings.push(...res.warnings);
42807
42853
  const refResolution = {
42808
42854
  nodeIdx: unflattenedRefResolution.nodeIdx,
42809
42855
  unresolvedPath,
@@ -42813,6 +42859,7 @@ function expandUnflattenedRefResolution({
42813
42859
  return {
42814
42860
  refResolution,
42815
42861
  errors,
42862
+ warnings,
42816
42863
  nComponents
42817
42864
  };
42818
42865
  }
@@ -42822,7 +42869,8 @@ function expandUnflattenedPath({
42822
42869
  nComponents,
42823
42870
  ignoreErrors
42824
42871
  }) {
42825
- let errors = [];
42872
+ const errors = [];
42873
+ const warnings = [];
42826
42874
  const expandedPath = unflattenedPath.map((path_part) => {
42827
42875
  let index2 = path_part.index.map((flat_index) => {
42828
42876
  let res = expandUnflattenedToSerializedComponents({
@@ -42833,6 +42881,7 @@ function expandUnflattenedPath({
42833
42881
  });
42834
42882
  let valueComponents = res.components;
42835
42883
  errors.push(...res.errors);
42884
+ warnings.push(...res.warnings);
42836
42885
  nComponents = res.nComponents;
42837
42886
  if (valueComponents.length !== 1) {
42838
42887
  throw Error("Unresolved index should be a single component");
@@ -42850,7 +42899,7 @@ function expandUnflattenedPath({
42850
42899
  sourceDoc: path_part.sourceDoc
42851
42900
  };
42852
42901
  });
42853
- return { expandedPath, nComponents, errors };
42902
+ return { expandedPath, nComponents, errors, warnings };
42854
42903
  }
42855
42904
  function expandAllUnflattenedAttributes({
42856
42905
  unflattenedAttributes,
@@ -42860,6 +42909,7 @@ function expandAllUnflattenedAttributes({
42860
42909
  }) {
42861
42910
  let classAttributes = componentClass.createAttributesObject();
42862
42911
  const errors = [];
42912
+ const warnings = [];
42863
42913
  let attributeLowerCaseMapping = {};
42864
42914
  for (let attrName in classAttributes) {
42865
42915
  attributeLowerCaseMapping[attrName.toLowerCase()] = attrName;
@@ -42881,6 +42931,7 @@ function expandAllUnflattenedAttributes({
42881
42931
  });
42882
42932
  attributes[attrName] = res.attribute;
42883
42933
  errors.push(...res.errors);
42934
+ warnings.push(...res.warnings);
42884
42935
  nComponents = res.nComponents;
42885
42936
  } else if (componentClass.acceptAnyAttribute || attr.includes(":")) {
42886
42937
  let res = expandAttribute({
@@ -42891,6 +42942,7 @@ function expandAllUnflattenedAttributes({
42891
42942
  });
42892
42943
  attributes[attr] = res.attribute;
42893
42944
  errors.push(...res.errors);
42945
+ warnings.push(...res.warnings);
42894
42946
  nComponents = res.nComponents;
42895
42947
  } else {
42896
42948
  throw Error(
@@ -42898,7 +42950,7 @@ function expandAllUnflattenedAttributes({
42898
42950
  );
42899
42951
  }
42900
42952
  }
42901
- return { attributes, errors, nComponents };
42953
+ return { attributes, errors, warnings, nComponents };
42902
42954
  }
42903
42955
  function addDefaultPrimitiveAttributes({
42904
42956
  unflattenedAttributes,
@@ -42908,6 +42960,7 @@ function addDefaultPrimitiveAttributes({
42908
42960
  nComponents
42909
42961
  }) {
42910
42962
  const errors = [];
42963
+ const warnings = [];
42911
42964
  let classAttributes = componentClass.createAttributesObject();
42912
42965
  const newAttributes = { ...currentAttributes };
42913
42966
  for (let attrName in classAttributes) {
@@ -42925,10 +42978,11 @@ function addDefaultPrimitiveAttributes({
42925
42978
  });
42926
42979
  newAttributes[attrName] = res.attribute;
42927
42980
  errors.push(...res.errors);
42981
+ warnings.push(...res.warnings);
42928
42982
  nComponents = res.nComponents;
42929
42983
  }
42930
42984
  }
42931
- return { attributes: newAttributes, errors, nComponents };
42985
+ return { attributes: newAttributes, errors, warnings, nComponents };
42932
42986
  }
42933
42987
  function expandAttribute({
42934
42988
  attrDef,
@@ -42937,7 +42991,8 @@ function expandAttribute({
42937
42991
  componentInfoObjects: componentInfoObjects2,
42938
42992
  nComponents
42939
42993
  }) {
42940
- let errors = [];
42994
+ const errors = [];
42995
+ const warnings = [];
42941
42996
  if (attrDef?.createComponentOfType) {
42942
42997
  const initialResult = createInitialComponentFromAttribute({
42943
42998
  attrDef,
@@ -42986,6 +43041,7 @@ function expandAttribute({
42986
43041
  nComponents
42987
43042
  });
42988
43043
  errors.push(...res.errors);
43044
+ warnings.push(...res.warnings);
42989
43045
  nComponents = res.nComponents;
42990
43046
  let attr = {
42991
43047
  type: "component",
@@ -42999,7 +43055,7 @@ function expandAttribute({
42999
43055
  if (attrDef.ignoreFixed) {
43000
43056
  attr.component.doenetAttributes.ignoreParentFixed = true;
43001
43057
  }
43002
- return { attribute: attr, errors, nComponents };
43058
+ return { attribute: attr, errors, warnings, nComponents };
43003
43059
  } else if (attrDef?.createPrimitiveOfType) {
43004
43060
  let primitiveValue = createPrimitiveFromAttribute({ attrDef, attribute });
43005
43061
  if (attrDef.validatePrimitives) {
@@ -43013,6 +43069,7 @@ function expandAttribute({
43013
43069
  sourceDoc: attribute.sourceDoc
43014
43070
  },
43015
43071
  errors,
43072
+ warnings,
43016
43073
  nComponents
43017
43074
  };
43018
43075
  } else if (attrDef?.createReferences) {
@@ -43022,19 +43079,38 @@ function expandAttribute({
43022
43079
  nComponents
43023
43080
  });
43024
43081
  errors.push(...res.errors);
43082
+ warnings.push(...res.warnings);
43025
43083
  nComponents = res.nComponents;
43084
+ const references = [];
43085
+ const stringChildren = [];
43086
+ for (const child of res.components) {
43087
+ if (typeof child === "object") {
43088
+ references.push(child);
43089
+ } else if (typeof child === "string") {
43090
+ if (child.trim() !== "") {
43091
+ stringChildren.push(child);
43092
+ if (!attrDef.allowStrings) {
43093
+ warnings.push({
43094
+ type: "warning",
43095
+ message: `Invalid value "${child.trim()}" for attribute ${attribute.name}. Attribute must be composed of references that begin with a $.`,
43096
+ position: attribute.position,
43097
+ sourceDoc: attribute.sourceDoc
43098
+ });
43099
+ }
43100
+ }
43101
+ }
43102
+ }
43026
43103
  return {
43027
43104
  attribute: {
43028
43105
  type: "references",
43029
43106
  name: attribute.name,
43030
- references: res.components.filter(
43031
- (child) => typeof child === "object"
43032
- ),
43033
- stringChildren: res.components.filter((child) => typeof child === "string").filter((child) => child.trim() !== ""),
43107
+ references,
43108
+ stringChildren,
43034
43109
  position: attribute.position,
43035
43110
  sourceDoc: attribute.sourceDoc
43036
43111
  },
43037
43112
  errors,
43113
+ warnings,
43038
43114
  nComponents
43039
43115
  };
43040
43116
  } else {
@@ -43047,6 +43123,7 @@ function expandAttribute({
43047
43123
  sourceDoc: attribute.sourceDoc
43048
43124
  },
43049
43125
  errors,
43126
+ warnings,
43050
43127
  nComponents
43051
43128
  };
43052
43129
  }
@@ -43218,6 +43295,7 @@ function convertUnresolvedAttributesForComponentType({
43218
43295
  nComponents
43219
43296
  }) {
43220
43297
  const errors = [];
43298
+ const warnings = [];
43221
43299
  const newClass = componentInfoObjects2.allComponentClasses[componentType];
43222
43300
  const newAttributesObj = newClass.createAttributesObject();
43223
43301
  let attributeLowerCaseMapping = {};
@@ -43242,6 +43320,7 @@ function convertUnresolvedAttributesForComponentType({
43242
43320
  });
43243
43321
  newAttributes[attrName] = res.attribute;
43244
43322
  errors.push(...res.errors);
43323
+ warnings.push(...res.warnings);
43245
43324
  nComponents = res.nComponents;
43246
43325
  if (newAttributes[attrName].type === "component") {
43247
43326
  for (const child of newAttributes[attrName].component.children) {
@@ -43262,6 +43341,7 @@ function convertUnresolvedAttributesForComponentType({
43262
43341
  nComponents
43263
43342
  });
43264
43343
  errors.push(...sugarResult.errors);
43344
+ warnings.push(...sugarResult.warnings);
43265
43345
  nComponents = sugarResult.nComponents;
43266
43346
  newAttributes[attrName].component = sugarResult.components[0];
43267
43347
  }
@@ -52780,7 +52860,7 @@ class Core {
52780
52860
  * as that corresponds to the component that was authored.
52781
52861
  */
52782
52862
  getRendererId(component) {
52783
- return this.rootNames?.[component.componentOrAdaptedIdx] ?? component.componentOrAdaptedIdx.toString();
52863
+ return this.rootNames?.[component.componentOrAdaptedIdx] ?? `_id_${component.componentOrAdaptedIdx.toString()}`;
52784
52864
  }
52785
52865
  deleteFromComponentsToRender({
52786
52866
  componentIdx,
@@ -81903,7 +81983,8 @@ class SectioningComponent extends BlockComponent {
81903
81983
  "anything",
81904
81984
  "variantControls",
81905
81985
  "titles",
81906
- "setups"
81986
+ "setups",
81987
+ "cascadeMessages"
81907
81988
  ]
81908
81989
  },
81909
81990
  asList: {
@@ -81917,9 +81998,14 @@ class SectioningComponent extends BlockComponent {
81917
81998
  }),
81918
81999
  definition({ dependencyValues }) {
81919
82000
  const childIndices = dependencyValues.childIndicesToRender;
81920
- const firstRenderedChild = dependencyValues.allChildren[childIndices[0]];
81921
- const startsWithIntroduction = firstRenderedChild?.componentType === "introduction";
81922
- const lastRenderedChild = dependencyValues.allChildren[childIndices[childIndices.length - 1]];
82001
+ const renderedNonTitleBlankStringChildren = childIndices.map((idx) => dependencyValues.allChildren[idx]).filter((child) => {
82002
+ if (typeof child === "string") {
82003
+ return child.trim() !== "";
82004
+ }
82005
+ return child.componentType !== "title";
82006
+ });
82007
+ const startsWithIntroduction = renderedNonTitleBlankStringChildren[0]?.componentType === "introduction";
82008
+ const lastRenderedChild = renderedNonTitleBlankStringChildren[renderedNonTitleBlankStringChildren.length - 1];
81923
82009
  const endsWithConclusion = lastRenderedChild?.componentType === "conclusion";
81924
82010
  return {
81925
82011
  setValue: { startsWithIntroduction, endsWithConclusion }
@@ -101282,13 +101368,14 @@ class PaginatorControls extends BlockComponent {
101282
101368
  paginatorPage: {
101283
101369
  dependencyType: "stateVariable",
101284
101370
  componentIdx: stateValues.paginatorComponentIdx,
101285
- variableName: "currentPage"
101371
+ variableName: "currentPage",
101372
+ variablesOptional: true
101286
101373
  }
101287
101374
  };
101288
101375
  }
101289
101376
  },
101290
101377
  definition({ dependencyValues }) {
101291
- if ("paginatorPage" in dependencyValues) {
101378
+ if ("paginatorPage" in dependencyValues && Number.isInteger(dependencyValues.paginatorPage)) {
101292
101379
  return {
101293
101380
  setValue: {
101294
101381
  currentPage: dependencyValues.paginatorPage
@@ -101310,13 +101397,14 @@ class PaginatorControls extends BlockComponent {
101310
101397
  paginatorNPages: {
101311
101398
  dependencyType: "stateVariable",
101312
101399
  componentIdx: stateValues.paginatorComponentIdx,
101313
- variableName: "numPages"
101400
+ variableName: "numPages",
101401
+ variablesOptional: true
101314
101402
  }
101315
101403
  };
101316
101404
  }
101317
101405
  },
101318
101406
  definition({ dependencyValues }) {
101319
- if ("paginatorNPages" in dependencyValues) {
101407
+ if ("paginatorNPages" in dependencyValues && Number.isInteger(dependencyValues.paginatorNPages)) {
101320
101408
  return {
101321
101409
  setValue: {
101322
101410
  numPages: dependencyValues.paginatorNPages
@@ -101399,10 +101487,18 @@ class Input extends InlineComponent {
101399
101487
  public: true,
101400
101488
  excludeFromSchema: true
101401
101489
  };
101490
+ attributes.description = {
101491
+ createComponentOfType: "text",
101492
+ createStateVariable: "descriptionPreliminary",
101493
+ defaultValue: ""
101494
+ };
101495
+ Object.assign(attributes, returnLabelAttributes());
101402
101496
  return attributes;
101403
101497
  }
101404
101498
  static returnStateVariableDefinitions() {
101405
- let stateVariableDefinitions = super.returnStateVariableDefinitions();
101499
+ const stateVariableDefinitions = super.returnStateVariableDefinitions();
101500
+ const labelDefinitions = returnLabelStateVariableDefinitions();
101501
+ Object.assign(stateVariableDefinitions, labelDefinitions);
101406
101502
  stateVariableDefinitions.numValues = {
101407
101503
  returnDependencies: () => ({}),
101408
101504
  definition: () => ({ setValue: { numValues: 1 } })
@@ -101424,7 +101520,8 @@ class Input extends InlineComponent {
101424
101520
  "numIncorrectSubmissions",
101425
101521
  "numPreviousIncorrectSubmissions",
101426
101522
  "creditFactorUsed",
101427
- "nextCreditFactor"
101523
+ "nextCreditFactor",
101524
+ "description"
101428
101525
  ]
101429
101526
  }
101430
101527
  }),
@@ -101675,6 +101772,41 @@ class Input extends InlineComponent {
101675
101772
  return { setValue: { nextCreditFactor } };
101676
101773
  }
101677
101774
  };
101775
+ stateVariableDefinitions.description = {
101776
+ forRenderer: true,
101777
+ public: true,
101778
+ shadowingInstructions: {
101779
+ createComponentOfType: "text"
101780
+ },
101781
+ returnDependencies: () => ({
101782
+ answerAncestor: {
101783
+ dependencyType: "stateVariable",
101784
+ variableName: "answerAncestor"
101785
+ },
101786
+ descriptionPreliminary: {
101787
+ dependencyType: "stateVariable",
101788
+ variableName: "descriptionPreliminary"
101789
+ },
101790
+ label: {
101791
+ dependencyType: "stateVariable",
101792
+ variableName: "label"
101793
+ }
101794
+ }),
101795
+ definition({ dependencyValues, usedDefault }) {
101796
+ let description = dependencyValues.descriptionPreliminary;
101797
+ if (usedDefault.descriptionPreliminary && dependencyValues.answerAncestor) {
101798
+ description = dependencyValues.answerAncestor.stateValues.description;
101799
+ }
101800
+ const warnings = [];
101801
+ if (!description && !dependencyValues.label) {
101802
+ warnings.push({
101803
+ message: "Input (or answer producing an input) must have a description or a label.",
101804
+ level: 1
101805
+ });
101806
+ }
101807
+ return { setValue: { description }, sendWarnings: warnings };
101808
+ }
101809
+ };
101678
101810
  return stateVariableDefinitions;
101679
101811
  }
101680
101812
  }
@@ -101815,6 +101947,10 @@ class MatrixInput extends Input {
101815
101947
  }
101816
101948
  static returnChildGroups() {
101817
101949
  return [
101950
+ {
101951
+ group: "labels",
101952
+ componentTypes: ["label"]
101953
+ },
101818
101954
  {
101819
101955
  group: "matrixComponentInputs",
101820
101956
  componentTypes: ["_matrixComponentInput"],
@@ -104977,7 +105113,6 @@ class Solution extends BlockComponent {
104977
105113
  }
104978
105114
  class GivenAnswer extends Solution {
104979
105115
  static componentType = "givenAnswer";
104980
- static excludeFromSchema = true;
104981
105116
  static returnStateVariableDefinitions() {
104982
105117
  let stateVariableDefinitions = super.returnStateVariableDefinitions();
104983
105118
  stateVariableDefinitions.sectionName.definition = () => ({
@@ -107743,7 +107878,10 @@ class Ref extends InlineComponent {
107743
107878
  static createAttributesObject() {
107744
107879
  let attributes = super.createAttributesObject();
107745
107880
  attributes.to = {
107746
- createReferences: true
107881
+ createReferences: true,
107882
+ // Since we allow more than just references in `to`,
107883
+ // we specify `allowStrings` to suppress a warning for non-references.
107884
+ allowStrings: true
107747
107885
  };
107748
107886
  attributes.textType = {
107749
107887
  createComponentOfType: "text",
@@ -124873,6 +125011,14 @@ class Answer extends InlineComponent {
124873
125011
  defaultValue: false,
124874
125012
  public: true
124875
125013
  };
125014
+ attributes.description = {
125015
+ createComponentOfType: "text",
125016
+ createStateVariable: "description",
125017
+ defaultValue: "",
125018
+ public: true,
125019
+ forRenderer: true
125020
+ };
125021
+ Object.assign(attributes, returnLabelAttributes());
124876
125022
  return attributes;
124877
125023
  }
124878
125024
  static returnSugarInstructions() {
@@ -124933,6 +125079,22 @@ class Answer extends InlineComponent {
124933
125079
  let definitelyDoNotAddInput = false, mayNeedInput = false;
124934
125080
  let foundResponse = false;
124935
125081
  let foundAward = false;
125082
+ const labelChildren = matchedChildren.filter(
125083
+ (child) => componentIsSpecifiedType(child, "label")
125084
+ );
125085
+ matchedChildren = matchedChildren.filter(
125086
+ (child) => !componentIsSpecifiedType(child, "label")
125087
+ );
125088
+ const firstNonBlankInd = matchedChildren.findIndex(
125089
+ (child) => typeof child !== "string" || child.trim() !== ""
125090
+ );
125091
+ const lastNonBlankInd = matchedChildren.findLastIndex(
125092
+ (child) => typeof child !== "string" || child.trim() !== ""
125093
+ );
125094
+ matchedChildren = matchedChildren.slice(
125095
+ firstNonBlankInd,
125096
+ lastNonBlankInd + 1
125097
+ );
124936
125098
  let childIsWrappable = [];
124937
125099
  for (let child of matchedChildren) {
124938
125100
  if (typeof child !== "object") {
@@ -125049,7 +125211,7 @@ class Answer extends InlineComponent {
125049
125211
  type: "serialized",
125050
125212
  componentType: "choiceInput",
125051
125213
  componentIdx: nComponents++,
125052
- children: matchedChildren,
125214
+ children: [...labelChildren, ...matchedChildren],
125053
125215
  attributes: {},
125054
125216
  doenetAttributes: {},
125055
125217
  state: {}
@@ -125110,22 +125272,25 @@ class Answer extends InlineComponent {
125110
125272
  childrenToWrap = matchedChildren;
125111
125273
  } else {
125112
125274
  if (!childIsWrappable[0]) {
125113
- let firstNonLabelInd = childIsWrappable.indexOf(true);
125114
- if (firstNonLabelInd !== -1) {
125275
+ let firstWrappableInd = childIsWrappable.indexOf(true);
125276
+ if (firstWrappableInd !== -1) {
125115
125277
  childrenToNotWrapBegin = matchedChildren.slice(
125116
125278
  0,
125117
- firstNonLabelInd
125279
+ firstWrappableInd
125118
125280
  );
125119
- matchedChildren = matchedChildren.slice(firstNonLabelInd);
125120
- childIsWrappable = childIsWrappable.slice(firstNonLabelInd);
125281
+ matchedChildren = matchedChildren.slice(firstWrappableInd);
125282
+ childIsWrappable = childIsWrappable.slice(firstWrappableInd);
125121
125283
  }
125122
125284
  }
125123
- let firstLabelInd = childIsWrappable.indexOf(false);
125124
- if (firstLabelInd === -1) {
125285
+ let firstNonWrappableInd = childIsWrappable.indexOf(false);
125286
+ if (firstNonWrappableInd === -1) {
125125
125287
  childrenToWrap = matchedChildren;
125126
125288
  } else {
125127
- childrenToWrap = matchedChildren.slice(0, firstLabelInd);
125128
- childrenToNotWrapEnd = matchedChildren.slice(firstLabelInd);
125289
+ childrenToWrap = matchedChildren.slice(
125290
+ 0,
125291
+ firstNonWrappableInd
125292
+ );
125293
+ childrenToNotWrapEnd = matchedChildren.slice(firstNonWrappableInd);
125129
125294
  }
125130
125295
  }
125131
125296
  while (typeof childrenToWrap[0] === "string" && childrenToWrap[0].trim() === "") {
@@ -125187,13 +125352,15 @@ class Answer extends InlineComponent {
125187
125352
  type: "serialized",
125188
125353
  componentType: inputType,
125189
125354
  componentIdx: nComponents++,
125190
- children: [],
125355
+ children: labelChildren,
125191
125356
  attributes: {},
125192
125357
  doenetAttributes: {},
125193
125358
  state: {}
125194
125359
  },
125195
125360
  ...newChildren
125196
125361
  ];
125362
+ } else {
125363
+ newChildren = [...labelChildren, ...newChildren];
125197
125364
  }
125198
125365
  return {
125199
125366
  success: true,
@@ -125220,6 +125387,10 @@ class Answer extends InlineComponent {
125220
125387
  {
125221
125388
  group: "responses",
125222
125389
  componentTypes: ["considerAsResponses"]
125390
+ },
125391
+ {
125392
+ group: "labels",
125393
+ componentTypes: ["label"]
125223
125394
  }
125224
125395
  ];
125225
125396
  }
@@ -125234,6 +125405,8 @@ class Answer extends InlineComponent {
125234
125405
  stateVariableDefinitions,
125235
125406
  returnStandardAnswerStateVariableDefinition()
125236
125407
  );
125408
+ const labelDefinitions = returnLabelStateVariableDefinitions();
125409
+ Object.assign(stateVariableDefinitions, labelDefinitions);
125237
125410
  stateVariableDefinitions.haveAwardThatRequiresInput = {
125238
125411
  returnDependencies: () => ({
125239
125412
  awardChildren: {
@@ -127356,7 +127529,6 @@ class MathInput extends Input {
127356
127529
  public: true,
127357
127530
  forRenderer: true
127358
127531
  };
127359
- Object.assign(attributes, returnLabelAttributes());
127360
127532
  return attributes;
127361
127533
  }
127362
127534
  // Include children that can be added due to sugar
@@ -127392,8 +127564,6 @@ class MathInput extends Input {
127392
127564
  displaySmallAsZeroDefault: 0
127393
127565
  })
127394
127566
  );
127395
- let labelDefinitions = returnLabelStateVariableDefinitions();
127396
- Object.assign(stateVariableDefinitions, labelDefinitions);
127397
127567
  stateVariableDefinitions.valueChanged = {
127398
127568
  public: true,
127399
127569
  hasEssential: true,
@@ -128127,7 +128297,6 @@ class Textinput extends Input {
128127
128297
  forRenderer: true
128128
128298
  };
128129
128299
  Object.assign(attributes, returnAnchorAttributes());
128130
- Object.assign(attributes, returnLabelAttributes());
128131
128300
  return attributes;
128132
128301
  }
128133
128302
  // Include children that can be added due to sugar
@@ -128156,8 +128325,6 @@ class Textinput extends Input {
128156
128325
  }
128157
128326
  static returnStateVariableDefinitions() {
128158
128327
  let stateVariableDefinitions = super.returnStateVariableDefinitions();
128159
- let labelDefinitions = returnLabelStateVariableDefinitions();
128160
- Object.assign(stateVariableDefinitions, labelDefinitions);
128161
128328
  let anchorDefinition = returnAnchorStateVariableDefinition();
128162
128329
  Object.assign(stateVariableDefinitions, anchorDefinition);
128163
128330
  stateVariableDefinitions.width = {
@@ -128627,7 +128794,6 @@ class BooleanInput extends Input {
128627
128794
  public: true,
128628
128795
  forRenderer: true
128629
128796
  };
128630
- Object.assign(attributes, returnLabelAttributes());
128631
128797
  Object.assign(attributes, returnAnchorAttributes());
128632
128798
  return attributes;
128633
128799
  }
@@ -128656,8 +128822,6 @@ class BooleanInput extends Input {
128656
128822
  }
128657
128823
  static returnStateVariableDefinitions() {
128658
128824
  let stateVariableDefinitions = super.returnStateVariableDefinitions();
128659
- let labelDefinitions = returnLabelStateVariableDefinitions();
128660
- Object.assign(stateVariableDefinitions, labelDefinitions);
128661
128825
  let anchorDefinition = returnAnchorStateVariableDefinition();
128662
128826
  Object.assign(stateVariableDefinitions, anchorDefinition);
128663
128827
  stateVariableDefinitions.valueChanged = {
@@ -128953,7 +129117,6 @@ class Choiceinput extends Input {
128953
129117
  forRenderer: true,
128954
129118
  fallBackToParentStateVariable: "submitLabelNoCorrectness"
128955
129119
  };
128956
- Object.assign(attributes, returnLabelAttributes());
128957
129120
  return attributes;
128958
129121
  }
128959
129122
  static returnChildGroups() {
@@ -128970,8 +129133,6 @@ class Choiceinput extends Input {
128970
129133
  }
128971
129134
  static returnStateVariableDefinitions() {
128972
129135
  let stateVariableDefinitions = super.returnStateVariableDefinitions();
128973
- let labelDefinitions = returnLabelStateVariableDefinitions();
128974
- Object.assign(stateVariableDefinitions, labelDefinitions);
128975
129136
  stateVariableDefinitions.inline = {
128976
129137
  public: true,
128977
129138
  shadowingInstructions: {
@@ -130119,6 +130280,38 @@ class Choiceinput extends Input {
130119
130280
  return { setValue: { feedbacks } };
130120
130281
  }
130121
130282
  };
130283
+ stateVariableDefinitions.childIndicesToRender = {
130284
+ returnDependencies: () => ({
130285
+ children: {
130286
+ dependencyType: "child",
130287
+ childGroups: ["labels", "choices"]
130288
+ },
130289
+ inline: {
130290
+ dependencyType: "stateVariable",
130291
+ variableName: "inline"
130292
+ }
130293
+ }),
130294
+ definition: function({ dependencyValues }) {
130295
+ if (dependencyValues.inline) {
130296
+ return { setValue: { childIndicesToRender: [] } };
130297
+ } else {
130298
+ const childIndicesToRender = [];
130299
+ for (const [
130300
+ ind,
130301
+ child
130302
+ ] of dependencyValues.children.entries()) {
130303
+ if (child.componentType === "choice") {
130304
+ childIndicesToRender.push(ind);
130305
+ }
130306
+ }
130307
+ return {
130308
+ setValue: {
130309
+ childIndicesToRender
130310
+ }
130311
+ };
130312
+ }
130313
+ }
130314
+ };
130122
130315
  return stateVariableDefinitions;
130123
130316
  }
130124
130317
  async updateSelectedIndices({
@@ -136414,7 +136607,7 @@ class RepeatForSequence extends CompositeComponent {
136414
136607
  }
136415
136608
  numVariantsByDescendant.push(result2.numVariants);
136416
136609
  }
136417
- if (numVariantsByDescendant.length === 1 && numVariantsByDescendant[0] === 1) {
136610
+ if (numVariantsByDescendant.every((x2) => x2 === 1)) {
136418
136611
  serializedComponent.variants.numVariants = 1;
136419
136612
  return {
136420
136613
  success: true,
@@ -192245,6 +192438,8 @@ class ModuleAttributes extends CompositeComponent {
192245
192438
  componentInfoObjects: componentInfoObjects2,
192246
192439
  nComponents
192247
192440
  });
192441
+ errors.push(...expandResult.errors);
192442
+ warnings.push(...expandResult.warnings);
192248
192443
  nComponents = expandResult.nComponents;
192249
192444
  child.children = expandResult.components;
192250
192445
  const sugarResult = applySugar({
@@ -200509,6 +200704,8 @@ class Pretzel extends BlockScoredComponent {
200509
200704
  static componentType = "pretzel";
200510
200705
  static renderChildren = true;
200511
200706
  static canDisplayChildErrors = true;
200707
+ static additionalSchemaChildren = ["problem"];
200708
+ static additionalSchemaChildrenDoNotInherit = true;
200512
200709
  static createAttributesObject() {
200513
200710
  const attributes = super.createAttributesObject();
200514
200711
  attributes.maxNumColumns = {
@@ -200525,15 +200722,18 @@ class Pretzel extends BlockScoredComponent {
200525
200722
  return [
200526
200723
  {
200527
200724
  group: "problems",
200528
- componentTypes: ["statement"]
200725
+ componentTypes: ["statement"],
200726
+ excludeFromSchema: true
200529
200727
  },
200530
200728
  {
200531
200729
  group: "textInputs",
200532
- componentTypes: ["textInput"]
200730
+ componentTypes: ["textInput"],
200731
+ excludeFromSchema: true
200533
200732
  },
200534
200733
  {
200535
200734
  group: "givenAnswers",
200536
- componentTypes: ["span"]
200735
+ componentTypes: ["span"],
200736
+ excludeFromSchema: true
200537
200737
  }
200538
200738
  ];
200539
200739
  }
@@ -201191,6 +201391,21 @@ class PretzelArranger extends CompositeComponent {
201191
201391
  attributes: {},
201192
201392
  doenetAttributes: {}
201193
201393
  }
201394
+ },
201395
+ description: {
201396
+ type: "component",
201397
+ name: "description",
201398
+ component: {
201399
+ type: "serialized",
201400
+ componentType: "text",
201401
+ componentIdx: nComponents++,
201402
+ state: {
201403
+ value: "Enter number in sequence for this answer"
201404
+ },
201405
+ children: [],
201406
+ attributes: {},
201407
+ doenetAttributes: {}
201408
+ }
201194
201409
  }
201195
201410
  },
201196
201411
  doenetAttributes: {},