@doenet/v06-to-v07 0.7.26-dev.554 → 0.7.26-dev.556

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.
@@ -47294,7 +47294,7 @@ async function cidFromArrayBuffer(data) {
47294
47294
  await crypto.subtle.digest("SHA-256", new Uint8Array());
47295
47295
  digest = (data2) => crypto.subtle.digest("SHA-256", data2);
47296
47296
  } catch (e22) {
47297
- const sha256 = (await import("./sha256-DT5xJ2Hv-DLZ_0KQR-CTejU37e.js").then((n2) => n2.s)).default;
47297
+ const sha256 = (await import("./sha256-DT5xJ2Hv-DWG-Iovj-joZgNq7H.js").then((n2) => n2.s)).default;
47298
47298
  digest = (data2) => sha256(data2, {
47299
47299
  asBytes: true
47300
47300
  });
@@ -55048,9 +55048,8 @@ function createNewComponentIndicesSub(serializedComponents, nComponents, stateId
55048
55048
  return { components: newComponents, idxMap, nComponents };
55049
55049
  }
55050
55050
  function newComponentIndicesForExtending(extending, nComponents, idxMap, idxMapOverride, stateIdInfo) {
55051
- let newExtending = extending;
55052
55051
  const refResolution = unwrapSource(extending);
55053
- let originalPath = [];
55052
+ const originalPath = [];
55054
55053
  for (const pathPath of refResolution.originalPath) {
55055
55054
  const newPathPart = { ...pathPath };
55056
55055
  const index2 = [];
@@ -55069,11 +55068,12 @@ function newComponentIndicesForExtending(extending, nComponents, idxMap, idxMapO
55069
55068
  }
55070
55069
  newPathPart.index = index2;
55071
55070
  originalPath.push(newPathPart);
55072
- const newRefResolution = { ...refResolution };
55073
- newRefResolution.originalPath = originalPath;
55074
- newExtending = addSource(newRefResolution, extending);
55075
55071
  }
55076
- return { extending: newExtending, nComponents };
55072
+ const newRefResolution = { ...refResolution, originalPath };
55073
+ return {
55074
+ extending: addSource(newRefResolution, extending),
55075
+ nComponents
55076
+ };
55077
55077
  }
55078
55078
  function newComponentIndicesForAttributes(attributes, nComponents, idxMap, idxMapOverride, stateIdInfo) {
55079
55079
  const newAttributes = {};
@@ -61125,7 +61125,7 @@ const _Dependency = class _Dependency2 {
61125
61125
  if (this.propIndex !== void 0) {
61126
61126
  const referringComponent = this.dependencyHandler.core._components[this.upstreamComponentIdx];
61127
61127
  const referenceText = doenetMLStringForReference(
61128
- referringComponent?.refResolution?.originalPath,
61128
+ this.definition.referenceOriginalPath ?? referringComponent?.refResolution?.originalPath,
61129
61129
  this.dependencyHandler.core.allDoenetMLs
61130
61130
  );
61131
61131
  mappedVarNames = await arrayEntryNamesFromPropIndex({
@@ -61135,9 +61135,13 @@ const _Dependency = class _Dependency2 {
61135
61135
  propIndex: this.propIndex,
61136
61136
  reference: referenceText ? {
61137
61137
  text: `$${referenceText}`,
61138
- // Marked where the index was written.
61139
- position: referringComponent.position,
61140
- sourceDoc: referringComponent.sourceDoc
61138
+ // Marked where the index was written. Read
61139
+ // with `?.`: a path carried on the dependency
61140
+ // yields text whether or not the component
61141
+ // that dependency hangs off is still there to
61142
+ // be found.
61143
+ position: referringComponent?.position,
61144
+ sourceDoc: referringComponent?.sourceDoc
61141
61145
  } : void 0
61142
61146
  });
61143
61147
  }
@@ -151931,11 +151935,7 @@ class Answer extends InlineComponent {
151931
151935
  }
151932
151936
  function comparePathsIgnorePosition(path1, path2) {
151933
151937
  if (path1 === null) {
151934
- if (path2 == null) {
151935
- return true;
151936
- } else {
151937
- return false;
151938
- }
151938
+ return path2 === null;
151939
151939
  } else if (path2 === null) {
151940
151940
  return false;
151941
151941
  }
@@ -151952,10 +151952,43 @@ function comparePathsIgnorePosition(path1, path2) {
151952
151952
  if (index1.value.length !== index2.value.length) {
151953
151953
  return false;
151954
151954
  }
151955
- return index1.value.every((v2, k2) => v2 == index2.value[k2]);
151955
+ return index1.value.every(
151956
+ (v2, k2) => compareIndexValues(v2, index2.value[k2])
151957
+ );
151956
151958
  });
151957
151959
  });
151958
151960
  }
151961
+ function compareIndexValues(value1, value2) {
151962
+ if (isSerializedComponent(value1) && isSerializedComponent(value2)) {
151963
+ return compareIndexComponents(value1, value2);
151964
+ }
151965
+ return value1 == value2;
151966
+ }
151967
+ function compareIndexComponents(component1, component2) {
151968
+ if (component1.componentType !== component2.componentType) {
151969
+ return false;
151970
+ }
151971
+ const extending1 = component1.extending ? unwrapSource(component1.extending) : null;
151972
+ const extending2 = component2.extending ? unwrapSource(component2.extending) : null;
151973
+ if (extending1 || extending2) {
151974
+ if (!extending1 || !extending2 || extending1.nodeIdx !== extending2.nodeIdx || !comparePathsIgnorePosition(
151975
+ extending1.unresolvedPath,
151976
+ extending2.unresolvedPath
151977
+ )) {
151978
+ return false;
151979
+ }
151980
+ }
151981
+ if (component1.children.length !== component2.children.length) {
151982
+ return false;
151983
+ }
151984
+ return component1.children.every((child1, i2) => {
151985
+ const child2 = component2.children[i2];
151986
+ if (isSerializedComponent(child1) && isSerializedComponent(child2)) {
151987
+ return compareIndexComponents(child1, child2);
151988
+ }
151989
+ return child1 === child2;
151990
+ });
151991
+ }
151959
151992
  class Award extends BaseComponent {
151960
151993
  static componentType = "award";
151961
151994
  static componentDocs = {
@@ -213403,7 +213436,14 @@ class AnimateFromSequence extends BaseComponent {
213403
213436
  }
213404
213437
  };
213405
213438
  stateVariableDefinitions.targetComponentIdx = {
213406
- additionalStateVariablesDefined: ["unresolvedPath"],
213439
+ // `targetOriginalPath` is the `target` reference's path as the
213440
+ // author wrote it — positions and all — kept so that a failure
213441
+ // can quote the `$…` back to them. The component index alone is
213442
+ // no use for that: it never appeared in the document.
213443
+ additionalStateVariablesDefined: [
213444
+ "unresolvedPath",
213445
+ "targetOriginalPath"
213446
+ ],
213407
213447
  returnDependencies: () => ({
213408
213448
  target: {
213409
213449
  dependencyType: "attributeRefResolutions",
@@ -213416,14 +213456,16 @@ class AnimateFromSequence extends BaseComponent {
213416
213456
  return {
213417
213457
  setValue: {
213418
213458
  targetComponentIdx: target.componentIdx,
213419
- unresolvedPath: target.unresolvedPath
213459
+ unresolvedPath: target.unresolvedPath,
213460
+ targetOriginalPath: target.originalPath
213420
213461
  }
213421
213462
  };
213422
213463
  } else {
213423
213464
  return {
213424
213465
  setValue: {
213425
213466
  targetComponentIdx: null,
213426
- unresolvedPath: null
213467
+ unresolvedPath: null,
213468
+ targetOriginalPath: null
213427
213469
  }
213428
213470
  };
213429
213471
  }
@@ -213506,7 +213548,8 @@ class AnimateFromSequence extends BaseComponent {
213506
213548
  stateVariableDefinitions.targets = {
213507
213549
  stateVariablesDeterminingDependencies: [
213508
213550
  "targetIdentities",
213509
- "unresolvedPath"
213551
+ "unresolvedPath",
213552
+ "targetOriginalPath"
213510
213553
  ],
213511
213554
  returnDependencies: function({ stateValues }) {
213512
213555
  let dependencies2 = {
@@ -213534,6 +213577,10 @@ class AnimateFromSequence extends BaseComponent {
213534
213577
  dependencyType: "stateVariableFromUnresolvedPath",
213535
213578
  componentIdx: target.componentIdx,
213536
213579
  unresolvedPath: stateValues.unresolvedPath,
213580
+ // So that an index in the path that cannot be
213581
+ // applied is reported as the reference the
213582
+ // author wrote in `target`.
213583
+ referenceOriginalPath: stateValues.targetOriginalPath,
213537
213584
  returnAsComponentObject: true,
213538
213585
  variablesOptional: true,
213539
213586
  caseInsensitiveVariableMatch: true,
@@ -225055,7 +225102,14 @@ class UpdateValue extends InlineComponent {
225055
225102
  definition: () => ({ setValue: { clickAction: "updateValue" } })
225056
225103
  };
225057
225104
  stateVariableDefinitions.targetComponentIdx = {
225058
- additionalStateVariablesDefined: ["unresolvedPath"],
225105
+ // `targetOriginalPath` is the `target` reference's path as the
225106
+ // author wrote it — positions and all — kept so that a failure
225107
+ // can quote the `$…` back to them. The component index alone is
225108
+ // no use for that: it never appeared in the document.
225109
+ additionalStateVariablesDefined: [
225110
+ "unresolvedPath",
225111
+ "targetOriginalPath"
225112
+ ],
225059
225113
  returnDependencies: () => ({
225060
225114
  target: {
225061
225115
  dependencyType: "attributeRefResolutions",
@@ -225068,14 +225122,16 @@ class UpdateValue extends InlineComponent {
225068
225122
  return {
225069
225123
  setValue: {
225070
225124
  targetComponentIdx: target.componentIdx,
225071
- unresolvedPath: target.unresolvedPath
225125
+ unresolvedPath: target.unresolvedPath,
225126
+ targetOriginalPath: target.originalPath
225072
225127
  }
225073
225128
  };
225074
225129
  } else {
225075
225130
  return {
225076
225131
  setValue: {
225077
225132
  targetComponentIdx: null,
225078
- unresolvedPath: null
225133
+ unresolvedPath: null,
225134
+ targetOriginalPath: null
225079
225135
  }
225080
225136
  };
225081
225137
  }
@@ -225158,7 +225214,8 @@ class UpdateValue extends InlineComponent {
225158
225214
  stateVariableDefinitions.targets = {
225159
225215
  stateVariablesDeterminingDependencies: [
225160
225216
  "targetIdentities",
225161
- "unresolvedPath"
225217
+ "unresolvedPath",
225218
+ "targetOriginalPath"
225162
225219
  ],
225163
225220
  returnDependencies: function({ stateValues }) {
225164
225221
  let dependencies2 = {
@@ -225186,6 +225243,10 @@ class UpdateValue extends InlineComponent {
225186
225243
  dependencyType: "stateVariableFromUnresolvedPath",
225187
225244
  componentIdx: target.componentIdx,
225188
225245
  unresolvedPath: stateValues.unresolvedPath,
225246
+ // So that an index in the path that cannot be
225247
+ // applied is reported as the reference the
225248
+ // author wrote in `target`.
225249
+ referenceOriginalPath: stateValues.targetOriginalPath,
225189
225250
  returnAsComponentObject: true,
225190
225251
  variablesOptional: true,
225191
225252
  caseInsensitiveVariableMatch: true,
@@ -243187,4 +243248,4 @@ export {
243187
243248
  getDefaultExportFromCjs$1 as g,
243188
243249
  updateSyntaxFromV06toV07 as u
243189
243250
  };
243190
- //# sourceMappingURL=index-73JwkM8q.js.map
243251
+ //# sourceMappingURL=index-DIu-y05T.js.map