@doenet/v06-to-v07 0.7.23-dev.457 → 0.7.23-dev.458

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.
@@ -45107,7 +45107,7 @@ async function cidFromArrayBuffer(data) {
45107
45107
  await crypto.subtle.digest("SHA-256", new Uint8Array());
45108
45108
  digest = (data2) => crypto.subtle.digest("SHA-256", data2);
45109
45109
  } catch (e22) {
45110
- const sha256 = (await import("./sha256-BqwaiouD-BmHTa12e-J4g4SZ-x.js").then((n2) => n2.s)).default;
45110
+ const sha256 = (await import("./sha256-BqwaiouD-DfC4R1fE-BB-27uO7.js").then((n2) => n2.s)).default;
45111
45111
  digest = (data2) => sha256(data2, {
45112
45112
  asBytes: true
45113
45113
  });
@@ -81707,10 +81707,24 @@ async function submitAllAnswers({
81707
81707
  skipRendererUpdate
81708
81708
  });
81709
81709
  }
81710
+ function listItemChildVisibilityDependency(...alsoRequest) {
81711
+ return {
81712
+ variableNames: [...alsoRequest, "hiddenIgnoreParent"],
81713
+ variablesOptional: true
81714
+ };
81715
+ }
81710
81716
  function childRendersSomething(child, componentInfoObjects2) {
81711
81717
  if (typeof child !== "object") {
81712
81718
  return child.trim() !== "";
81713
81719
  }
81720
+ if (child.stateValues === void 0) {
81721
+ throw Error(
81722
+ `childRendersSomething() received a <${child.componentType}> child with no stateValues: spread listItemChildVisibilityDependency() into the child dependency it came from.`
81723
+ );
81724
+ }
81725
+ if (child.stateValues.hiddenIgnoreParent) {
81726
+ return false;
81727
+ }
81714
81728
  return Boolean(
81715
81729
  componentInfoObjects2.allComponentClasses[child.componentType]?.rendererType
81716
81730
  );
@@ -81791,12 +81805,14 @@ function returnPassThroughListItemChildStateVariableDefinitions() {
81791
81805
  },
81792
81806
  allChildren: {
81793
81807
  dependencyType: "child",
81794
- includeAllChildren: true
81808
+ includeAllChildren: true,
81809
+ ...listItemChildVisibilityDependency()
81795
81810
  }
81796
81811
  }),
81797
81812
  definition({
81798
81813
  dependencyValues,
81799
- componentIdx
81814
+ componentIdx,
81815
+ componentInfoObjects: componentInfoObjects2
81800
81816
  }) {
81801
81817
  let childrenToRenderInlineForListItem = [];
81802
81818
  const shouldRenderInline = returnShouldRenderInline({
@@ -81804,18 +81820,12 @@ function returnPassThroughListItemChildStateVariableDefinitions() {
81804
81820
  componentIdx
81805
81821
  });
81806
81822
  if (shouldRenderInline) {
81807
- const firstNonBlankNonLabelChild = dependencyValues.allChildren.find((child) => {
81808
- if (typeof child === "object") {
81809
- return child.componentType !== "label";
81810
- }
81811
- if (typeof child === "string") {
81812
- return child.trim() !== "";
81813
- }
81814
- return false;
81815
- });
81816
- if (firstNonBlankNonLabelChild && typeof firstNonBlankNonLabelChild === "object") {
81823
+ const firstVisibleNonLabelChild = dependencyValues.allChildren.find(
81824
+ (child) => !(typeof child === "object" && child.componentType === "label") && childRendersSomething(child, componentInfoObjects2)
81825
+ );
81826
+ if (firstVisibleNonLabelChild && typeof firstVisibleNonLabelChild === "object") {
81817
81827
  childrenToRenderInlineForListItem = [
81818
- firstNonBlankNonLabelChild
81828
+ firstVisibleNonLabelChild
81819
81829
  ];
81820
81830
  }
81821
81831
  }
@@ -96161,12 +96171,16 @@ function composeTitlePrefix({
96161
96171
  english
96162
96172
  );
96163
96173
  }
96174
+ function sectionAllChildrenDependency(extraFields = {}) {
96175
+ return {
96176
+ dependencyType: "child",
96177
+ includeAllChildren: true,
96178
+ ...extraFields
96179
+ };
96180
+ }
96164
96181
  function returnSectionChildDependencies() {
96165
96182
  return {
96166
- allChildren: {
96167
- dependencyType: "child",
96168
- includeAllChildren: true
96169
- },
96183
+ allChildren: sectionAllChildrenDependency(),
96170
96184
  configurationChildren: {
96171
96185
  dependencyType: "child",
96172
96186
  childGroups: [
@@ -96530,7 +96544,6 @@ class SectioningComponent extends BlockComponent {
96530
96544
  }
96531
96545
  };
96532
96546
  stateVariableDefinitions.childIndicesToRender = {
96533
- additionalStateVariablesDefined: ["firstVisibleChild"],
96534
96547
  returnDependencies: () => ({
96535
96548
  titleChildren: {
96536
96549
  dependencyType: "child",
@@ -96552,7 +96565,6 @@ class SectioningComponent extends BlockComponent {
96552
96565
  }),
96553
96566
  definition({ dependencyValues, componentInfoObjects: componentInfoObjects2 }) {
96554
96567
  const childIndicesToRender = [];
96555
- let firstVisibleChild = null;
96556
96568
  let allTitleChildNames = dependencyValues.titleChildren.map(
96557
96569
  (x2) => x2.componentIdx
96558
96570
  );
@@ -96579,16 +96591,58 @@ class SectioningComponent extends BlockComponent {
96579
96591
  continue;
96580
96592
  }
96581
96593
  childIndicesToRender.push(ind);
96582
- if (firstVisibleChild === null && !dependencyValues.hideChildren && childRendersSomething(child, componentInfoObjects2)) {
96583
- firstVisibleChild = child;
96584
- }
96585
96594
  }
96586
96595
  return {
96587
- setValue: { childIndicesToRender, firstVisibleChild }
96596
+ setValue: { childIndicesToRender }
96588
96597
  };
96589
96598
  },
96590
96599
  markStale: () => ({ updateRenderedChildren: true })
96591
96600
  };
96601
+ stateVariableDefinitions.firstVisibleChild = {
96602
+ stateVariablesDeterminingDependencies: [
96603
+ "nonBoxedListItemWithoutTitle"
96604
+ ],
96605
+ returnDependencies: ({ stateValues }) => {
96606
+ if (!stateValues.nonBoxedListItemWithoutTitle) {
96607
+ return {};
96608
+ }
96609
+ return {
96610
+ // Indexed below by the positions in `childIndicesToRender`,
96611
+ // so it must be the shared definition — see
96612
+ // `sectionAllChildrenDependency()`.
96613
+ allChildren: sectionAllChildrenDependency(
96614
+ listItemChildVisibilityDependency()
96615
+ ),
96616
+ childIndicesToRender: {
96617
+ dependencyType: "stateVariable",
96618
+ variableName: "childIndicesToRender"
96619
+ },
96620
+ hideChildren: {
96621
+ dependencyType: "stateVariable",
96622
+ variableName: "hideChildren"
96623
+ },
96624
+ childrenToHide: {
96625
+ dependencyType: "stateVariable",
96626
+ variableName: "childrenToHide"
96627
+ }
96628
+ };
96629
+ },
96630
+ definition({ dependencyValues, componentInfoObjects: componentInfoObjects2 }) {
96631
+ let firstVisibleChild = null;
96632
+ if (dependencyValues.childIndicesToRender && !dependencyValues.hideChildren) {
96633
+ for (const ind of dependencyValues.childIndicesToRender) {
96634
+ const child = dependencyValues.allChildren[ind];
96635
+ if (!dependencyValues.childrenToHide.includes(
96636
+ child.componentIdx
96637
+ ) && childRendersSomething(child, componentInfoObjects2)) {
96638
+ firstVisibleChild = child;
96639
+ break;
96640
+ }
96641
+ }
96642
+ }
96643
+ return { setValue: { firstVisibleChild } };
96644
+ }
96645
+ };
96592
96646
  stateVariableDefinitions.childrenToHide = {
96593
96647
  returnDependencies: () => ({
96594
96648
  ...returnSectionChildDependencies(),
@@ -96679,7 +96733,7 @@ class SectioningComponent extends BlockComponent {
96679
96733
  }),
96680
96734
  definition({ dependencyValues }) {
96681
96735
  const firstVisibleChildAdjustedForListItem = Boolean(
96682
- dependencyValues.nonBoxedListItemWithoutTitle && typeof dependencyValues.firstVisibleChild === "object"
96736
+ dependencyValues.nonBoxedListItemWithoutTitle && dependencyValues.firstVisibleChild != null && typeof dependencyValues.firstVisibleChild === "object"
96683
96737
  );
96684
96738
  return {
96685
96739
  setValue: {
@@ -96748,13 +96802,10 @@ class SectioningComponent extends BlockComponent {
96748
96802
  returnDependencies: () => ({
96749
96803
  // `childIndicesToRender` is looked up in this list below, so it
96750
96804
  // must be the same complete child list that produced those
96751
- // positions (see `returnSectionChildDependencies`). The
96805
+ // positions see `sectionAllChildrenDependency()`. The
96752
96806
  // configuration children are already excluded from
96753
96807
  // `childIndicesToRender`, so they need not be identified here.
96754
- allChildren: {
96755
- dependencyType: "child",
96756
- includeAllChildren: true
96757
- },
96808
+ allChildren: sectionAllChildrenDependency(),
96758
96809
  asList: {
96759
96810
  dependencyType: "stateVariable",
96760
96811
  variableName: "asList"
@@ -98052,7 +98103,8 @@ let Li$1 = class Li extends BaseComponent {
98052
98103
  returnDependencies: () => ({
98053
98104
  children: {
98054
98105
  dependencyType: "child",
98055
- childGroups: ["anything"]
98106
+ childGroups: ["anything"],
98107
+ ...listItemChildVisibilityDependency()
98056
98108
  }
98057
98109
  }),
98058
98110
  definition({ dependencyValues, componentInfoObjects: componentInfoObjects2 }) {
@@ -114856,10 +114908,15 @@ class SideBySide extends BlockComponent {
114856
114908
  },
114857
114909
  blockChildren: {
114858
114910
  dependencyType: "child",
114859
- childGroups: ["blocks"]
114911
+ childGroups: ["blocks"],
114912
+ ...listItemChildVisibilityDependency()
114860
114913
  }
114861
114914
  }),
114862
- definition({ dependencyValues, componentIdx }) {
114915
+ definition({
114916
+ dependencyValues,
114917
+ componentIdx,
114918
+ componentInfoObjects: componentInfoObjects2
114919
+ }) {
114863
114920
  const shouldRenderInline = dependencyValues.parentChildrenToRenderInlineForListItem?.map((c2) => c2.componentIdx).includes(componentIdx);
114864
114921
  if (!shouldRenderInline) {
114865
114922
  return {
@@ -114869,10 +114926,12 @@ class SideBySide extends BlockComponent {
114869
114926
  }
114870
114927
  };
114871
114928
  }
114872
- const firstPanel = dependencyValues.blockChildren?.[0];
114929
+ const leadingPanel = dependencyValues.blockChildren?.find(
114930
+ (child) => childRendersSomething(child, componentInfoObjects2)
114931
+ );
114873
114932
  return {
114874
114933
  setValue: {
114875
- listItemInlineAlignment: firstPanel?.componentType === "p" ? "baseline" : "flex-start",
114934
+ listItemInlineAlignment: leadingPanel?.componentType === "p" ? "baseline" : "flex-start",
114876
114935
  childrenToRenderInlineForListItem: dependencyValues.blockChildren
114877
114936
  }
114878
114937
  };
@@ -143452,11 +143511,14 @@ class Answer extends InlineComponent {
143452
143511
  inputChildren: {
143453
143512
  dependencyType: "child",
143454
143513
  childGroups: ["inputs"],
143455
- variableNames: ["inline"],
143456
- variablesOptional: true
143514
+ ...listItemChildVisibilityDependency("inline")
143457
143515
  }
143458
143516
  }),
143459
- definition({ dependencyValues, componentIdx }) {
143517
+ definition({
143518
+ dependencyValues,
143519
+ componentIdx,
143520
+ componentInfoObjects: componentInfoObjects2
143521
+ }) {
143460
143522
  const isInParentList = Boolean(
143461
143523
  dependencyValues.parentChildrenToRenderInlineForListItem?.map((c2) => c2.componentIdx).includes(componentIdx)
143462
143524
  );
@@ -143470,7 +143532,7 @@ class Answer extends InlineComponent {
143470
143532
  };
143471
143533
  }
143472
143534
  const firstBlockChoiceInput = dependencyValues.inputChildren?.find(
143473
- (child) => child.componentType === "choiceInput" && child.stateValues.inline === false
143535
+ (child) => child.componentType === "choiceInput" && child.stateValues.inline === false && childRendersSomething(child, componentInfoObjects2)
143474
143536
  );
143475
143537
  return {
143476
143538
  setValue: {
@@ -147808,22 +147870,6 @@ class Choiceinput extends Input {
147808
147870
  listItemInlineAlignment: "flex-start"
147809
147871
  })
147810
147872
  );
147811
- stateVariableDefinitions.insideNativeListItem = {
147812
- forRenderer: true,
147813
- returnDependencies: () => ({
147814
- listItemAncestor: {
147815
- dependencyType: "ancestor",
147816
- componentType: "li"
147817
- }
147818
- }),
147819
- definition: ({ dependencyValues }) => ({
147820
- setValue: {
147821
- insideNativeListItem: Boolean(
147822
- dependencyValues.listItemAncestor
147823
- )
147824
- }
147825
- })
147826
- };
147827
147873
  stateVariableDefinitions.inline = {
147828
147874
  description: "Whether the input is rendered inline (as a dropdown).",
147829
147875
  public: true,
@@ -236107,4 +236153,4 @@ export {
236107
236153
  getDefaultExportFromCjs$1 as g,
236108
236154
  updateSyntaxFromV06toV07 as u
236109
236155
  };
236110
- //# sourceMappingURL=index-DuSsrwhZ.js.map
236156
+ //# sourceMappingURL=index-Bfl-yI5_.js.map