@marimo-team/islands 0.16.4 → 0.16.5
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-CCjhPKMy.js → ConnectedDataExplorerComponent-D96i9G-X.js} +3 -3
- package/dist/assets/__vite-browser-external-Dv_SHu1h.js +1 -0
- package/dist/assets/{worker-DnuXpGWN.js → worker-DVOR9oZG.js} +2 -2
- package/dist/{formats-D5C6JAJf.js → formats-ChrNdVdJ.js} +1 -1
- package/dist/{glide-data-editor-CYfKmSNp.js → glide-data-editor-D_kEsT07.js} +68 -68
- package/dist/main.js +84 -213
- package/dist/{mermaid-BlJDcO4M.js → mermaid-MWiyXDcI.js} +2 -2
- package/dist/style.css +1 -1
- package/dist/{types-Dcb1hf55.js → types-1X1uZB4y.js} +323 -179
- package/dist/{useAsyncData-DAtPzJzP.js → useAsyncData-C4IqQK0g.js} +1 -1
- package/dist/{useDateFormatter-CiUlIu7v.js → useDateFormatter-BCsBqetx.js} +1 -1
- package/dist/{useTheme-CmsvrO5o.js → useTheme-C2pgJzDH.js} +1 -0
- package/dist/{vega-component-B3LA6qbm.js → vega-component-Cv4J8CHz.js} +3 -3
- package/package.json +1 -1
- package/src/__tests__/chat-history.test.ts +123 -0
- package/src/components/app-config/ai-config.tsx +23 -0
- package/src/components/app-config/mcp-config.tsx +42 -2
- package/src/components/app-config/user-config-form.tsx +0 -24
- package/src/components/chat/acp/__tests__/context-utils.test.ts +1 -1
- package/src/components/chat/acp/agent-panel.tsx +1 -1
- package/src/components/chat/acp/blocks.tsx +46 -53
- package/src/components/chat/acp/common.tsx +1 -1
- package/src/components/chat/acp/context-utils.ts +1 -1
- package/src/components/chat/acp/session-tabs.tsx +1 -1
- package/src/components/chat/chat-history-popover.tsx +125 -0
- package/src/components/chat/chat-history-utils.ts +69 -0
- package/src/components/chat/chat-panel.tsx +9 -57
- package/src/components/editor/__tests__/data-attributes.test.tsx +1 -1
- package/src/components/editor/actions/useNotebookActions.tsx +2 -4
- package/src/components/editor/ai/__tests__/completion-utils.test.ts +23 -31
- package/src/components/editor/cell/CreateCellButton.tsx +14 -2
- package/src/components/editor/cell/code/cell-editor.tsx +1 -0
- package/src/components/editor/database/schemas.ts +2 -10
- package/src/components/editor/{Cell.tsx → notebook-cell.tsx} +5 -1
- package/src/components/editor/output/MarimoErrorOutput.tsx +4 -34
- package/src/components/editor/renderers/{CellArray.tsx → cell-array.tsx} +1 -1
- package/src/components/forms/__tests__/form-utils.test.ts +2 -2
- package/src/components/mcp/hooks.ts +48 -0
- package/src/components/mcp/mcp-status-indicator.tsx +144 -0
- package/src/components/ui/number-field.tsx +4 -1
- package/src/core/ai/context/providers/__tests__/__snapshots__/tables.test.ts.snap +13 -19
- package/src/core/ai/context/providers/__tests__/cell-output.test.ts +0 -1
- package/src/core/ai/context/providers/__tests__/datasource.test.ts +5 -6
- package/src/core/ai/context/providers/__tests__/error.test.ts +24 -15
- package/src/core/ai/context/providers/cell-output.ts +5 -5
- package/src/core/ai/context/providers/common.ts +13 -4
- package/src/core/ai/context/providers/datasource.ts +31 -20
- package/src/core/ai/context/providers/error.ts +3 -4
- package/src/core/ai/context/providers/file.ts +2 -2
- package/src/core/ai/context/providers/tables.ts +36 -8
- package/src/core/ai/context/providers/variable.ts +2 -3
- package/src/core/cells/__tests__/cells.test.ts +6 -6
- package/src/core/cells/cells.ts +12 -13
- package/src/core/cells/scrollCellIntoView.ts +1 -1
- package/src/core/codemirror/__tests__/setup.test.ts +1 -0
- package/src/core/codemirror/cm.ts +3 -2
- package/src/core/config/__tests__/config-schema.test.ts +2 -0
- package/src/core/config/config-schema.ts +2 -0
- package/src/core/config/feature-flag.tsx +0 -2
- package/src/core/edit-app.tsx +1 -1
- package/src/core/network/CachingRequestRegistry.ts +2 -2
- package/src/stories/cell.stories.tsx +1 -1
- package/src/stories/layout/vertical/one-column.stories.tsx +1 -1
- package/src/utils/numbers.ts +24 -1
- package/dist/assets/__vite-browser-external-BeNtI_tJ.js +0 -1
package/src/core/cells/cells.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { type Atom, atom, useAtom, useAtomValue } from "jotai";
|
|
|
5
5
|
import { atomFamily, selectAtom, splitAtom } from "jotai/utils";
|
|
6
6
|
import { isEqual, zip } from "lodash-es";
|
|
7
7
|
import { createRef, type ReducerWithoutAction } from "react";
|
|
8
|
-
import type { CellHandle } from "@/components/editor/
|
|
8
|
+
import type { CellHandle } from "@/components/editor/notebook-cell";
|
|
9
9
|
import {
|
|
10
10
|
type CellColumnId,
|
|
11
11
|
type CellIndex,
|
|
@@ -1324,21 +1324,19 @@ const {
|
|
|
1324
1324
|
cellRuntime: newCellRuntime,
|
|
1325
1325
|
};
|
|
1326
1326
|
},
|
|
1327
|
-
|
|
1328
|
-
|
|
1327
|
+
addSetupCellIfDoesntExist: (state, action: { code?: string }) => {
|
|
1328
|
+
let { code } = action;
|
|
1329
|
+
if (code == null) {
|
|
1330
|
+
code = "# Initialization code that runs before all other cells";
|
|
1331
|
+
}
|
|
1329
1332
|
|
|
1330
1333
|
// First check if setup cell already exists
|
|
1331
1334
|
if (SETUP_CELL_ID in state.cellData) {
|
|
1332
|
-
//
|
|
1333
|
-
return
|
|
1334
|
-
state,
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
...cell,
|
|
1338
|
-
code,
|
|
1339
|
-
edited: code.trim() !== cell.lastCodeRun?.trim(),
|
|
1340
|
-
}),
|
|
1341
|
-
});
|
|
1335
|
+
// Just focus on the existing setup cell
|
|
1336
|
+
return {
|
|
1337
|
+
...state,
|
|
1338
|
+
scrollKey: SETUP_CELL_ID,
|
|
1339
|
+
};
|
|
1342
1340
|
}
|
|
1343
1341
|
|
|
1344
1342
|
return {
|
|
@@ -1365,6 +1363,7 @@ const {
|
|
|
1365
1363
|
...state.cellHandles,
|
|
1366
1364
|
[SETUP_CELL_ID]: createRef(),
|
|
1367
1365
|
},
|
|
1366
|
+
scrollKey: SETUP_CELL_ID,
|
|
1368
1367
|
};
|
|
1369
1368
|
},
|
|
1370
1369
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* Copyright 2024 Marimo. All rights reserved. */
|
|
2
2
|
import type { RefObject } from "react";
|
|
3
|
-
import type { CellHandle } from "@/components/editor/Cell";
|
|
4
3
|
import {
|
|
5
4
|
isAnyCellFocused,
|
|
6
5
|
tryFocus,
|
|
7
6
|
} from "@/components/editor/navigation/focus-utils";
|
|
7
|
+
import type { CellHandle } from "@/components/editor/notebook-cell";
|
|
8
8
|
import { retryWithTimeout } from "@/utils/timeout";
|
|
9
9
|
import { Logger } from "../../utils/Logger";
|
|
10
10
|
import { goToVariableDefinition } from "../codemirror/go-to-definition/commands";
|
|
@@ -46,7 +46,6 @@ import type {
|
|
|
46
46
|
KeymapConfig,
|
|
47
47
|
LSPConfig,
|
|
48
48
|
} from "../config/config-schema";
|
|
49
|
-
import { getFeatureFlag } from "../config/feature-flag";
|
|
50
49
|
import type { HotkeyProvider } from "../hotkeys/hotkeys";
|
|
51
50
|
import { store } from "../state/jotai";
|
|
52
51
|
import { requestEditCompletion } from "./ai/request";
|
|
@@ -83,6 +82,7 @@ export interface CodeMirrorSetupOpts {
|
|
|
83
82
|
lspConfig: LSPConfig;
|
|
84
83
|
diagnosticsConfig: DiagnosticsConfig;
|
|
85
84
|
displayConfig: Pick<DisplayConfig, "reference_highlighting">;
|
|
85
|
+
inlineAiTooltip: boolean;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
function getPlaceholderType(opts: CodeMirrorSetupOpts) {
|
|
@@ -104,6 +104,7 @@ export const setupCodeMirror = (opts: CodeMirrorSetupOpts): Extension[] => {
|
|
|
104
104
|
lspConfig,
|
|
105
105
|
diagnosticsConfig,
|
|
106
106
|
displayConfig,
|
|
107
|
+
inlineAiTooltip,
|
|
107
108
|
} = opts;
|
|
108
109
|
const placeholderType = getPlaceholderType(opts);
|
|
109
110
|
|
|
@@ -128,7 +129,7 @@ export const setupCodeMirror = (opts: CodeMirrorSetupOpts): Extension[] => {
|
|
|
128
129
|
goToDefinitionBundle(),
|
|
129
130
|
diagnosticsConfig?.enabled ? lintGutter() : [],
|
|
130
131
|
// AI edit inline
|
|
131
|
-
enableAI &&
|
|
132
|
+
enableAI && inlineAiTooltip
|
|
132
133
|
? [
|
|
133
134
|
aiExtension({
|
|
134
135
|
prompt: (req) => {
|
|
@@ -45,6 +45,7 @@ test("default UserConfig - empty", () => {
|
|
|
45
45
|
expect(defaultConfig).toMatchInlineSnapshot(`
|
|
46
46
|
{
|
|
47
47
|
"ai": {
|
|
48
|
+
"inline_tooltip": false,
|
|
48
49
|
"mode": "manual",
|
|
49
50
|
"models": {
|
|
50
51
|
"custom_models": [],
|
|
@@ -110,6 +111,7 @@ test("default UserConfig - one level", () => {
|
|
|
110
111
|
expect(defaultConfig).toMatchInlineSnapshot(`
|
|
111
112
|
{
|
|
112
113
|
"ai": {
|
|
114
|
+
"inline_tooltip": false,
|
|
113
115
|
"mode": "manual",
|
|
114
116
|
"models": {
|
|
115
117
|
"custom_models": [],
|
|
@@ -152,6 +152,7 @@ export const UserConfigSchema = z
|
|
|
152
152
|
.looseObject({
|
|
153
153
|
rules: z.string().prefault(""),
|
|
154
154
|
mode: z.enum(["manual", "ask"]).prefault("manual"),
|
|
155
|
+
inline_tooltip: z.boolean().prefault(false),
|
|
155
156
|
open_ai: AiConfigSchema.optional(),
|
|
156
157
|
anthropic: AiConfigSchema.optional(),
|
|
157
158
|
google: AiConfigSchema.optional(),
|
|
@@ -216,6 +217,7 @@ export type KeymapConfig = UserConfig["keymap"];
|
|
|
216
217
|
export type LSPConfig = UserConfig["language_servers"];
|
|
217
218
|
export type DiagnosticsConfig = UserConfig["diagnostics"];
|
|
218
219
|
export type DisplayConfig = UserConfig["display"];
|
|
220
|
+
export type AiConfig = UserConfig["ai"];
|
|
219
221
|
|
|
220
222
|
export const AppTitleSchema = z.string();
|
|
221
223
|
export const SqlOutputSchema = z
|
|
@@ -7,7 +7,6 @@ import { getResolvedMarimoConfig } from "./config";
|
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
8
8
|
export interface ExperimentalFeatures {
|
|
9
9
|
markdown: boolean; // Used in playground (community cloud)
|
|
10
|
-
inline_ai_tooltip: boolean;
|
|
11
10
|
wasm_layouts: boolean; // Used in playground (community cloud)
|
|
12
11
|
rtc_v2: boolean;
|
|
13
12
|
performant_table_charts: boolean;
|
|
@@ -20,7 +19,6 @@ export interface ExperimentalFeatures {
|
|
|
20
19
|
|
|
21
20
|
const defaultValues: ExperimentalFeatures = {
|
|
22
21
|
markdown: true,
|
|
23
|
-
inline_ai_tooltip: import.meta.env.DEV,
|
|
24
22
|
wasm_layouts: false,
|
|
25
23
|
rtc_v2: false,
|
|
26
24
|
performant_table_charts: false,
|
package/src/core/edit-app.tsx
CHANGED
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
useRunAllCells,
|
|
16
16
|
useRunStaleCells,
|
|
17
17
|
} from "../components/editor/cell/useRunCells";
|
|
18
|
-
import { CellArray } from "../components/editor/renderers/
|
|
18
|
+
import { CellArray } from "../components/editor/renderers/cell-array";
|
|
19
19
|
import { CellsRenderer } from "../components/editor/renderers/cells-renderer";
|
|
20
20
|
import { useHotkey } from "../hooks/useHotkey";
|
|
21
21
|
import {
|
|
@@ -56,9 +56,9 @@ export class CachingRequestRegistry<REQ, RES> {
|
|
|
56
56
|
|
|
57
57
|
const promise = this.delegate.request(req);
|
|
58
58
|
this.cache.set(key, promise);
|
|
59
|
-
return promise.catch((
|
|
59
|
+
return promise.catch((error) => {
|
|
60
60
|
this.cache.delete(key);
|
|
61
|
-
throw
|
|
61
|
+
throw error;
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -16,7 +16,7 @@ import type { CellConfig } from "@/core/network/types";
|
|
|
16
16
|
import { WebSocketState } from "@/core/websocket/types";
|
|
17
17
|
import { MultiColumn } from "@/utils/id-tree";
|
|
18
18
|
import type { Milliseconds, Seconds } from "@/utils/time";
|
|
19
|
-
import { Cell as EditorCell } from "../components/editor/
|
|
19
|
+
import { Cell as EditorCell } from "../components/editor/notebook-cell";
|
|
20
20
|
import { TooltipProvider } from "../components/ui/tooltip";
|
|
21
21
|
import type { CellId } from "../core/cells/ids";
|
|
22
22
|
|
|
@@ -13,7 +13,7 @@ import { resolveRequestClient } from "@/core/network/resolve";
|
|
|
13
13
|
import { WebSocketState } from "@/core/websocket/types";
|
|
14
14
|
import { MultiColumn } from "@/utils/id-tree";
|
|
15
15
|
import type { Milliseconds, Seconds } from "@/utils/time";
|
|
16
|
-
import { CellArray } from "../../../components/editor/renderers/
|
|
16
|
+
import { CellArray } from "../../../components/editor/renderers/cell-array";
|
|
17
17
|
import { CellsRenderer } from "../../../components/editor/renderers/cells-renderer";
|
|
18
18
|
import { TooltipProvider } from "../../../components/ui/tooltip";
|
|
19
19
|
import type { CellId } from "../../../core/cells/ids";
|
package/src/utils/numbers.ts
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
/* Copyright 2024 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
|
+
import { Logger } from "./Logger";
|
|
4
|
+
import { memoizeLastValue } from "./once";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Browsers have a limit on the maximum number of fractional digits they can display.
|
|
8
|
+
* This function finds the maximum number of fractional digits that can be displayed for a given locale.
|
|
9
|
+
*/
|
|
10
|
+
export const maxFractionalDigits = memoizeLastValue((locale: string) => {
|
|
11
|
+
const options = [100, 20, 2, 0];
|
|
12
|
+
for (const option of options) {
|
|
13
|
+
try {
|
|
14
|
+
new Intl.NumberFormat(locale, {
|
|
15
|
+
minimumFractionDigits: 0,
|
|
16
|
+
maximumFractionDigits: option,
|
|
17
|
+
}).format(1);
|
|
18
|
+
return option;
|
|
19
|
+
} catch (e) {
|
|
20
|
+
Logger.error(e);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return 0;
|
|
24
|
+
});
|
|
25
|
+
|
|
3
26
|
export function prettyNumber(value: unknown, locale: string): string {
|
|
4
27
|
if (value === undefined || value === null) {
|
|
5
28
|
return "";
|
|
@@ -80,7 +103,7 @@ export function prettyScientificNumber(
|
|
|
80
103
|
// Don't round
|
|
81
104
|
return value.toLocaleString(locale, {
|
|
82
105
|
minimumFractionDigits: 0,
|
|
83
|
-
maximumFractionDigits:
|
|
106
|
+
maximumFractionDigits: maxFractionalDigits(locale),
|
|
84
107
|
});
|
|
85
108
|
}
|
|
86
109
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{__commonJSMin as e}from"./worker-DnuXpGWN.js";var t=e(((e,t)=>{t.exports={}}));export default t();
|