@doenet/doenetml-iframe 0.7.21-dev.359 → 0.7.21-dev.361

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/README.md CHANGED
@@ -80,8 +80,8 @@ the inner viewer applies them with the same semantics as the in-process
80
80
 
81
81
  | Prop change | Effect |
82
82
  | -------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------- |
83
- | `render`, `darkMode`, `styleOverrides`, `flags`, `answerResponseCounts`, callbacks, … | applied live, no reload (flipping `render` false→true starts the document in the already-loaded realm) |
84
- | `doenetML`, `activityId`, `docId`, `attemptNumber`, `requestedVariantIndex` | the document's core re-initializes **inside the same iframe realm** — the multi-MB bundle is not re-parsed |
83
+ | `render`, `darkMode`, `styleOverrides`, `uiLocale`, `flags`, `answerResponseCounts`, callbacks, … | applied live, no reload (flipping `render` false→true starts the document in the already-loaded realm) |
84
+ | `doenetML`, `activityId`, `docId`, `attemptNumber`, `requestedVariantIndex`, `documentLocale`, `localeResources` | the document's core re-initializes **inside the same iframe realm** — the multi-MB bundle is not re-parsed |
85
85
  | `initialState`, `forceDisable` and the other `force*` props, `userId` | read at (re-)initialization only, exactly like the in-process viewer — change `docId`/`attemptNumber` or remount via `key=` to apply |
86
86
  | `standaloneUrl`, `cssUrl`, `doenetmlVersion` (or a version change detected in `doenetML`), `useSharedCoreWorker` | a different bundle/realm is required, so the iframe reloads |
87
87
 
@@ -183,6 +183,32 @@ inner viewer.
183
183
  > document's `xmlns`), the wrapper falls back to its historical behavior of
184
184
  > reloading the iframe on any prop change.
185
185
 
186
+ ### Language (`documentLocale` / `uiLocale`)
187
+
188
+ Doenet keeps the language of the **content** apart from the language of the
189
+ **chrome** (buttons, panel headers, diagnostics), because they genuinely
190
+ differ — a Spanish-speaking student may work a French physics problem.
191
+
192
+ - `documentLocale` — BCP-47 tag for the content's language (`"es"`,
193
+ `"es-MX"`). Defaults to `"en"`. An authored `<document lang="es-MX">`
194
+ overrides it: the author knows what language they wrote in, the host only
195
+ knows what it would prefer to receive.
196
+ - `uiLocale` — BCP-47 tag for the chrome's language. Defaults to following
197
+ `documentLocale`, so a fully Spanish activity is fully Spanish without the
198
+ host configuring anything.
199
+ - `localeResources` — FTL message catalogs keyed by locale, for locales other
200
+ than English. English is bundled, so a host that only needs English passes
201
+ nothing. Nothing is translated yet, so there are no catalogs to supply today.
202
+
203
+ When a language is declared — by either route — the rendered container carries
204
+ a matching `lang` attribute, so screen readers pronounce the content with the
205
+ right voice and rules. When neither declares one it carries no `lang` at all
206
+ and inherits the embedding page's, a better guess than asserting English over
207
+ a page that said `<html lang="es">`.
208
+
209
+ Passing `null` (or dropping the prop) clears any of the three, exactly as with
210
+ `styleOverrides`.
211
+
186
212
  ### Windowed mounting (`mountPolicy`)
187
213
 
188
214
  Pages that embed many viewers (assignment pages, textbook chapters) pay
package/index.js CHANGED
@@ -65529,7 +65529,7 @@ function ExternalVirtualKeyboard({
65529
65529
  }
65530
65530
  );
65531
65531
  }
65532
- const version = "0.7.21-dev.359";
65532
+ const version = "0.7.21-dev.361";
65533
65533
  const latestDoenetmlVersion = version;
65534
65534
  function subscribeToPinnedTheme() {
65535
65535
  return () => {
@@ -66160,6 +66160,12 @@ function DoenetViewer({
66160
66160
  }
66161
66161
  return /* @__PURE__ */ React__default.createElement("div", { ref: containerRef, style: { width: "100%" } }, viewerContent);
66162
66162
  }
66163
+ const PROPS_PINNED_TO_NULL = [
66164
+ "styleOverrides",
66165
+ "documentLocale",
66166
+ "uiLocale",
66167
+ "localeResources"
66168
+ ];
66163
66169
  function serializePropsSnapshot(seed, props) {
66164
66170
  const snapshot = { ...seed };
66165
66171
  for (const [key, val] of Object.entries(props)) {
@@ -66167,8 +66173,10 @@ function serializePropsSnapshot(seed, props) {
66167
66173
  snapshot[key] = val;
66168
66174
  }
66169
66175
  }
66170
- if (snapshot.styleOverrides === void 0) {
66171
- snapshot.styleOverrides = null;
66176
+ for (const key of PROPS_PINNED_TO_NULL) {
66177
+ if (snapshot[key] === void 0) {
66178
+ snapshot[key] = null;
66179
+ }
66172
66180
  }
66173
66181
  return JSON.stringify(snapshot);
66174
66182
  }