@marimo-team/islands 0.23.15-dev3 → 0.23.15-dev30
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/{ConnectedDataExplorerComponent-CU4fZJzG.js → ConnectedDataExplorerComponent-7p7rt9iw.js} +4 -4
- package/dist/{ErrorBoundary-DE6tzZf-.js → ErrorBoundary-B_CAG7_e.js} +1 -1
- package/dist/{ImageComparisonComponent-CHrI72em.js → ImageComparisonComponent-1i5IBhon.js} +173 -129
- package/dist/{chat-ui-DinOvbWu.js → chat-ui-CbyDW7Rb.js} +3103 -3103
- package/dist/{code-visibility-ScKKYzhB.js → code-visibility-D1Y9p_ja.js} +932 -850
- package/dist/{constants-T20xxyNf.js → debounce-BOD3DbfP.js} +1 -24
- package/dist/{formats-Dzx4J_z1.js → formats-BX3uDQbB.js} +1 -1
- package/dist/{glide-data-editor-CjTu7ukN.js → glide-data-editor-CwZz71BD.js} +3 -3
- package/dist/{html-to-image-_wGfk8V-.js → html-to-image-CtsZpKdg.js} +2251 -2216
- package/dist/{input-DtsN7xm-.js → input-BGPrFH3g.js} +2 -2
- package/dist/main.js +1081 -1088
- package/dist/{mermaid-BYqXy_NE.js → mermaid-UdmxG2PZ.js} +2 -2
- package/dist/{process-output-Mh4UrjwM.js → process-output-DApSJpc6.js} +1 -1
- package/dist/{reveal-component-Dp5KdjBI.js → reveal-component-Clfz4vIR.js} +618 -605
- package/dist/{spec-Cz-Bj1JI.js → spec-DSs9v0xx.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{toDate-CWNNlFEX.js → toDate-CKpRx4TS.js} +3 -4
- package/dist/{useAsyncData-KfHB8wQR.js → useAsyncData-BSOyAbac.js} +1 -1
- package/dist/{useDeepCompareMemoize-nJMtxhm4.js → useDeepCompareMemoize-BTLeWzuR.js} +1 -1
- package/dist/{useLifecycle-DegSo0lV.js → useLifecycle-C6wHjkhW.js} +1 -1
- package/dist/{useTheme-6eZ3GOTS.js → useTheme-Df_vGflw.js} +62 -27
- package/dist/{vega-component-DzyyM9fc.js → vega-component-DNHEV0u0.js} +6 -6
- package/package.json +1 -1
- package/src/components/chat/__tests__/chat-utils.test.ts +244 -1
- package/src/components/chat/__tests__/message-queue.test.tsx +121 -0
- package/src/components/chat/chat-panel.tsx +196 -67
- package/src/components/chat/chat-utils.ts +111 -2
- package/src/components/editor/SortableCell.tsx +6 -2
- package/src/components/editor/__tests__/output-persistence.test.tsx +241 -0
- package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +153 -0
- package/src/components/editor/actions/pair-with-agent-commands.ts +109 -0
- package/src/components/editor/actions/pair-with-agent-modal.tsx +20 -64
- package/src/components/editor/ai/add-cell-with-ai.tsx +14 -5
- package/src/components/editor/ai/ai-completion-editor.tsx +4 -1
- package/src/components/editor/cell/cell-context-menu.tsx +7 -0
- package/src/components/editor/chrome/panels/packages-panel.tsx +11 -1
- package/src/components/editor/columns/__tests__/cell-column.test.tsx +105 -0
- package/src/components/editor/columns/cell-column.tsx +34 -4
- package/src/components/editor/columns/sortable-column.tsx +24 -4
- package/src/components/editor/navigation/__tests__/navigation.test.ts +33 -0
- package/src/components/editor/navigation/navigation.ts +8 -1
- package/src/components/editor/notebook-cell.tsx +203 -106
- package/src/components/editor/renderers/__tests__/cells-renderer.test.tsx +66 -0
- package/src/components/editor/renderers/cell-array.tsx +26 -13
- package/src/components/editor/renderers/cells-renderer.tsx +8 -2
- package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +29 -0
- package/src/components/editor/renderers/slides-layout/types.ts +4 -0
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +19 -19
- package/src/components/slides/reveal-component.tsx +37 -4
- package/src/components/slides/slide-form.tsx +72 -0
- package/src/core/cells/__tests__/utils.test.ts +59 -0
- package/src/core/cells/utils.ts +51 -0
- package/src/core/codemirror/completion/__tests__/signature-hint.test.ts +97 -3
- package/src/core/codemirror/completion/signature-hint.ts +78 -11
- package/src/core/constants.ts +6 -0
- package/src/css/app/Cell.css +10 -0
- package/src/hooks/__tests__/useHotkey.test.tsx +88 -0
- package/src/hooks/useHotkey.ts +29 -4
- package/src/plugins/impl/anywidget/__tests__/host.test.ts +6 -9
- package/src/plugins/impl/anywidget/__tests__/widget-binding.test.ts +22 -61
- package/src/plugins/impl/anywidget/model-proxy.ts +0 -13
- package/src/plugins/impl/anywidget/widget-binding.ts +4 -34
- package/src/plugins/impl/image-comparison/ImageComparisonComponent.tsx +53 -2
- package/src/plugins/impl/image-comparison/__tests__/ImageComparisonComponent.test.tsx +71 -0
- package/src/plugins/impl/matplotlib/__tests__/matplotlib-renderer.test.ts +71 -3
- package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +1 -0
- package/src/theme/__tests__/useTheme.test.ts +68 -0
- package/src/theme/useTheme.ts +16 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { afterEach, describe, expect, it } from "vitest";
|
|
4
|
+
import { configOverridesAtom, userConfigAtom } from "@/core/config/config";
|
|
5
|
+
import { defaultUserConfig } from "@/core/config/config-schema";
|
|
6
|
+
import { store } from "@/core/state/jotai";
|
|
7
|
+
import type { Theme } from "../useTheme";
|
|
8
|
+
import { resolvedThemeAtom, visibleForTesting } from "../useTheme";
|
|
9
|
+
|
|
10
|
+
const { themeFromQueryParam } = visibleForTesting;
|
|
11
|
+
|
|
12
|
+
function setQuery(search: string): void {
|
|
13
|
+
window.history.replaceState({}, "", search === "" ? "/" : `/?${search}`);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function setConfigTheme(theme: Theme): void {
|
|
17
|
+
const config = defaultUserConfig();
|
|
18
|
+
store.set(userConfigAtom, {
|
|
19
|
+
...config,
|
|
20
|
+
display: { ...config.display, theme },
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
afterEach(() => {
|
|
25
|
+
setQuery("");
|
|
26
|
+
store.set(userConfigAtom, defaultUserConfig());
|
|
27
|
+
store.set(configOverridesAtom, {});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe("themeFromQueryParam", () => {
|
|
31
|
+
it.each(["light", "dark", "system"] as const)(
|
|
32
|
+
"returns the valid theme %s",
|
|
33
|
+
(theme) => {
|
|
34
|
+
setQuery(`theme=${theme}`);
|
|
35
|
+
expect(themeFromQueryParam()).toBe(theme);
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
it("returns undefined when the param is absent", () => {
|
|
40
|
+
setQuery("");
|
|
41
|
+
expect(themeFromQueryParam()).toBeUndefined();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
it("returns undefined for an invalid value", () => {
|
|
45
|
+
setQuery("theme=blue");
|
|
46
|
+
expect(themeFromQueryParam()).toBeUndefined();
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
describe("resolvedThemeAtom with a theme query param", () => {
|
|
51
|
+
it("uses the saved config theme when no param is present", () => {
|
|
52
|
+
setConfigTheme("dark");
|
|
53
|
+
setQuery("");
|
|
54
|
+
expect(store.get(resolvedThemeAtom)).toBe("dark");
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it("lets the query param override the saved config theme", () => {
|
|
58
|
+
setConfigTheme("light");
|
|
59
|
+
setQuery("theme=dark");
|
|
60
|
+
expect(store.get(resolvedThemeAtom)).toBe("dark");
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("falls back to the config theme for an invalid param value", () => {
|
|
64
|
+
setConfigTheme("dark");
|
|
65
|
+
setQuery("theme=blue");
|
|
66
|
+
expect(store.get(resolvedThemeAtom)).toBe("dark");
|
|
67
|
+
});
|
|
68
|
+
});
|
package/src/theme/useTheme.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { atom, useAtomValue } from "jotai";
|
|
4
4
|
import { resolvedMarimoConfigAtom } from "@/core/config/config";
|
|
5
|
+
import { KnownQueryParams } from "@/core/constants";
|
|
5
6
|
import { isIslands } from "@/core/islands/utils";
|
|
6
7
|
import { store } from "@/core/state/jotai";
|
|
7
8
|
|
|
@@ -10,6 +11,16 @@ export type ResolvedTheme = "light" | "dark";
|
|
|
10
11
|
|
|
11
12
|
export const THEMES: Theme[] = ["light", "dark", "system"];
|
|
12
13
|
|
|
14
|
+
function themeFromQueryParam(): Theme | undefined {
|
|
15
|
+
if (typeof window === "undefined") {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
const value = new URLSearchParams(window.location.search).get(
|
|
19
|
+
KnownQueryParams.theme,
|
|
20
|
+
);
|
|
21
|
+
return THEMES.includes(value as Theme) ? (value as Theme) : undefined;
|
|
22
|
+
}
|
|
23
|
+
|
|
13
24
|
const themeAtom = atom((get) => {
|
|
14
25
|
// If it is islands, try a few ways to infer if it is dark mode.
|
|
15
26
|
if (isIslands()) {
|
|
@@ -51,7 +62,7 @@ const themeAtom = atom((get) => {
|
|
|
51
62
|
return "light";
|
|
52
63
|
}
|
|
53
64
|
|
|
54
|
-
return get(resolvedMarimoConfigAtom).display.theme;
|
|
65
|
+
return themeFromQueryParam() ?? get(resolvedMarimoConfigAtom).display.theme;
|
|
55
66
|
});
|
|
56
67
|
|
|
57
68
|
const prefersDarkModeAtom = atom(false);
|
|
@@ -122,3 +133,7 @@ export function useTheme(): { theme: ResolvedTheme } {
|
|
|
122
133
|
const theme = useAtomValue(resolvedThemeAtom, { store });
|
|
123
134
|
return { theme };
|
|
124
135
|
}
|
|
136
|
+
|
|
137
|
+
export const visibleForTesting = {
|
|
138
|
+
themeFromQueryParam,
|
|
139
|
+
};
|