@marimo-team/islands 0.23.14-dev5 → 0.23.14-dev50
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-Du3_nUzI.js → ConnectedDataExplorerComponent-DXBx_nQg.js} +4 -4
- package/dist/{chat-ui-BZxLHwyD.js → chat-ui-DXPRhRO2.js} +3248 -3044
- package/dist/{click-outside-container-BDd67_1U.js → click-outside-container-BLPjMamz.js} +141 -113
- package/dist/{code-visibility-rxZi4Phe.js → code-visibility-BFDT-GEQ.js} +1153 -946
- package/dist/data-grid-overlay-editor-C6lxUJp-.js +136 -0
- package/dist/{dist-D_bzzWBm.js → dist-Bf9f8MuT.js} +3 -3
- package/dist/{formats-d6MhLuQ9.js → formats-WsOgyW_K.js} +1 -1
- package/dist/{glide-data-editor-DkzAInWG.js → glide-data-editor-7wxMGXjG.js} +2084 -1889
- package/dist/{html-to-image-CGp_08St.js → html-to-image-DOqQBSQc.js} +2367 -2301
- package/dist/{input-CbEz_aj_.js → input-BSdZp5Ng.js} +1 -1
- package/dist/main.js +2707 -1186
- package/dist/{mermaid-CJW9vIyO.js → mermaid-D-HYBMEV.js} +2 -2
- package/dist/{number-overlay-editor-D-a0qCT8.js → number-overlay-editor-BLJXvX9c.js} +1 -1
- package/dist/{process-output-R6JsYrv3.js → process-output-kGk2Jc2x.js} +1 -1
- package/dist/{reveal-component-sEb3Wd1x.js → reveal-component-uSCMaaUE.js} +600 -596
- package/dist/{spec-Bv-XlYiv.js → spec-CnTgI25l.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{toDate-D-l5s8nn.js → toDate-D1Z7ZXWh.js} +1 -1
- package/dist/{useAsyncData-1Dhzjfwf.js → useAsyncData-BMc8itk2.js} +1 -1
- package/dist/{useDeepCompareMemoize-CDWT3BDz.js → useDeepCompareMemoize-ZwmDBRDY.js} +1 -1
- package/dist/{useLifecycle-AHlswLw-.js → useLifecycle-CxffarYV.js} +1 -1
- package/dist/{useTheme-BrYvK-_A.js → useTheme-yGsGEk82.js} +26 -24
- package/dist/{vega-component-Pk6lyc_a.js → vega-component-BFJTyykA.js} +5 -5
- package/package.json +3 -3
- package/src/__mocks__/requests.ts +1 -0
- package/src/components/app-config/user-config-form.tsx +26 -0
- package/src/components/chat/acp/agent-panel.tsx +35 -1
- package/src/components/chat/chat-panel.tsx +68 -29
- package/src/components/data-table/__tests__/column-explorer.test.tsx +25 -0
- package/src/components/data-table/__tests__/column-visibility-dropdown.test.tsx +60 -3
- package/src/components/data-table/charts/__tests__/altair-generator.test.ts +24 -0
- package/src/components/data-table/charts/__tests__/merge-index-fields.test.ts +33 -0
- package/src/components/data-table/charts/chart-spec/altair-generator.ts +4 -1
- package/src/components/data-table/charts/charts.tsx +23 -1
- package/src/components/data-table/column-explorer-panel/column-explorer.tsx +33 -12
- package/src/components/data-table/column-visibility-dropdown.tsx +15 -0
- package/src/components/debugger/debugger-code.tsx +7 -2
- package/src/components/editor/actions/useNotebookActions.tsx +2 -2
- package/src/components/editor/cell/cell-context-menu.tsx +2 -2
- package/src/components/editor/chrome/panels/snippets-panel.tsx +3 -3
- package/src/components/editor/chrome/wrapper/__tests__/useOpenAiAssistant.test.ts +36 -0
- package/src/components/editor/chrome/wrapper/footer-items/pyodide-status.tsx +6 -36
- package/src/components/editor/chrome/wrapper/useAiPanel.ts +3 -1
- package/src/components/editor/chrome/wrapper/useOpenAiAssistant.ts +88 -0
- package/src/components/editor/code/__tests__/readonly-python-code.test.tsx +79 -0
- package/src/components/editor/code/readonly-python-code.tsx +60 -33
- package/src/components/editor/errors/__tests__/auto-fix.test.ts +23 -0
- package/src/components/editor/errors/auto-fix.tsx +88 -34
- package/src/components/editor/errors/fix-mode.ts +1 -1
- package/src/components/editor/notebook-cell.tsx +7 -0
- package/src/components/editor/output/MarimoTracebackOutput.tsx +28 -2
- package/src/components/editor/output/__tests__/traceback.test.tsx +14 -6
- package/src/components/editor/renderers/grid-layout/grid-layout.tsx +7 -2
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +7 -3
- package/src/components/lifecycle/ProgressiveBoundary.tsx +42 -0
- package/src/components/lifecycle/RuntimeStatusBadge.tsx +59 -0
- package/src/components/lifecycle/__tests__/ProgressiveBoundary.test.tsx +147 -0
- package/src/components/lifecycle/__tests__/RuntimeStatusBadge.test.tsx +72 -0
- package/src/components/slides/__tests__/slide.test.tsx +33 -0
- package/src/components/slides/minimap.tsx +7 -1
- package/src/components/slides/reveal-component.tsx +3 -0
- package/src/components/slides/slide-cell-view.tsx +10 -6
- package/src/components/slides/slide.tsx +16 -13
- package/src/core/ai/config.ts +2 -2
- package/src/core/ai/context/__tests__/registry.test.ts +133 -3
- package/src/core/ai/context/providers/__tests__/datasource.test.ts +3 -1
- package/src/core/ai/context/providers/__tests__/error.test.ts +200 -15
- package/src/core/ai/context/providers/datasource.ts +27 -2
- package/src/core/ai/context/providers/error.ts +226 -36
- package/src/core/ai/context/registry.ts +77 -43
- package/src/core/ai/state.ts +11 -0
- package/src/core/cells/__tests__/cell.test.ts +39 -0
- package/src/core/cells/__tests__/readonly-code-display.test.ts +46 -0
- package/src/core/cells/cell.ts +5 -3
- package/src/core/cells/readonly-code-display.ts +35 -0
- package/src/core/codemirror/__tests__/setup.test.ts +33 -1
- package/src/core/codemirror/ai/resources.ts +15 -10
- package/src/core/codemirror/cells/__tests__/debugger-decorations.test.ts +185 -0
- package/src/core/codemirror/cells/__tests__/debugger-state.test.ts +139 -0
- package/src/core/codemirror/cells/debugger-decorations.ts +188 -0
- package/src/core/codemirror/cells/debugger-state.ts +100 -0
- package/src/core/codemirror/cells/extensions.ts +23 -4
- package/src/core/codemirror/go-to-definition/__tests__/utils.test.ts +75 -3
- package/src/core/codemirror/go-to-definition/extension.ts +3 -3
- package/src/core/codemirror/go-to-definition/underline.ts +5 -14
- package/src/core/codemirror/go-to-definition/utils.ts +49 -1
- package/src/core/codemirror/utils.ts +15 -0
- package/src/core/config/feature-flag.tsx +2 -0
- package/src/core/edit-app.tsx +8 -5
- package/src/core/errors/errors.ts +2 -1
- package/src/core/islands/bootstrap.ts +1 -0
- package/src/core/islands/bridge.ts +1 -0
- package/src/core/lifecycle/__tests__/render-policy.test.ts +247 -0
- package/src/core/lifecycle/render-policy.ts +125 -0
- package/src/core/mime.ts +11 -4
- package/src/core/network/__tests__/api.test.ts +17 -0
- package/src/core/network/__tests__/requests-toasting.test.tsx +46 -0
- package/src/core/network/api.ts +17 -6
- package/src/core/network/requests-lazy.ts +1 -0
- package/src/core/network/requests-network.ts +8 -0
- package/src/core/network/requests-static.ts +1 -0
- package/src/core/network/requests-toasting.tsx +10 -1
- package/src/core/network/types.ts +2 -0
- package/src/core/run-app.tsx +27 -23
- package/src/core/runtime/__tests__/adapter.test.ts +160 -0
- package/src/core/runtime/adapter.ts +182 -0
- package/src/core/wasm/PyodideLoader.tsx +20 -62
- package/src/core/wasm/bridge.ts +13 -4
- package/src/core/wasm/state.ts +8 -19
- package/src/core/websocket/useMarimoKernelConnection.tsx +17 -0
- package/src/css/app/codemirror.css +14 -0
- package/src/hooks/__tests__/useDelayElapsed.test.tsx +55 -0
- package/src/hooks/useDelayElapsed.ts +27 -0
- package/src/plugins/core/RenderHTML.tsx +35 -1
- package/src/plugins/core/__test__/RenderHTML.test.ts +44 -0
- package/src/plugins/impl/DataTablePlugin.tsx +1 -0
- package/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx +53 -2
- package/src/plugins/impl/anywidget/__tests__/AnyWidgetPlugin.test.tsx +52 -2
- package/src/plugins/impl/data-editor/__tests__/glide-data-editor.test.tsx +187 -0
- package/src/plugins/impl/data-editor/glide-data-editor.tsx +6 -0
- package/src/plugins/impl/data-editor/glide-portal.tsx +73 -0
- package/src/utils/errors.ts +15 -0
- package/dist/data-grid-overlay-editor-mfEJ5475.js +0 -128
- package/src/components/editor/chrome/panels/__tests__/snippet-display.test.ts +0 -22
- package/src/components/editor/chrome/panels/snippet-display.ts +0 -27
- package/src/core/ai/context/providers/__tests__/__snapshots__/error.test.ts.snap +0 -3
- package/src/core/wasm/__tests__/PyodideLoader.test.ts +0 -72
- package/src/core/wasm/__tests__/state.test.ts +0 -124
|
@@ -6,7 +6,7 @@ import { _ as Logger } from "./button-BacYv-bE.js";
|
|
|
6
6
|
import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
|
|
7
7
|
import { u as createLucideIcon } from "./dist--2Bqjvs0.js";
|
|
8
8
|
import { r as KnownQueryParams } from "./constants-T20xxyNf.js";
|
|
9
|
-
import {
|
|
9
|
+
import { S as atom, g as isIslands, h as waitFor, p as store } from "./useTheme-yGsGEk82.js";
|
|
10
10
|
import { t as invariant } from "./invariant-wRzNXIsJ.js";
|
|
11
11
|
var CircleQuestionMark = createLucideIcon("circle-question-mark", [
|
|
12
12
|
["circle", {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { s as __toESM } from "./chunk-BNovOVIE.js";
|
|
2
2
|
import { t as require_react } from "./react-DA-nE2FX.js";
|
|
3
3
|
import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
|
|
4
|
-
import {
|
|
4
|
+
import { D as useEvent_default } from "./useTheme-yGsGEk82.js";
|
|
5
5
|
import { t as invariant } from "./invariant-wRzNXIsJ.js";
|
|
6
6
|
var import_compiler_runtime = require_compiler_runtime(), import_react = /* @__PURE__ */ __toESM(require_react(), 1), Result = {
|
|
7
7
|
error(e, s) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { s as __toESM } from "./chunk-BNovOVIE.js";
|
|
2
2
|
import { t as require_react } from "./react-DA-nE2FX.js";
|
|
3
|
-
import {
|
|
3
|
+
import { E as dequal } from "./useTheme-yGsGEk82.js";
|
|
4
4
|
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
5
5
|
function useDeepCompareMemoize(e) {
|
|
6
6
|
let i = import_react.useRef(e);
|
|
@@ -4,7 +4,7 @@ import { t as require_react } from "./react-DA-nE2FX.js";
|
|
|
4
4
|
import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
|
|
5
5
|
import { u as createLucideIcon } from "./dist--2Bqjvs0.js";
|
|
6
6
|
import { t as require_jsx_runtime } from "./jsx-runtime-DebpN0FN.js";
|
|
7
|
-
import {
|
|
7
|
+
import { S as atom, b as useSetAtom } from "./useTheme-yGsGEk82.js";
|
|
8
8
|
var Calendar = createLucideIcon("calendar", [
|
|
9
9
|
["path", {
|
|
10
10
|
d: "M8 2v4",
|
|
@@ -709,8 +709,8 @@ function useResolvedMarimoConfig() {
|
|
|
709
709
|
function getResolvedMarimoConfig() {
|
|
710
710
|
return store.get(resolvedMarimoConfigAtom);
|
|
711
711
|
}
|
|
712
|
-
atom((e) => isAiEnabled(e(resolvedMarimoConfigAtom)))
|
|
713
|
-
const aiFeaturesEnabledAtom = atom((e) => isAiFeatureEnabled(e(resolvedMarimoConfigAtom)));
|
|
712
|
+
atom((e) => isAiEnabled(e(resolvedMarimoConfigAtom)));
|
|
713
|
+
const aiModelConfiguredAtom = atom((e) => isAiModelConfigured(e(resolvedMarimoConfigAtom))), aiFeaturesEnabledAtom = atom((e) => isAiFeatureEnabled(e(resolvedMarimoConfigAtom)));
|
|
714
714
|
atom((e) => e(resolvedMarimoConfigAtom).display.code_editor_font_size);
|
|
715
715
|
const localeAtom = atom((e) => e(resolvedMarimoConfigAtom).display.locale);
|
|
716
716
|
function isAiEnabled(e) {
|
|
@@ -790,29 +790,31 @@ function useTheme() {
|
|
|
790
790
|
return e[1] === j ? M = e[2] : (M = { theme: j }, e[1] = j, e[2] = M), M;
|
|
791
791
|
}
|
|
792
792
|
export {
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
793
|
+
createStore as C,
|
|
794
|
+
useEvent_default as D,
|
|
795
|
+
dequal as E,
|
|
796
|
+
atom as S,
|
|
797
|
+
getBuildingBlocks as T,
|
|
798
|
+
Provider as _,
|
|
799
|
+
autoInstantiateAtom as a,
|
|
800
|
+
useSetAtom as b,
|
|
801
|
+
resolvedMarimoConfigAtom as c,
|
|
802
|
+
AppConfigSchema as d,
|
|
803
|
+
createDeepEqualAtom as f,
|
|
804
|
+
isIslands as g,
|
|
805
|
+
waitFor as h,
|
|
806
|
+
aiModelConfiguredAtom as i,
|
|
807
|
+
useResolvedMarimoConfig as l,
|
|
808
|
+
useJotaiEffect as m,
|
|
807
809
|
useTheme as n,
|
|
808
|
-
|
|
809
|
-
|
|
810
|
+
getResolvedMarimoConfig as o,
|
|
811
|
+
store as p,
|
|
810
812
|
aiFeaturesEnabledAtom as r,
|
|
811
|
-
|
|
813
|
+
localeAtom as s,
|
|
812
814
|
resolvedThemeAtom as t,
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
815
|
+
userConfigAtom as u,
|
|
816
|
+
useAtom as v,
|
|
817
|
+
buildStore as w,
|
|
818
|
+
useStore as x,
|
|
819
|
+
useAtomValue as y
|
|
818
820
|
};
|
|
@@ -2,23 +2,23 @@ import { s as __toESM } from "./chunk-BNovOVIE.js";
|
|
|
2
2
|
import { _ as Logger, c as Objects, g as cn, h as Events } from "./button-BacYv-bE.js";
|
|
3
3
|
import { t as require_react } from "./react-DA-nE2FX.js";
|
|
4
4
|
import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
|
|
5
|
-
import { c as asRemoteURL, v as CircleQuestionMark } from "./toDate-
|
|
5
|
+
import { c as asRemoteURL, v as CircleQuestionMark } from "./toDate-D1Z7ZXWh.js";
|
|
6
6
|
import "./react-dom-BTJzcVJ9.js";
|
|
7
7
|
import { t as require_jsx_runtime } from "./jsx-runtime-DebpN0FN.js";
|
|
8
8
|
import "./zod-CijjQh4u.js";
|
|
9
9
|
import { n as ErrorBanner } from "./error-banner-DFPfz_Qf.js";
|
|
10
10
|
import { t as Tooltip } from "./tooltip-Czds6Qr8.js";
|
|
11
11
|
import { i as debounce_default } from "./constants-T20xxyNf.js";
|
|
12
|
-
import {
|
|
12
|
+
import { D as useEvent_default, n as useTheme } from "./useTheme-yGsGEk82.js";
|
|
13
13
|
import { s as uniq } from "./arrays-sEtDRoG4.js";
|
|
14
|
-
import { a as isValid, i as AlertTitle, n as Alert, t as arrow } from "./formats-
|
|
14
|
+
import { a as isValid, i as AlertTitle, n as Alert, t as arrow } from "./formats-WsOgyW_K.js";
|
|
15
15
|
import { n as formats } from "./vega-loader.browser-CZ-J8Py3.js";
|
|
16
16
|
import { a as getContainerWidth, n as vegaLoadData, s as tooltipHandler } from "./loader-Boph2xIS.js";
|
|
17
17
|
import { t as j } from "./react-vega-B0sAlDTL.js";
|
|
18
18
|
import "./defaultLocale-u-3osm0P.js";
|
|
19
19
|
import "./defaultLocale-BoHTsDG6.js";
|
|
20
|
-
import { t as useAsyncData } from "./useAsyncData-
|
|
21
|
-
import { t as useDeepCompareMemoize } from "./useDeepCompareMemoize-
|
|
20
|
+
import { t as useAsyncData } from "./useAsyncData-BMc8itk2.js";
|
|
21
|
+
import { t as useDeepCompareMemoize } from "./useDeepCompareMemoize-ZwmDBRDY.js";
|
|
22
22
|
import { t as Semaphore } from "./semaphore-CNDGTzkX.js";
|
|
23
23
|
var import_compiler_runtime = require_compiler_runtime(), import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
24
24
|
function fixRelativeUrl(e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marimo-team/islands",
|
|
3
|
-
"version": "0.23.14-
|
|
3
|
+
"version": "0.23.14-dev50",
|
|
4
4
|
"main": "dist/main.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"@dnd-kit/utilities": "^3.2.2",
|
|
46
46
|
"@emotion/cache": "^11.14.0",
|
|
47
47
|
"@emotion/react": "^11.14.0",
|
|
48
|
-
"@glideapps/glide-data-grid": "6.0.4-
|
|
48
|
+
"@glideapps/glide-data-grid": "6.0.4-alpha24",
|
|
49
49
|
"@hookform/resolvers": "^5.2.2",
|
|
50
50
|
"@img-comparison-slider/react": "^8.0.2",
|
|
51
51
|
"@internationalized/date": "^3.10.1",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@lezer/python": "^1.1.18",
|
|
57
57
|
"@marimo-team/codemirror-ai": "^0.3.7",
|
|
58
58
|
"@marimo-team/codemirror-languageserver": "^1.16.12",
|
|
59
|
-
"@marimo-team/codemirror-mcp": "^0.1.
|
|
59
|
+
"@marimo-team/codemirror-mcp": "^0.1.7",
|
|
60
60
|
"@marimo-team/codemirror-sql": "^0.2.8",
|
|
61
61
|
"@marimo-team/llm-info": "workspace:*",
|
|
62
62
|
"@marimo-team/marimo-api": "workspace:*",
|
|
@@ -45,6 +45,7 @@ export const MockRequestClient = {
|
|
|
45
45
|
openFile: vi.fn().mockResolvedValue({}),
|
|
46
46
|
getUsageStats: vi.fn().mockResolvedValue({}),
|
|
47
47
|
sendPdb: vi.fn().mockResolvedValue({}),
|
|
48
|
+
sendSetBreakpoints: vi.fn().mockResolvedValue({}),
|
|
48
49
|
sendListFiles: vi.fn().mockResolvedValue({ files: [] }),
|
|
49
50
|
sendSearchFiles: vi
|
|
50
51
|
.fn()
|
|
@@ -1288,6 +1288,32 @@ export const UserConfigForm: React.FC = () => {
|
|
|
1288
1288
|
</div>
|
|
1289
1289
|
)}
|
|
1290
1290
|
/>
|
|
1291
|
+
<OverriddenFormField
|
|
1292
|
+
control={form.control}
|
|
1293
|
+
name="experimental.debugger"
|
|
1294
|
+
render={({ field, override }) => (
|
|
1295
|
+
<div className="flex flex-col gap-y-1">
|
|
1296
|
+
<FormItem className={formItemClasses}>
|
|
1297
|
+
<FormLabel className="font-normal">Debugger</FormLabel>
|
|
1298
|
+
<FormControl>
|
|
1299
|
+
<Checkbox
|
|
1300
|
+
data-testid="debugger-checkbox"
|
|
1301
|
+
checked={override.value === true}
|
|
1302
|
+
disabled={override.isOverridden}
|
|
1303
|
+
onCheckedChange={field.onChange}
|
|
1304
|
+
/>
|
|
1305
|
+
</FormControl>
|
|
1306
|
+
</FormItem>
|
|
1307
|
+
<IsOverridden override={override} />
|
|
1308
|
+
<FormDescription>
|
|
1309
|
+
Enable the live debugger: a clickable breakpoint gutter,
|
|
1310
|
+
current-line highlighting while a cell runs, and dropping
|
|
1311
|
+
into <Kbd className="inline">pdb</Kbd> at breakpoints. This
|
|
1312
|
+
change requires a page refresh to take effect.
|
|
1313
|
+
</FormDescription>
|
|
1314
|
+
</div>
|
|
1315
|
+
)}
|
|
1316
|
+
/>
|
|
1291
1317
|
</SettingGroup>
|
|
1292
1318
|
);
|
|
1293
1319
|
}
|
|
@@ -49,6 +49,7 @@ import {
|
|
|
49
49
|
addContextCompletion,
|
|
50
50
|
CONTEXT_TRIGGER,
|
|
51
51
|
} from "@/components/editor/ai/completion-utils";
|
|
52
|
+
import { pendingAiPromptAtom } from "@/core/ai/state";
|
|
52
53
|
import {
|
|
53
54
|
Select,
|
|
54
55
|
SelectContent,
|
|
@@ -72,6 +73,7 @@ import {
|
|
|
72
73
|
SendButton,
|
|
73
74
|
} from "../chat-components";
|
|
74
75
|
import { useFileState } from "../chat-utils";
|
|
76
|
+
import { focusInputAndMoveToEnd } from "@/core/codemirror/utils";
|
|
75
77
|
import { ReadyToChatBlock } from "./blocks";
|
|
76
78
|
import {
|
|
77
79
|
convertFilesToResourceLinks,
|
|
@@ -305,6 +307,7 @@ interface PromptAreaProps {
|
|
|
305
307
|
onModeChange?: (mode: string) => void;
|
|
306
308
|
sessionModels?: SessionModelState | null;
|
|
307
309
|
onModelChange?: (modelId: string) => void;
|
|
310
|
+
inputRef: React.RefObject<ReactCodeMirrorRef | null>;
|
|
308
311
|
}
|
|
309
312
|
|
|
310
313
|
const PromptArea = memo<PromptAreaProps>(
|
|
@@ -322,8 +325,8 @@ const PromptArea = memo<PromptAreaProps>(
|
|
|
322
325
|
onModeChange,
|
|
323
326
|
sessionModels,
|
|
324
327
|
onModelChange,
|
|
328
|
+
inputRef,
|
|
325
329
|
}) => {
|
|
326
|
-
const inputRef = useRef<ReactCodeMirrorRef | null>(null);
|
|
327
330
|
const promptCompletions: AdditionalCompletions | undefined = useMemo(() => {
|
|
328
331
|
if (!commands) {
|
|
329
332
|
return undefined;
|
|
@@ -660,6 +663,8 @@ const AgentPanel: React.FC = () => {
|
|
|
660
663
|
const [isLoading, setIsLoading] = useState(false);
|
|
661
664
|
const [error, setError] = useState<Error | string | null>(null);
|
|
662
665
|
const [promptValue, setPromptValue] = useState("");
|
|
666
|
+
const promptInputRef = useRef<ReactCodeMirrorRef | null>(null);
|
|
667
|
+
const [pendingPrompt, setPendingPrompt] = useAtom(pendingAiPromptAtom);
|
|
663
668
|
const { files, addFiles, clearFiles, removeFile } = useFileState();
|
|
664
669
|
const [sessionModels, setSessionModels] = useState<SessionModelState | null>(
|
|
665
670
|
null,
|
|
@@ -973,6 +978,34 @@ const AgentPanel: React.FC = () => {
|
|
|
973
978
|
},
|
|
974
979
|
);
|
|
975
980
|
|
|
981
|
+
// Consume a prompt queued by another part of the app (e.g. error auto-fix).
|
|
982
|
+
useEffect(() => {
|
|
983
|
+
if (
|
|
984
|
+
!activeSessionId ||
|
|
985
|
+
!agent ||
|
|
986
|
+
isLoading ||
|
|
987
|
+
connectionState.status !== "connected" ||
|
|
988
|
+
!pendingPrompt
|
|
989
|
+
) {
|
|
990
|
+
return;
|
|
991
|
+
}
|
|
992
|
+
setPendingPrompt(null);
|
|
993
|
+
if (pendingPrompt.submit) {
|
|
994
|
+
void handlePromptSubmit(undefined, pendingPrompt.prompt);
|
|
995
|
+
} else {
|
|
996
|
+
setPromptValue(pendingPrompt.prompt);
|
|
997
|
+
focusInputAndMoveToEnd(promptInputRef);
|
|
998
|
+
}
|
|
999
|
+
}, [
|
|
1000
|
+
activeSessionId,
|
|
1001
|
+
agent,
|
|
1002
|
+
isLoading,
|
|
1003
|
+
connectionState.status,
|
|
1004
|
+
pendingPrompt,
|
|
1005
|
+
setPendingPrompt,
|
|
1006
|
+
handlePromptSubmit,
|
|
1007
|
+
]);
|
|
1008
|
+
|
|
976
1009
|
// Handler for stopping the current operation
|
|
977
1010
|
const handleStop = useEvent(async () => {
|
|
978
1011
|
if (!activeSessionId || !agent) {
|
|
@@ -1187,6 +1220,7 @@ const AgentPanel: React.FC = () => {
|
|
|
1187
1220
|
onModeChange={handleModeChange}
|
|
1188
1221
|
sessionModels={sessionModels}
|
|
1189
1222
|
onModelChange={handleModelChange}
|
|
1223
|
+
inputRef={promptInputRef}
|
|
1190
1224
|
/>
|
|
1191
1225
|
</>
|
|
1192
1226
|
);
|
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
type Chat,
|
|
46
46
|
type ChatId,
|
|
47
47
|
chatStateAtom,
|
|
48
|
+
pendingAiPromptAtom,
|
|
48
49
|
} from "@/core/ai/state";
|
|
49
50
|
import type { ToolNotebookContext } from "@/core/ai/tools/base";
|
|
50
51
|
import {
|
|
@@ -94,6 +95,7 @@ import {
|
|
|
94
95
|
useFileState,
|
|
95
96
|
} from "./chat-utils";
|
|
96
97
|
import { getCodes } from "@/core/codemirror/copilot/getCodes";
|
|
98
|
+
import { focusInputAndMoveToEnd } from "@/core/codemirror/utils";
|
|
97
99
|
|
|
98
100
|
// Default mode for the AI
|
|
99
101
|
const DEFAULT_MODE = "manual";
|
|
@@ -407,6 +409,7 @@ const ChatInput: React.FC<ChatInputProps> = memo(
|
|
|
407
409
|
<div className="relative shrink-0 min-h-[80px] flex flex-col border-t">
|
|
408
410
|
<div className={cn("px-2 py-3 flex-1", inputClassName)}>
|
|
409
411
|
<PromptInput
|
|
412
|
+
className="max-h-[400px]"
|
|
410
413
|
inputRef={inputRef}
|
|
411
414
|
value={input}
|
|
412
415
|
onChange={setInput}
|
|
@@ -481,6 +484,7 @@ const ChatPanel = () => {
|
|
|
481
484
|
const ChatPanelBody = () => {
|
|
482
485
|
const setChatState = useSetAtom(chatStateAtom);
|
|
483
486
|
const [activeChat, setActiveChat] = useAtom(activeChatAtom);
|
|
487
|
+
const [pendingPrompt, setPendingPrompt] = useAtom(pendingAiPromptAtom);
|
|
484
488
|
const [input, setInput] = useState("");
|
|
485
489
|
const [newThreadInput, setNewThreadInput] = useState("");
|
|
486
490
|
const { files, addFiles, clearFiles, removeFile } = useFileState();
|
|
@@ -600,10 +604,7 @@ const ChatPanelBody = () => {
|
|
|
600
604
|
requestAnimationFrame(scrollToBottom);
|
|
601
605
|
}, [activeChatId]);
|
|
602
606
|
|
|
603
|
-
const
|
|
604
|
-
initialMessage: string,
|
|
605
|
-
initialAttachments?: File[],
|
|
606
|
-
) => {
|
|
607
|
+
const startNewChatState = useEvent((initialMessage: string) => {
|
|
607
608
|
const now = Date.now();
|
|
608
609
|
const newChat: Chat = {
|
|
609
610
|
id: chatId as ChatId,
|
|
@@ -613,41 +614,41 @@ const ChatPanelBody = () => {
|
|
|
613
614
|
updatedAt: now,
|
|
614
615
|
};
|
|
615
616
|
|
|
616
|
-
// Create new chat and set as active
|
|
617
617
|
setChatState((prev) => {
|
|
618
618
|
const newChats = new Map(prev.chats);
|
|
619
619
|
newChats.set(newChat.id, newChat);
|
|
620
|
-
|
|
620
|
+
return {
|
|
621
621
|
...prev,
|
|
622
622
|
chats: newChats,
|
|
623
623
|
activeChatId: newChat.id,
|
|
624
624
|
};
|
|
625
|
-
return newState;
|
|
626
625
|
});
|
|
626
|
+
});
|
|
627
627
|
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
: undefined;
|
|
632
|
-
const { contextPart, attachments } =
|
|
633
|
-
await resolveChatContext(initialMessage);
|
|
628
|
+
const createNewThread = useEvent(
|
|
629
|
+
async (initialMessage: string, initialAttachments?: File[]) => {
|
|
630
|
+
startNewChatState(initialMessage);
|
|
634
631
|
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
632
|
+
const fileParts =
|
|
633
|
+
initialAttachments && initialAttachments.length > 0
|
|
634
|
+
? await convertToFileUIPart(initialAttachments)
|
|
635
|
+
: undefined;
|
|
636
|
+
const { contextPart, attachments } =
|
|
637
|
+
await resolveChatContext(initialMessage);
|
|
638
|
+
|
|
639
|
+
sendMessage({
|
|
640
|
+
role: "user",
|
|
641
|
+
parts: [
|
|
642
|
+
{ type: "text" as const, text: initialMessage },
|
|
643
|
+
...(contextPart ? [contextPart] : []),
|
|
644
|
+
...(fileParts ?? []),
|
|
645
|
+
...attachments,
|
|
646
|
+
],
|
|
647
|
+
});
|
|
648
|
+
clearFiles();
|
|
649
|
+
setInput("");
|
|
650
|
+
},
|
|
651
|
+
);
|
|
651
652
|
|
|
652
653
|
const handleNewChat = useEvent(() => {
|
|
653
654
|
setActiveChat(null);
|
|
@@ -728,7 +729,45 @@ const ChatPanelBody = () => {
|
|
|
728
729
|
|
|
729
730
|
const handleOnCloseThread = () => newThreadInputRef.current?.editor?.blur();
|
|
730
731
|
|
|
732
|
+
const submitPendingPrompt = useEvent(async (prompt: string) => {
|
|
733
|
+
if (activeChatId == null) {
|
|
734
|
+
startNewChatState(prompt);
|
|
735
|
+
// Starting a chat swaps the new-thread input for the regular input;
|
|
736
|
+
// carry over any draft the user had typed so it isn't lost.
|
|
737
|
+
setInput(newThreadInput);
|
|
738
|
+
}
|
|
739
|
+
const { contextPart, attachments } = await resolveChatContext(prompt);
|
|
740
|
+
sendMessage({
|
|
741
|
+
role: "user",
|
|
742
|
+
parts: [
|
|
743
|
+
{ type: "text", text: prompt },
|
|
744
|
+
...(contextPart ? [contextPart] : []),
|
|
745
|
+
...attachments,
|
|
746
|
+
],
|
|
747
|
+
});
|
|
748
|
+
});
|
|
749
|
+
|
|
731
750
|
const isNewThread = messages.length === 0;
|
|
751
|
+
|
|
752
|
+
// Deliver a prompt queued elsewhere (e.g. error auto-fix) to the chat,
|
|
753
|
+
// appending to the active thread or starting one if none exists.
|
|
754
|
+
useEffect(() => {
|
|
755
|
+
if (!pendingPrompt) {
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
setPendingPrompt(null);
|
|
759
|
+
const { prompt, submit } = pendingPrompt;
|
|
760
|
+
if (submit) {
|
|
761
|
+
void submitPendingPrompt(prompt);
|
|
762
|
+
} else if (isNewThread) {
|
|
763
|
+
setNewThreadInput(prompt);
|
|
764
|
+
focusInputAndMoveToEnd(newThreadInputRef);
|
|
765
|
+
} else {
|
|
766
|
+
setInput(prompt);
|
|
767
|
+
focusInputAndMoveToEnd(newMessageInputRef);
|
|
768
|
+
}
|
|
769
|
+
}, [pendingPrompt, setPendingPrompt, isNewThread, submitPendingPrompt]);
|
|
770
|
+
|
|
732
771
|
const chatInput = isNewThread ? (
|
|
733
772
|
<ChatInput
|
|
734
773
|
key="new-thread-input"
|
|
@@ -126,3 +126,28 @@ describe("ColumnExplorerPanel header counts", () => {
|
|
|
126
126
|
expect(screen.queryByText(/hidden/)).not.toBeInTheDocument();
|
|
127
127
|
});
|
|
128
128
|
});
|
|
129
|
+
|
|
130
|
+
describe("ColumnExplorerPanel visibility actions", () => {
|
|
131
|
+
const showAll = () => screen.getByRole("button", { name: /Show all/ });
|
|
132
|
+
const hideAll = () => screen.getByRole("button", { name: /Hide all/ });
|
|
133
|
+
|
|
134
|
+
it("disables 'Show all' when every column is visible", () => {
|
|
135
|
+
renderPanel();
|
|
136
|
+
expect(showAll()).toBeDisabled();
|
|
137
|
+
expect(hideAll()).toBeEnabled();
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it("disables 'Hide all' when every column is hidden", () => {
|
|
141
|
+
renderPanel({
|
|
142
|
+
initiallyHidden: ["customer_name", "cust_age", "order_total"],
|
|
143
|
+
});
|
|
144
|
+
expect(showAll()).toBeEnabled();
|
|
145
|
+
expect(hideAll()).toBeDisabled();
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it("enables both actions when some columns are hidden", () => {
|
|
149
|
+
renderPanel({ initiallyHidden: ["cust_age"] });
|
|
150
|
+
expect(showAll()).toBeEnabled();
|
|
151
|
+
expect(hideAll()).toBeEnabled();
|
|
152
|
+
});
|
|
153
|
+
});
|
|
@@ -21,10 +21,17 @@ beforeAll(() => {
|
|
|
21
21
|
|
|
22
22
|
type Row = Record<string, unknown>;
|
|
23
23
|
|
|
24
|
+
// Select, index, and nameless columns are non-hideable in production
|
|
25
|
+
// (see columns.tsx), so the harness mirrors that to keep visibility counts
|
|
26
|
+
// aligned with the real table.
|
|
24
27
|
const TEST_COLUMNS: ColumnDef<Row>[] = [
|
|
25
|
-
{ id: SELECT_COLUMN_ID, accessorKey: SELECT_COLUMN_ID },
|
|
26
|
-
{
|
|
27
|
-
|
|
28
|
+
{ id: SELECT_COLUMN_ID, accessorKey: SELECT_COLUMN_ID, enableHiding: false },
|
|
29
|
+
{
|
|
30
|
+
id: INDEX_COLUMN_NAME,
|
|
31
|
+
accessorKey: INDEX_COLUMN_NAME,
|
|
32
|
+
enableHiding: false,
|
|
33
|
+
},
|
|
34
|
+
{ id: "__m_column__0", accessorKey: "__m_column__0", enableHiding: false },
|
|
28
35
|
{
|
|
29
36
|
id: "customer_name",
|
|
30
37
|
accessorKey: "customer_name",
|
|
@@ -101,6 +108,7 @@ describe("ColumnVisibilityDropdown", () => {
|
|
|
101
108
|
renderAndOpen({ initiallyHidden: ["cust_age"] });
|
|
102
109
|
expect(getOptionTexts()).toEqual([
|
|
103
110
|
"Show all",
|
|
111
|
+
"Hide all",
|
|
104
112
|
"cust_age",
|
|
105
113
|
"customer_name",
|
|
106
114
|
"order_total",
|
|
@@ -117,6 +125,7 @@ describe("ColumnVisibilityDropdown", () => {
|
|
|
117
125
|
|
|
118
126
|
expect(getOptionTexts()).toEqual([
|
|
119
127
|
"Show all",
|
|
128
|
+
"Hide all",
|
|
120
129
|
"cust_age",
|
|
121
130
|
"customer_name",
|
|
122
131
|
"order_total",
|
|
@@ -132,6 +141,7 @@ describe("ColumnVisibilityDropdown", () => {
|
|
|
132
141
|
fireEvent.click(getColumnOption("customer_name"));
|
|
133
142
|
expect(getOptionTexts()).toEqual([
|
|
134
143
|
"Show all",
|
|
144
|
+
"Hide all",
|
|
135
145
|
"cust_age",
|
|
136
146
|
"customer_name",
|
|
137
147
|
"order_total",
|
|
@@ -144,6 +154,7 @@ describe("ColumnVisibilityDropdown", () => {
|
|
|
144
154
|
// Reopen sorts both hidden columns first, preserving table order.
|
|
145
155
|
expect(getOptionTexts()).toEqual([
|
|
146
156
|
"Show all",
|
|
157
|
+
"Hide all",
|
|
147
158
|
"customer_name",
|
|
148
159
|
"cust_age",
|
|
149
160
|
"order_total",
|
|
@@ -189,6 +200,52 @@ describe("ColumnVisibilityDropdown", () => {
|
|
|
189
200
|
);
|
|
190
201
|
});
|
|
191
202
|
|
|
203
|
+
it("'Hide all' hides every hideable column", () => {
|
|
204
|
+
renderAndOpen();
|
|
205
|
+
fireEvent.click(getColumnOption("Hide all"));
|
|
206
|
+
|
|
207
|
+
expect(
|
|
208
|
+
getColumnOption("customer_name").querySelector(".lucide-eye-off"),
|
|
209
|
+
).not.toBeNull();
|
|
210
|
+
expect(
|
|
211
|
+
getColumnOption("cust_age").querySelector(".lucide-eye-off"),
|
|
212
|
+
).not.toBeNull();
|
|
213
|
+
expect(
|
|
214
|
+
getColumnOption("order_total").querySelector(".lucide-eye-off"),
|
|
215
|
+
).not.toBeNull();
|
|
216
|
+
expect(getColumnOption("Hide all")).toHaveAttribute(
|
|
217
|
+
"aria-disabled",
|
|
218
|
+
"true",
|
|
219
|
+
);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
it("disables 'Hide all' when every column is already hidden", () => {
|
|
223
|
+
renderAndOpen({
|
|
224
|
+
initiallyHidden: ["customer_name", "cust_age", "order_total"],
|
|
225
|
+
});
|
|
226
|
+
expect(getColumnOption("Hide all")).toHaveAttribute(
|
|
227
|
+
"aria-disabled",
|
|
228
|
+
"true",
|
|
229
|
+
);
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
it("'Hide all' leaves non-hideable columns visible", () => {
|
|
233
|
+
renderAndOpen({ nonHideable: ["customer_name"] });
|
|
234
|
+
fireEvent.click(getColumnOption("Hide all"));
|
|
235
|
+
|
|
236
|
+
expect(
|
|
237
|
+
getColumnOption("cust_age").querySelector(".lucide-eye-off"),
|
|
238
|
+
).not.toBeNull();
|
|
239
|
+
const nonHideable = getColumnOption("customer_name");
|
|
240
|
+
expect(nonHideable).toHaveAttribute("aria-disabled", "true");
|
|
241
|
+
expect(nonHideable.querySelector(".lucide-eye-off")).toBeNull();
|
|
242
|
+
// Every hideable column is now hidden, so the action gates off.
|
|
243
|
+
expect(getColumnOption("Hide all")).toHaveAttribute(
|
|
244
|
+
"aria-disabled",
|
|
245
|
+
"true",
|
|
246
|
+
);
|
|
247
|
+
});
|
|
248
|
+
|
|
192
249
|
it("hides and shows matching columns via bulk actions while searching", () => {
|
|
193
250
|
renderAndOpen();
|
|
194
251
|
fireEvent.change(getSearchInput(), { target: { value: "cust" } });
|
|
@@ -85,6 +85,10 @@ const Mocks = {
|
|
|
85
85
|
type: "arc",
|
|
86
86
|
innerRadius: 100,
|
|
87
87
|
},
|
|
88
|
+
arcDefault: {
|
|
89
|
+
type: "arc",
|
|
90
|
+
innerRadius: undefined,
|
|
91
|
+
},
|
|
88
92
|
},
|
|
89
93
|
};
|
|
90
94
|
|
|
@@ -128,6 +132,26 @@ describe("generateAltairChart", () => {
|
|
|
128
132
|
`);
|
|
129
133
|
});
|
|
130
134
|
|
|
135
|
+
it("should generate a pie chart when arc has undefined innerRadius", () => {
|
|
136
|
+
const spec = createSpec({
|
|
137
|
+
mark: Mocks.marks.arcDefault,
|
|
138
|
+
encoding: {
|
|
139
|
+
theta: Mocks.thetaAxis,
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
const datasource = "df";
|
|
143
|
+
|
|
144
|
+
const result = generateAltairChart(spec, datasource).toCode();
|
|
145
|
+
|
|
146
|
+
expect(result).toMatchInlineSnapshot(`
|
|
147
|
+
"alt.Chart(df)
|
|
148
|
+
.mark_arc()
|
|
149
|
+
.encode(theta=alt.Theta(field='theta', axis={
|
|
150
|
+
'title': 'Theta Axis'
|
|
151
|
+
}))"
|
|
152
|
+
`);
|
|
153
|
+
});
|
|
154
|
+
|
|
131
155
|
it("should generate a donut chart", () => {
|
|
132
156
|
const spec = createSpec({
|
|
133
157
|
mark: Mocks.marks.arc,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it } from "vitest";
|
|
4
|
+
import type { FieldTypesWithExternalType } from "@/components/data-table/types";
|
|
5
|
+
import { mergeIndexFields } from "../charts";
|
|
6
|
+
|
|
7
|
+
describe("mergeIndexFields", () => {
|
|
8
|
+
it("appends row-header (index) fields to field types", () => {
|
|
9
|
+
const fieldTypes: FieldTypesWithExternalType = [["v", ["number", "int64"]]];
|
|
10
|
+
const rowHeaders: FieldTypesWithExternalType = [
|
|
11
|
+
["k", ["string", "object"]],
|
|
12
|
+
];
|
|
13
|
+
expect(mergeIndexFields(fieldTypes, rowHeaders)).toEqual([
|
|
14
|
+
["v", ["number", "int64"]],
|
|
15
|
+
["k", ["string", "object"]],
|
|
16
|
+
]);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("de-dupes when an index name matches a column name", () => {
|
|
20
|
+
const fieldTypes: FieldTypesWithExternalType = [["k", ["number", "int64"]]];
|
|
21
|
+
const rowHeaders: FieldTypesWithExternalType = [
|
|
22
|
+
["k", ["string", "object"]],
|
|
23
|
+
];
|
|
24
|
+
expect(mergeIndexFields(fieldTypes, rowHeaders)).toEqual([
|
|
25
|
+
["k", ["number", "int64"]],
|
|
26
|
+
]);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("returns field types unchanged when there are no row headers", () => {
|
|
30
|
+
const fieldTypes: FieldTypesWithExternalType = [["v", ["number", "int64"]]];
|
|
31
|
+
expect(mergeIndexFields(fieldTypes, [])).toEqual(fieldTypes);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -30,7 +30,10 @@ export function generateAltairChart(
|
|
|
30
30
|
if (typeof spec.mark === "object" && "type" in spec.mark) {
|
|
31
31
|
markProps = Object.fromEntries(
|
|
32
32
|
Object.entries(spec.mark)
|
|
33
|
-
.filter(
|
|
33
|
+
.filter(
|
|
34
|
+
([key, value]) =>
|
|
35
|
+
key !== "type" && value !== undefined && value !== null,
|
|
36
|
+
)
|
|
34
37
|
.map(([key, value]) => [key, new Literal(value)]),
|
|
35
38
|
);
|
|
36
39
|
}
|