@marimo-team/frontend 0.22.1-dev2 → 0.22.1-dev21

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 (72) hide show
  1. package/dist/assets/{ConnectedDataExplorerComponent-BhOfvmd2.js → ConnectedDataExplorerComponent-Bgd8MpO7.js} +1 -1
  2. package/dist/assets/{JsonOutput-DK6QFpxq.js → JsonOutput-CYRewW_n.js} +10 -10
  3. package/dist/assets/{add-cell-with-ai-C9CXMDL-.js → add-cell-with-ai-CJL5NwHh.js} +24 -24
  4. package/dist/assets/{add-connection-dialog-uUw1BwGd.js → add-connection-dialog-_oI2JBU2.js} +1 -1
  5. package/dist/assets/{agent-panel-CKXYOD10.js → agent-panel-frCoZBMf.js} +1 -1
  6. package/dist/assets/ai-model-dropdown-CMj49xMg.js +5 -0
  7. package/dist/assets/{app-config-button-B4_Fzop6.js → app-config-button-DCVf5Azv.js} +1 -1
  8. package/dist/assets/{cell-editor-DsXpgc4r.js → cell-editor-nJeqD5Xq.js} +1 -1
  9. package/dist/assets/{chat-display-CRKEYeok.js → chat-display-DnlV-Vjp.js} +1 -1
  10. package/dist/assets/chat-panel-BrH9Bycd.js +3 -0
  11. package/dist/assets/{chat-ui-CQB2SbzK.js → chat-ui-gEEIyfNV.js} +1 -1
  12. package/dist/assets/{column-preview-CWOsM3UD.js → column-preview-PiH54hAW.js} +1 -1
  13. package/dist/assets/{command-palette-BXM1GCVc.js → command-palette-CrC7ohqO.js} +1 -1
  14. package/dist/assets/{edit-page-BXQVe56n.js → edit-page-idaINdSX.js} +7 -7
  15. package/dist/assets/{file-explorer-panel-QFaPxpp8.js → file-explorer-panel-sS4HTA69.js} +1 -1
  16. package/dist/assets/{form-CoRP5wCe.js → form-B-BLUzr3.js} +1 -1
  17. package/dist/assets/{formats-C_TavbEL.js → formats-N7VZhahg.js} +1 -1
  18. package/dist/assets/{home-page-GHJ3-S70.js → home-page-Lm5CjxXF.js} +1 -1
  19. package/dist/assets/{hooks-CfqzfU-0.js → hooks-ChIFqb9W.js} +1 -1
  20. package/dist/assets/index-CCazW2UV.css +2 -0
  21. package/dist/assets/index-eeNpwqOH.js +35 -0
  22. package/dist/assets/{layout-FSEZfgnG.js → layout-BlYB96ph.js} +1 -1
  23. package/dist/assets/{markdown-renderer-wLZT8no0.js → markdown-renderer-CYb9pckL.js} +1 -1
  24. package/dist/assets/{packages-panel-CwbHm9uC.js → packages-panel-C7RTPIUf.js} +1 -1
  25. package/dist/assets/{panels-BhaV1xQQ.js → panels-qPMPLlzN.js} +1 -1
  26. package/dist/assets/{run-page-BtSGYy1m.js → run-page-Cqmrl9SW.js} +1 -1
  27. package/dist/assets/{scratchpad-panel-riBRfLg4.js → scratchpad-panel-Ddw1KV8R.js} +1 -1
  28. package/dist/assets/{session-panel-B2ux2cYO.js → session-panel-DTp3QX73.js} +1 -1
  29. package/dist/assets/{state-LRco7VGF.js → state-Nag9RDED.js} +1 -1
  30. package/dist/assets/{useNotebookActions-C2iPqhjB.js → useNotebookActions-CG6L_-9T.js} +1 -1
  31. package/dist/assets/{utils-BDlGlVyF.js → utils-DWFl4LEP.js} +3 -3
  32. package/dist/assets/{vega-component-DiFt6ZG4.js → vega-component-BAuy1PqH.js} +1 -1
  33. package/dist/index.html +9 -9
  34. package/package.json +1 -1
  35. package/src/__tests__/branded.ts +6 -0
  36. package/src/components/chat/chat-panel.tsx +2 -1
  37. package/src/components/data-table/TableBottomBar.tsx +12 -1
  38. package/src/components/data-table/TableTopBar.tsx +31 -35
  39. package/src/components/data-table/charts/charts.tsx +40 -11
  40. package/src/components/data-table/column-explorer-panel/column-explorer.tsx +1 -1
  41. package/src/components/data-table/data-table.tsx +6 -1
  42. package/src/components/data-table/loading-table.tsx +4 -1
  43. package/src/components/data-table/range-focus/cell-selection-stats.tsx +3 -1
  44. package/src/components/data-table/row-viewer-panel/row-viewer.tsx +1 -1
  45. package/src/components/data-table/table-explorer-panel/table-explorer-panel.tsx +2 -2
  46. package/src/components/editor/ai/add-cell-with-ai.tsx +2 -1
  47. package/src/components/editor/chrome/panels/context-aware-panel/context-aware-panel.tsx +1 -1
  48. package/src/components/editor/chrome/wrapper/footer-items/lsp-status.tsx +2 -1
  49. package/src/core/cells/__tests__/apply-transaction.test.ts +12 -11
  50. package/src/core/cells/document-changes.ts +9 -9
  51. package/src/core/codemirror/copilot/__tests__/transport.test.ts +128 -2
  52. package/src/core/codemirror/copilot/client.ts +9 -2
  53. package/src/core/codemirror/copilot/language-server.ts +11 -0
  54. package/src/core/codemirror/copilot/transport.ts +32 -6
  55. package/src/core/islands/__tests__/bridge.test.ts +20 -10
  56. package/src/core/network/__tests__/requests-lazy.test.ts +30 -14
  57. package/src/core/websocket/useMarimoKernelConnection.tsx +5 -11
  58. package/src/core/websocket/useWebSocket.tsx +3 -1
  59. package/src/css/app/Cell.css +22 -1
  60. package/src/css/table.css +17 -0
  61. package/src/plugins/impl/DataTablePlugin.tsx +1 -0
  62. package/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx +2 -11
  63. package/src/plugins/impl/vega/__tests__/utils.test.ts +68 -0
  64. package/src/plugins/impl/vega/utils.ts +14 -5
  65. package/src/plugins/impl/vega/vega.css +2 -1
  66. package/src/utils/json/base64.ts +2 -5
  67. package/src/utils/time.ts +4 -2
  68. package/src/utils/typed.ts +2 -2
  69. package/dist/assets/ai-model-dropdown-Ck6NNlZH.js +0 -5
  70. package/dist/assets/chat-panel-CYkuZYzq.js +0 -3
  71. package/dist/assets/index-BFY3jw7I.css +0 -2
  72. package/dist/assets/index-e_bkIEdq.js +0 -35
@@ -33,4 +33,72 @@ describe("getContainerWidth", () => {
33
33
  it("should return undefined when width is explicitly undefined", () => {
34
34
  expect(getContainerWidth({ width: undefined })).toBeUndefined();
35
35
  });
36
+
37
+ it("should find width in nested facet spec", () => {
38
+ expect(
39
+ getContainerWidth({
40
+ $schema: "https://vega.github.io/schema/vega-lite/v6.json",
41
+ facet: { column: { field: "Origin", type: "nominal" } },
42
+ spec: {
43
+ mark: "point",
44
+ encoding: {},
45
+ width: "container",
46
+ },
47
+ }),
48
+ ).toBe("container");
49
+ });
50
+
51
+ it("should find width in nested repeat spec", () => {
52
+ expect(
53
+ getContainerWidth({
54
+ $schema: "https://vega.github.io/schema/vega-lite/v6.json",
55
+ repeat: { row: ["A", "B"] },
56
+ spec: {
57
+ mark: "point",
58
+ encoding: {},
59
+ width: "container",
60
+ },
61
+ }),
62
+ ).toBe("container");
63
+ });
64
+
65
+ it("should return undefined for nested spec without width", () => {
66
+ expect(
67
+ getContainerWidth({
68
+ facet: { column: { field: "Origin" } },
69
+ spec: { mark: "point", encoding: {} },
70
+ }),
71
+ ).toBeUndefined();
72
+ });
73
+
74
+ it("should return undefined for hconcat (width on sub-specs)", () => {
75
+ expect(
76
+ getContainerWidth({
77
+ hconcat: [{ width: "container" }, { width: "container" }],
78
+ }),
79
+ ).toBeUndefined();
80
+ });
81
+
82
+ it("should return undefined for vconcat (width on sub-specs)", () => {
83
+ expect(
84
+ getContainerWidth({
85
+ vconcat: [{ width: "container" }, { width: "container" }],
86
+ }),
87
+ ).toBeUndefined();
88
+ });
89
+
90
+ it("should return undefined for compiled Vega spec (width as signal)", () => {
91
+ expect(
92
+ getContainerWidth({
93
+ $schema: "https://vega.github.io/schema/vega/v6.json",
94
+ autosize: { contains: "padding", type: "fit-x" },
95
+ signals: [
96
+ {
97
+ name: "width",
98
+ init: "isFinite(containerSize()[0]) ? containerSize()[0] : 300",
99
+ },
100
+ ],
101
+ }),
102
+ ).toBeUndefined();
103
+ });
36
104
  });
@@ -6,13 +6,22 @@ import type { DataType, FieldTypes, VegaDataType } from "./vega-loader";
6
6
  export type ContainerWidth = number | "container";
7
7
 
8
8
  /**
9
- * Get the container width from a VegaLite spec.
10
- * @param spec - The VegaLite spec.
11
- * @returns The container width.
9
+ * Get the container width from a Vega-Lite spec.
10
+ *
11
+ * For unit specs, `width` is at the top level. For facet/repeat specs,
12
+ * `width` is nested inside `spec`. This does not handle hconcat/vconcat and Vega spec
13
+ * where the width may be a signal. These cases are covered by
14
+ * the CSS fallback `.vega-embed:has(> .chart-wrapper.fit-x)`.
12
15
  */
13
16
  export function getContainerWidth(spec: unknown): ContainerWidth | undefined {
14
- if (typeof spec === "object" && spec !== null && "width" in spec) {
15
- return spec.width as ContainerWidth | undefined;
17
+ if (typeof spec === "object" && spec !== null) {
18
+ if ("width" in spec) {
19
+ return spec.width as ContainerWidth | undefined;
20
+ }
21
+ // Faceted/repeated spec
22
+ if ("spec" in spec) {
23
+ return getContainerWidth(spec.spec);
24
+ }
16
25
  }
17
26
  return undefined;
18
27
  }
@@ -4,7 +4,8 @@
4
4
  max-width: 100%;
5
5
  }
6
6
 
7
- .vega-embed[data-container-width="container"] {
7
+ .vega-embed[data-container-width="container"],
8
+ .vega-embed:has(> .chart-wrapper.fit-x) {
8
9
  width: 100%;
9
10
  }
10
11
 
@@ -71,7 +71,6 @@ function base64ToUint8ArrayFallback(bytes: string): Uint8Array {
71
71
  * Uses native Uint8Array.fromBase64 if available, otherwise falls back to manual implementation.
72
72
  */
73
73
  export const base64ToUint8Array: (bytes: Base64String) => Uint8Array =
74
- // @ts-expect-error - Uint8Array.fromBase64 types coming in TypeScript 5.10+
75
74
  Uint8Array.fromBase64 ?? base64ToUint8ArrayFallback;
76
75
 
77
76
  /**
@@ -100,10 +99,8 @@ function uint8ArrayToBase64Fallback(binary: Uint8Array): Base64String {
100
99
  * Uses native Uint8Array.prototype.toBase64 if available, otherwise falls back to manual implementation.
101
100
  */
102
101
  export const uint8ArrayToBase64: (binary: Uint8Array) => Base64String =
103
- // @ts-expect-error - Uint8Array.prototype.toBase64 types coming in TypeScript 5.10+
104
- Uint8Array.prototype.toBase64
105
- ? // @ts-expect-error - Uint8Array.prototype.toBase64 types coming in TypeScript 5.10+
106
- (binary) => binary.toBase64()
102
+ "toBase64" in Uint8Array.prototype
103
+ ? (binary) => binary.toBase64() as Base64String
107
104
  : uint8ArrayToBase64Fallback;
108
105
 
109
106
  /**
package/src/utils/time.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
- export type Milliseconds = number & { __type__: "milliseconds" };
3
+ import type { TypedNumber } from "./typed";
4
4
 
5
- export type Seconds = number & { __type__: "seconds" };
5
+ export type Milliseconds = TypedNumber<"milliseconds">;
6
+
7
+ export type Seconds = TypedNumber<"seconds">;
6
8
 
7
9
  export class Time {
8
10
  private readonly ms: Milliseconds;
@@ -5,13 +5,13 @@
5
5
  * This is a compile-time type only and does not exist at runtime.
6
6
  * It is used to distinguish between different types of numbers.
7
7
  */
8
- export type TypedNumber<T> = number & { __type__: T };
8
+ export type TypedNumber<T> = number & { __brand: T };
9
9
 
10
10
  /**
11
11
  * A typed string.
12
12
  * This is a compile-time type only and does not exist at runtime.
13
13
  * It is used to distinguish between different types of strings.
14
14
  */
15
- export type TypedString<T> = string & { __type__: T };
15
+ export type TypedString<T> = string & { __brand: T };
16
16
 
17
17
  export type Identified<T> = { id: string } & T;