@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.
- package/dist/assets/{ConnectedDataExplorerComponent-BhOfvmd2.js → ConnectedDataExplorerComponent-Bgd8MpO7.js} +1 -1
- package/dist/assets/{JsonOutput-DK6QFpxq.js → JsonOutput-CYRewW_n.js} +10 -10
- package/dist/assets/{add-cell-with-ai-C9CXMDL-.js → add-cell-with-ai-CJL5NwHh.js} +24 -24
- package/dist/assets/{add-connection-dialog-uUw1BwGd.js → add-connection-dialog-_oI2JBU2.js} +1 -1
- package/dist/assets/{agent-panel-CKXYOD10.js → agent-panel-frCoZBMf.js} +1 -1
- package/dist/assets/ai-model-dropdown-CMj49xMg.js +5 -0
- package/dist/assets/{app-config-button-B4_Fzop6.js → app-config-button-DCVf5Azv.js} +1 -1
- package/dist/assets/{cell-editor-DsXpgc4r.js → cell-editor-nJeqD5Xq.js} +1 -1
- package/dist/assets/{chat-display-CRKEYeok.js → chat-display-DnlV-Vjp.js} +1 -1
- package/dist/assets/chat-panel-BrH9Bycd.js +3 -0
- package/dist/assets/{chat-ui-CQB2SbzK.js → chat-ui-gEEIyfNV.js} +1 -1
- package/dist/assets/{column-preview-CWOsM3UD.js → column-preview-PiH54hAW.js} +1 -1
- package/dist/assets/{command-palette-BXM1GCVc.js → command-palette-CrC7ohqO.js} +1 -1
- package/dist/assets/{edit-page-BXQVe56n.js → edit-page-idaINdSX.js} +7 -7
- package/dist/assets/{file-explorer-panel-QFaPxpp8.js → file-explorer-panel-sS4HTA69.js} +1 -1
- package/dist/assets/{form-CoRP5wCe.js → form-B-BLUzr3.js} +1 -1
- package/dist/assets/{formats-C_TavbEL.js → formats-N7VZhahg.js} +1 -1
- package/dist/assets/{home-page-GHJ3-S70.js → home-page-Lm5CjxXF.js} +1 -1
- package/dist/assets/{hooks-CfqzfU-0.js → hooks-ChIFqb9W.js} +1 -1
- package/dist/assets/index-CCazW2UV.css +2 -0
- package/dist/assets/index-eeNpwqOH.js +35 -0
- package/dist/assets/{layout-FSEZfgnG.js → layout-BlYB96ph.js} +1 -1
- package/dist/assets/{markdown-renderer-wLZT8no0.js → markdown-renderer-CYb9pckL.js} +1 -1
- package/dist/assets/{packages-panel-CwbHm9uC.js → packages-panel-C7RTPIUf.js} +1 -1
- package/dist/assets/{panels-BhaV1xQQ.js → panels-qPMPLlzN.js} +1 -1
- package/dist/assets/{run-page-BtSGYy1m.js → run-page-Cqmrl9SW.js} +1 -1
- package/dist/assets/{scratchpad-panel-riBRfLg4.js → scratchpad-panel-Ddw1KV8R.js} +1 -1
- package/dist/assets/{session-panel-B2ux2cYO.js → session-panel-DTp3QX73.js} +1 -1
- package/dist/assets/{state-LRco7VGF.js → state-Nag9RDED.js} +1 -1
- package/dist/assets/{useNotebookActions-C2iPqhjB.js → useNotebookActions-CG6L_-9T.js} +1 -1
- package/dist/assets/{utils-BDlGlVyF.js → utils-DWFl4LEP.js} +3 -3
- package/dist/assets/{vega-component-DiFt6ZG4.js → vega-component-BAuy1PqH.js} +1 -1
- package/dist/index.html +9 -9
- package/package.json +1 -1
- package/src/__tests__/branded.ts +6 -0
- package/src/components/chat/chat-panel.tsx +2 -1
- package/src/components/data-table/TableBottomBar.tsx +12 -1
- package/src/components/data-table/TableTopBar.tsx +31 -35
- package/src/components/data-table/charts/charts.tsx +40 -11
- package/src/components/data-table/column-explorer-panel/column-explorer.tsx +1 -1
- package/src/components/data-table/data-table.tsx +6 -1
- package/src/components/data-table/loading-table.tsx +4 -1
- package/src/components/data-table/range-focus/cell-selection-stats.tsx +3 -1
- package/src/components/data-table/row-viewer-panel/row-viewer.tsx +1 -1
- package/src/components/data-table/table-explorer-panel/table-explorer-panel.tsx +2 -2
- package/src/components/editor/ai/add-cell-with-ai.tsx +2 -1
- package/src/components/editor/chrome/panels/context-aware-panel/context-aware-panel.tsx +1 -1
- package/src/components/editor/chrome/wrapper/footer-items/lsp-status.tsx +2 -1
- package/src/core/cells/__tests__/apply-transaction.test.ts +12 -11
- package/src/core/cells/document-changes.ts +9 -9
- package/src/core/codemirror/copilot/__tests__/transport.test.ts +128 -2
- package/src/core/codemirror/copilot/client.ts +9 -2
- package/src/core/codemirror/copilot/language-server.ts +11 -0
- package/src/core/codemirror/copilot/transport.ts +32 -6
- package/src/core/islands/__tests__/bridge.test.ts +20 -10
- package/src/core/network/__tests__/requests-lazy.test.ts +30 -14
- package/src/core/websocket/useMarimoKernelConnection.tsx +5 -11
- package/src/core/websocket/useWebSocket.tsx +3 -1
- package/src/css/app/Cell.css +22 -1
- package/src/css/table.css +17 -0
- package/src/plugins/impl/DataTablePlugin.tsx +1 -0
- package/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx +2 -11
- package/src/plugins/impl/vega/__tests__/utils.test.ts +68 -0
- package/src/plugins/impl/vega/utils.ts +14 -5
- package/src/plugins/impl/vega/vega.css +2 -1
- package/src/utils/json/base64.ts +2 -5
- package/src/utils/time.ts +4 -2
- package/src/utils/typed.ts +2 -2
- package/dist/assets/ai-model-dropdown-Ck6NNlZH.js +0 -5
- package/dist/assets/chat-panel-CYkuZYzq.js +0 -3
- package/dist/assets/index-BFY3jw7I.css +0 -2
- 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
|
|
10
|
-
*
|
|
11
|
-
*
|
|
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
|
|
15
|
-
|
|
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
|
}
|
package/src/utils/json/base64.ts
CHANGED
|
@@ -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
|
-
|
|
104
|
-
|
|
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
|
-
|
|
3
|
+
import type { TypedNumber } from "./typed";
|
|
4
4
|
|
|
5
|
-
export type
|
|
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;
|
package/src/utils/typed.ts
CHANGED
|
@@ -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 & {
|
|
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 & {
|
|
15
|
+
export type TypedString<T> = string & { __brand: T };
|
|
16
16
|
|
|
17
17
|
export type Identified<T> = { id: string } & T;
|