@doenet/v06-to-v07 0.7.21-dev.399 → 0.7.21-dev.402

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.
@@ -38828,15 +38828,9 @@ function negotiateLocales(requested, available, options = {}) {
38828
38828
  defaultLocale
38829
38829
  });
38830
38830
  }
38831
- function declaredDocumentLocale(authoredLang, hostLocale) {
38832
- const tag2 = (authoredLang ?? "").trim() || (hostLocale ?? "").trim();
38833
- if (tag2 === "") {
38834
- return void 0;
38835
- }
38836
- return normalizeLocaleTag(tag2) || void 0;
38837
- }
38838
38831
  function resolveDocumentLocale(authoredLang, hostLocale) {
38839
- return declaredDocumentLocale(authoredLang, hostLocale) ?? DEFAULT_LOCALE;
38832
+ const declared = (authoredLang ?? "").trim() || (hostLocale ?? "").trim();
38833
+ return normalizeLocaleTag(declared) || DEFAULT_LOCALE;
38840
38834
  }
38841
38835
  function normalizeLocaleTag(tag2) {
38842
38836
  const trimmed = tag2.trim();
@@ -43410,7 +43404,7 @@ async function cidFromArrayBuffer(data) {
43410
43404
  await crypto.subtle.digest("SHA-256", new Uint8Array());
43411
43405
  digest = (data2) => crypto.subtle.digest("SHA-256", data2);
43412
43406
  } catch (e22) {
43413
- const sha256 = (await import("./sha256-AuWkkb03-DrXgTBsC-BdcCzzbW.js").then((n2) => n2.s)).default;
43407
+ const sha256 = (await import("./sha256-AuWkkb03-DXe3kQ3m-CV2S693i.js").then((n2) => n2.s)).default;
43414
43408
  digest = (data2) => sha256(data2, {
43415
43409
  asBytes: true
43416
43410
  });
@@ -121263,6 +121257,20 @@ class Document extends BaseComponent {
121263
121257
  shadowingInstructions: {
121264
121258
  createComponentOfType: "text"
121265
121259
  },
121260
+ // `renderedLang` is the tag the section renderer writes as a
121261
+ // `lang` attribute, or null for no attribute at all (#1546). The
121262
+ // same language as `locale`, narrowed to where the DOM has
121263
+ // something to add: only a nested document, and only when its
121264
+ // language differs from the one already in effect around it.
121265
+ //
121266
+ // The viewer labels the whole activity from the outermost
121267
+ // document's language, on the wrapper it renders around it. So the
121268
+ // outermost document needs no tag of its own, a nested one that
121269
+ // merely restates the surrounding language would say nothing new,
121270
+ // and "already in effect" is known here at every depth.
121271
+ additionalStateVariablesDefined: [
121272
+ { variableName: "renderedLang", forRenderer: true }
121273
+ ],
121266
121274
  returnDependencies: () => ({
121267
121275
  lang: {
121268
121276
  dependencyType: "attributePrimitive",
@@ -121278,20 +121286,16 @@ class Document extends BaseComponent {
121278
121286
  }
121279
121287
  }),
121280
121288
  definition({ dependencyValues }) {
121281
- const lang = dependencyValues.lang?.trim();
121282
- if (!lang && dependencyValues.documentAncestor) {
121283
- return {
121284
- setValue: {
121285
- locale: dependencyValues.documentAncestor.stateValues.locale
121286
- }
121287
- };
121288
- }
121289
+ const inherited = dependencyValues.documentAncestor?.stateValues.locale;
121290
+ const locale = resolveDocumentLocale(
121291
+ dependencyValues.lang,
121292
+ inherited ?? dependencyValues.hostLocale
121293
+ );
121289
121294
  return {
121290
121295
  setValue: {
121291
- locale: resolveDocumentLocale(
121292
- lang,
121293
- dependencyValues.hostLocale
121294
- )
121296
+ locale,
121297
+ // Silent wherever the DOM already says this language.
121298
+ renderedLang: inherited && locale !== inherited ? locale : null
121295
121299
  }
121296
121300
  };
121297
121301
  }
@@ -234231,4 +234235,4 @@ export {
234231
234235
  getDefaultExportFromCjs$1 as g,
234232
234236
  updateSyntaxFromV06toV07 as u
234233
234237
  };
234234
- //# sourceMappingURL=index-Bj7irL1X.js.map
234238
+ //# sourceMappingURL=index-DmoaaW60.js.map