@marimo-team/frontend 0.23.16-dev2 → 0.23.16-dev4

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.
Files changed (34) hide show
  1. package/dist/assets/JsonOutput-CkCD-FgM.js +53 -0
  2. package/dist/assets/{add-connection-dialog-CEp3SJR2.js → add-connection-dialog-B-jCRNTN.js} +1 -1
  3. package/dist/assets/{agent-panel-By4A-Cqr.js → agent-panel-CHB6t7Zy.js} +1 -1
  4. package/dist/assets/{cell-editor-DdofA9oQ.js → cell-editor-B5JVq7_q.js} +1 -1
  5. package/dist/assets/{column-preview-BgZLUEOj.js → column-preview-Dne1dIt0.js} +1 -1
  6. package/dist/assets/{command-palette-DrI24FoL.js → command-palette-iOCqUIs1.js} +1 -1
  7. package/dist/assets/{edit-page-C37w54dQ.js → edit-page-7X3HYey7.js} +5 -5
  8. package/dist/assets/file-explorer-panel-Ntq1-VbF.js +26 -0
  9. package/dist/assets/{form-CgWNb44_.js → form-B6BkSCJb.js} +1 -1
  10. package/dist/assets/{index-Cl0lNhQU.js → index-CMZzy-dF.js} +14 -14
  11. package/dist/assets/{layout-BOwE7yok.js → layout-CUlZijwG.js} +3 -3
  12. package/dist/assets/{panels-CW-PUlv2.js → panels-Dj45fW-v.js} +1 -1
  13. package/dist/assets/{reveal-component-DqMRxmUr.js → reveal-component-BLMTmd8T.js} +1 -1
  14. package/dist/assets/{run-page-s6Mf8p78.js → run-page-B6pgDYEJ.js} +1 -1
  15. package/dist/assets/{scratchpad-panel-CXsxdMB-.js → scratchpad-panel-B0mEqBNk.js} +1 -1
  16. package/dist/assets/{session-panel-CmHetqAb.js → session-panel-Y0Oon0sD.js} +1 -1
  17. package/dist/assets/{skeleton-B_4CZVEm.js → skeleton-D3QPxqWC.js} +1 -1
  18. package/dist/assets/{state-BXbiRXZk.js → state-BZQc7xxL.js} +1 -1
  19. package/dist/assets/{useNotebookActions-DJKDd0gM.js → useNotebookActions-DTXAoukG.js} +1 -1
  20. package/dist/index.html +5 -5
  21. package/package.json +1 -1
  22. package/src/components/data-table/column-formatting/feature.ts +2 -1
  23. package/src/components/editor/file-tree/__tests__/file-render-mode.test.ts +27 -0
  24. package/src/components/editor/file-tree/__tests__/file-viewer.test.tsx +150 -0
  25. package/src/components/editor/file-tree/file-preview-metadata.tsx +51 -0
  26. package/src/components/editor/file-tree/file-render-mode.ts +32 -0
  27. package/src/components/editor/file-tree/file-viewer.tsx +76 -50
  28. package/src/core/i18n/__tests__/locale-provider.test.tsx +54 -118
  29. package/src/core/i18n/__tests__/locale.test.ts +113 -0
  30. package/src/core/i18n/locale-provider.tsx +1 -19
  31. package/src/core/i18n/locale.ts +71 -0
  32. package/src/core/network/types.ts +3 -1
  33. package/dist/assets/JsonOutput-DnGSkLeP.js +0 -53
  34. package/dist/assets/file-explorer-panel-DbdoJbbF.js +0 -26
@@ -0,0 +1,71 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ /**
4
+ * Locale used when neither the configured locale nor the browser locale can be
5
+ * resolved to a valid BCP 47 tag.
6
+ */
7
+ export const FALLBACK_LOCALE = "en-US";
8
+
9
+ /**
10
+ * Whether a tag is accepted by `Intl` (and therefore by react-aria's
11
+ * `I18nProvider`, which constructs `Intl.Locale` internally).
12
+ */
13
+ export function isValidLocale(locale: string): boolean {
14
+ if (!locale) {
15
+ return false;
16
+ }
17
+ try {
18
+ new Intl.Locale(locale);
19
+ return true;
20
+ } catch {
21
+ return false;
22
+ }
23
+ }
24
+
25
+ /**
26
+ * Coerce a browser or config locale tag into a valid
27
+ * [BCP 47](https://www.rfc-editor.org/info/rfc5646) tag, or `null` if nothing
28
+ * usable can be recovered.
29
+ *
30
+ * Some environments report POSIX-style tags that `Intl` rejects with
31
+ * `RangeError: Incorrect locale information provided`, crashing anything that
32
+ * constructs an `Intl.*` formatter (see issue #9938). Known offenders:
33
+ * - POSIX modifiers, e.g. Chromium under Playwright reporting `en-US@posix`
34
+ * - charset suffixes, e.g. `en_US.UTF-8`
35
+ * - underscore separators, e.g. `en_US`
36
+ */
37
+ export function normalizeLocale(tag: string | null | undefined): string | null {
38
+ if (!tag) {
39
+ return null;
40
+ }
41
+
42
+ const candidate = tag.split("@")[0].split(".")[0].trim().replaceAll("_", "-");
43
+
44
+ if (isValidLocale(candidate)) {
45
+ return candidate;
46
+ }
47
+
48
+ // Fall back to the language subtag alone (e.g. `en` from a mangled `en-XX`).
49
+ const language = candidate.split("-")[0];
50
+ if (isValidLocale(language)) {
51
+ return language;
52
+ }
53
+
54
+ return null;
55
+ }
56
+
57
+ /** Resolve the browser's locale to a safe BCP 47 tag.
58
+ * See https://github.com/marimo-team/marimo/issues/9938 */
59
+ export function browserLocale(): string {
60
+ const language =
61
+ typeof navigator === "undefined" ? undefined : navigator.language;
62
+ return normalizeLocale(language) ?? FALLBACK_LOCALE;
63
+ }
64
+
65
+ /**
66
+ * Resolve a configured locale to a safe BCP 47 tag, preferring the config and
67
+ * falling back to the browser locale, then to {@link FALLBACK_LOCALE}.
68
+ */
69
+ export function safeLocale(locale: string | null | undefined): string {
70
+ return normalizeLocale(locale) ?? browserLocale();
71
+ }
@@ -191,7 +191,9 @@ export interface EditRequests {
191
191
  request: FileMoveRequest,
192
192
  ) => Promise<FileMoveResponse>;
193
193
  sendUpdateFile: (request: FileUpdateRequest) => Promise<FileUpdateResponse>;
194
- sendFileDetails: (request: { path: string }) => Promise<FileDetailsResponse>;
194
+ sendFileDetails: (
195
+ request: FileDetailsRequest,
196
+ ) => Promise<FileDetailsResponse>;
195
197
  // Homepage requests
196
198
  openTutorial: (request: OpenTutorialRequest) => Promise<MarimoFile>;
197
199
  getRecentFiles: () => Promise<RecentFilesResponse>;