@marimo-team/islands 0.23.15-dev32 → 0.23.15-dev4
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-7p7rt9iw.js → ConnectedDataExplorerComponent-CU4fZJzG.js} +4 -4
- package/dist/{ErrorBoundary-B_CAG7_e.js → ErrorBoundary-DE6tzZf-.js} +1 -1
- package/dist/{ImageComparisonComponent-1i5IBhon.js → ImageComparisonComponent-CHrI72em.js} +129 -173
- package/dist/assets/__vite-browser-external-BQCLNwri.js +1 -0
- package/dist/assets/worker-DAWRHcPq.js +73 -0
- package/dist/{chat-ui-C0wkSwxB.js → chat-ui-DinOvbWu.js} +3111 -3111
- package/dist/{code-visibility-CEHWVGz1.js → code-visibility-Dk8cVOny.js} +864 -946
- package/dist/{debounce-BOD3DbfP.js → constants-T20xxyNf.js} +24 -1
- package/dist/{formats-BX3uDQbB.js → formats-Dzx4J_z1.js} +1 -1
- package/dist/{glide-data-editor-CwZz71BD.js → glide-data-editor-CjTu7ukN.js} +3 -3
- package/dist/{html-to-image-D8Q5SLSJ.js → html-to-image-_wGfk8V-.js} +2241 -2277
- package/dist/{input-BGPrFH3g.js → input-DtsN7xm-.js} +2 -2
- package/dist/main.js +1201 -1297
- package/dist/{mermaid-UdmxG2PZ.js → mermaid-BYqXy_NE.js} +2 -2
- package/dist/{process-output-C_A12w9J.js → process-output-Mh4UrjwM.js} +1 -1
- package/dist/{reveal-component-kLDhMoa2.js → reveal-component-B5DXLyO7.js} +605 -618
- package/dist/{spec-DSs9v0xx.js → spec-Cz-Bj1JI.js} +1 -1
- package/dist/style.css +1 -1
- package/dist/{toDate-CKpRx4TS.js → toDate-CWNNlFEX.js} +4 -3
- package/dist/{useAsyncData-BSOyAbac.js → useAsyncData-KfHB8wQR.js} +1 -1
- package/dist/{useDeepCompareMemoize-BTLeWzuR.js → useDeepCompareMemoize-nJMtxhm4.js} +1 -1
- package/dist/{useLifecycle-C6wHjkhW.js → useLifecycle-DegSo0lV.js} +1 -1
- package/dist/{useTheme-Df_vGflw.js → useTheme-6eZ3GOTS.js} +27 -62
- package/dist/{vega-component-DNHEV0u0.js → vega-component-DzyyM9fc.js} +6 -6
- package/package.json +1 -1
- package/src/components/chat/__tests__/chat-utils.test.ts +1 -244
- package/src/components/chat/chat-panel.tsx +67 -196
- package/src/components/chat/chat-utils.ts +2 -111
- package/src/components/editor/SortableCell.tsx +2 -6
- package/src/components/editor/actions/pair-with-agent-modal.tsx +64 -20
- package/src/components/editor/ai/add-cell-with-ai.tsx +5 -14
- package/src/components/editor/ai/ai-completion-editor.tsx +1 -4
- package/src/components/editor/cell/cell-context-menu.tsx +0 -7
- package/src/components/editor/chrome/panels/packages-panel.tsx +1 -11
- package/src/components/editor/columns/cell-column.tsx +4 -34
- package/src/components/editor/columns/sortable-column.tsx +4 -24
- package/src/components/editor/navigation/__tests__/navigation.test.ts +0 -33
- package/src/components/editor/navigation/navigation.ts +1 -8
- package/src/components/editor/notebook-cell.tsx +106 -203
- package/src/components/editor/renderers/cell-array.tsx +13 -26
- package/src/components/editor/renderers/cells-renderer.tsx +2 -8
- package/src/components/editor/renderers/slides-layout/__tests__/plugin.test.ts +0 -29
- package/src/components/editor/renderers/slides-layout/types.ts +0 -4
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +19 -19
- package/src/components/slides/reveal-component.tsx +4 -37
- package/src/components/slides/slide-form.tsx +0 -72
- package/src/core/cells/__tests__/utils.test.ts +0 -59
- package/src/core/cells/utils.ts +0 -51
- package/src/core/codemirror/completion/__tests__/signature-hint.test.ts +3 -97
- package/src/core/codemirror/completion/signature-hint.ts +11 -78
- package/src/core/constants.ts +0 -6
- package/src/core/islands/__tests__/bridge.test.ts +46 -341
- package/src/core/islands/__tests__/parse.test.ts +0 -105
- package/src/core/islands/bootstrap.ts +3 -8
- package/src/core/islands/bridge.ts +23 -116
- package/src/core/islands/components/web-components.tsx +15 -76
- package/src/core/islands/constants.ts +0 -1
- package/src/core/islands/main.ts +3 -35
- package/src/core/islands/parse.ts +23 -70
- package/src/core/islands/worker/worker.tsx +57 -145
- package/src/core/wasm/worker/bootstrap.ts +20 -113
- package/src/css/app/Cell.css +0 -10
- package/src/hooks/useHotkey.ts +4 -29
- package/src/plugins/impl/anywidget/__tests__/host.test.ts +9 -6
- package/src/plugins/impl/anywidget/__tests__/widget-binding.test.ts +61 -22
- package/src/plugins/impl/anywidget/model-proxy.ts +13 -0
- package/src/plugins/impl/anywidget/widget-binding.ts +34 -4
- package/src/plugins/impl/image-comparison/ImageComparisonComponent.tsx +2 -53
- package/src/plugins/impl/matplotlib/__tests__/matplotlib-renderer.test.ts +3 -71
- package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +0 -1
- package/src/theme/useTheme.ts +1 -16
- package/dist/assets/__vite-browser-external-CjNAy01L.js +0 -1
- package/dist/assets/worker-B3XPCb6y.js +0 -98
- package/src/components/chat/__tests__/message-queue.test.tsx +0 -121
- package/src/components/editor/__tests__/output-persistence.test.tsx +0 -241
- package/src/components/editor/actions/__tests__/pair-with-agent-commands.test.ts +0 -153
- package/src/components/editor/actions/pair-with-agent-commands.ts +0 -109
- package/src/components/editor/columns/__tests__/cell-column.test.tsx +0 -105
- package/src/components/editor/renderers/__tests__/cells-renderer.test.tsx +0 -66
- package/src/core/islands/components/__tests__/web-components.test.tsx +0 -214
- package/src/core/islands/worker/__tests__/controller.test.ts +0 -173
- package/src/hooks/__tests__/useHotkey.test.tsx +0 -88
- package/src/plugins/impl/image-comparison/__tests__/ImageComparisonComponent.test.tsx +0 -71
- package/src/theme/__tests__/useTheme.test.ts +0 -68
|
@@ -194,12 +194,9 @@ export const AiCompletionEditor: React.FC<Props> = ({
|
|
|
194
194
|
setCompletion("");
|
|
195
195
|
};
|
|
196
196
|
|
|
197
|
-
// Reject discards the suggestion but keeps the prompt open for refinement.
|
|
198
197
|
const handleDeclineCompletion = () => {
|
|
199
|
-
|
|
198
|
+
declineChange();
|
|
200
199
|
setCompletion("");
|
|
201
|
-
setShowInputPrompt(true);
|
|
202
|
-
inputRef.current?.view?.focus();
|
|
203
200
|
};
|
|
204
201
|
|
|
205
202
|
const showCompletionBanner =
|
|
@@ -39,18 +39,12 @@ interface Props extends Pick<
|
|
|
39
39
|
"cellId" | "getEditorView"
|
|
40
40
|
> {
|
|
41
41
|
children: React.ReactNode;
|
|
42
|
-
/**
|
|
43
|
-
* If true, the custom context menu is disabled and the native one is used
|
|
44
|
-
* (e.g. while presenting).
|
|
45
|
-
*/
|
|
46
|
-
disabled?: boolean;
|
|
47
42
|
}
|
|
48
43
|
|
|
49
44
|
export const CellActionsContextMenu = ({
|
|
50
45
|
children,
|
|
51
46
|
cellId,
|
|
52
47
|
getEditorView,
|
|
53
|
-
disabled,
|
|
54
48
|
}: Props) => {
|
|
55
49
|
const cellData = useCellData(cellId);
|
|
56
50
|
const cellRuntime = useCellRuntime(cellId);
|
|
@@ -193,7 +187,6 @@ export const CellActionsContextMenu = ({
|
|
|
193
187
|
return (
|
|
194
188
|
<ContextMenu>
|
|
195
189
|
<ContextMenuTrigger
|
|
196
|
-
disabled={disabled}
|
|
197
190
|
onContextMenu={(evt) => {
|
|
198
191
|
if (evt.target instanceof HTMLImageElement) {
|
|
199
192
|
setImageRightClicked(evt.target);
|
|
@@ -303,16 +303,6 @@ const PackagesList: React.FC<{
|
|
|
303
303
|
onSuccess: () => void;
|
|
304
304
|
packages: { name: string; version: string }[];
|
|
305
305
|
}> = ({ onSuccess, packages }) => {
|
|
306
|
-
// Sort case-insensitively so packages are strictly alphabetical
|
|
307
|
-
// regardless of capitalization (package managers sort inconsistently).
|
|
308
|
-
const sortedPackages = React.useMemo(
|
|
309
|
-
() =>
|
|
310
|
-
packages.toSorted((a, b) =>
|
|
311
|
-
a.name.localeCompare(b.name, undefined, { sensitivity: "base" }),
|
|
312
|
-
),
|
|
313
|
-
[packages],
|
|
314
|
-
);
|
|
315
|
-
|
|
316
306
|
if (packages.length === 0) {
|
|
317
307
|
return (
|
|
318
308
|
<PanelEmptyState
|
|
@@ -333,7 +323,7 @@ const PackagesList: React.FC<{
|
|
|
333
323
|
</TableRow>
|
|
334
324
|
</TableHeader>
|
|
335
325
|
<TableBody>
|
|
336
|
-
{
|
|
326
|
+
{packages.map((item) => (
|
|
337
327
|
<TableRow
|
|
338
328
|
key={item.name}
|
|
339
329
|
className="group"
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import React, { memo, useRef } from "react";
|
|
4
4
|
import type { AppConfig } from "@/core/config/config-schema";
|
|
5
5
|
import { useResizeHandle } from "@/hooks/useResizeHandle";
|
|
6
|
-
import { cn } from "@/utils/cn";
|
|
7
6
|
import type { CellColumnId } from "@/utils/id-tree";
|
|
8
7
|
import { SortableColumn } from "./sortable-column";
|
|
9
8
|
import { storageFn } from "./storage";
|
|
@@ -18,11 +17,6 @@ interface Props {
|
|
|
18
17
|
canDelete: boolean;
|
|
19
18
|
canMoveLeft: boolean;
|
|
20
19
|
canMoveRight: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* If true, column chrome (drag handles, resize handles, borders) is hidden
|
|
23
|
-
* while keeping the same component tree mounted.
|
|
24
|
-
*/
|
|
25
|
-
presenting?: boolean;
|
|
26
20
|
}
|
|
27
21
|
|
|
28
22
|
const { getColumnWidth, saveColumnWidth } = storageFn;
|
|
@@ -30,10 +24,6 @@ const { getColumnWidth, saveColumnWidth } = storageFn;
|
|
|
30
24
|
export const Column = memo((props: Props) => {
|
|
31
25
|
const columnRef = useRef<HTMLDivElement>(null);
|
|
32
26
|
|
|
33
|
-
// Published cells are not spaced apart. Set once on the column root; the
|
|
34
|
-
// CSS variable cascades to the gap-using descendants.
|
|
35
|
-
const zeroGapWhenPresenting = props.presenting && "[--notebook-cell-gap:0px]";
|
|
36
|
-
|
|
37
27
|
if (props.width === "columns") {
|
|
38
28
|
return (
|
|
39
29
|
<SortableColumn
|
|
@@ -43,16 +33,14 @@ export const Column = memo((props: Props) => {
|
|
|
43
33
|
columnId={props.columnId}
|
|
44
34
|
canMoveLeft={props.canMoveLeft}
|
|
45
35
|
canMoveRight={props.canMoveRight}
|
|
46
|
-
className=
|
|
36
|
+
className="group/column"
|
|
47
37
|
footer={props.footer}
|
|
48
|
-
presenting={props.presenting}
|
|
49
38
|
>
|
|
50
39
|
<ResizableComponent
|
|
51
40
|
startingWidth={getColumnWidth(props.index)}
|
|
52
41
|
onResize={(width: number) => {
|
|
53
42
|
saveColumnWidth(props.index, width);
|
|
54
43
|
}}
|
|
55
|
-
presenting={props.presenting}
|
|
56
44
|
>
|
|
57
45
|
{props.children}
|
|
58
46
|
</ResizableComponent>
|
|
@@ -62,13 +50,7 @@ export const Column = memo((props: Props) => {
|
|
|
62
50
|
|
|
63
51
|
return (
|
|
64
52
|
<>
|
|
65
|
-
<div
|
|
66
|
-
data-testid="cell-column"
|
|
67
|
-
className={cn(
|
|
68
|
-
"flex flex-col gap-(--notebook-cell-gap)",
|
|
69
|
-
zeroGapWhenPresenting,
|
|
70
|
-
)}
|
|
71
|
-
>
|
|
53
|
+
<div data-testid="cell-column" className="flex flex-col gap-5">
|
|
72
54
|
{props.children}
|
|
73
55
|
</div>
|
|
74
56
|
{props.footer}
|
|
@@ -82,14 +64,12 @@ interface ResizableComponentProps {
|
|
|
82
64
|
startingWidth: number | "contentWidth";
|
|
83
65
|
onResize?: (width: number) => void;
|
|
84
66
|
children: React.ReactNode;
|
|
85
|
-
presenting?: boolean;
|
|
86
67
|
}
|
|
87
68
|
|
|
88
69
|
const ResizableComponent = ({
|
|
89
70
|
startingWidth,
|
|
90
71
|
onResize,
|
|
91
72
|
children,
|
|
92
|
-
presenting,
|
|
93
73
|
}: ResizableComponentProps) => {
|
|
94
74
|
const { resizableDivRef, handleRefs, style } = useResizeHandle({
|
|
95
75
|
startingWidth,
|
|
@@ -100,13 +80,11 @@ const ResizableComponent = ({
|
|
|
100
80
|
return (
|
|
101
81
|
<div
|
|
102
82
|
ref={ref}
|
|
103
|
-
data-testid="column-resize-handle"
|
|
104
83
|
className={`w-[3px] cursor-col-resize transition-colors duration-200 z-100
|
|
105
84
|
relative before:content-[''] before:absolute before:inset-y-0 before:left-[-3px]
|
|
106
85
|
before:right-[-3px] before:w-[9px] before:z-[-1]
|
|
107
86
|
hover/column:bg-[var(--slate-3)] dark:hover/column:bg-[var(--slate-5)]
|
|
108
87
|
hover/column:hover:bg-primary/60 dark:hover/column:hover:bg-primary/60`}
|
|
109
|
-
hidden={presenting}
|
|
110
88
|
/>
|
|
111
89
|
);
|
|
112
90
|
};
|
|
@@ -116,16 +94,8 @@ const ResizableComponent = ({
|
|
|
116
94
|
{renderResizeHandler(handleRefs.left)}
|
|
117
95
|
<div
|
|
118
96
|
ref={resizableDivRef}
|
|
119
|
-
className=
|
|
120
|
-
|
|
121
|
-
// While presenting, use the published content width instead of the
|
|
122
|
-
// editor geometry (saved pixel width, 500px minimum, gutters),
|
|
123
|
-
// which overflows narrow screens.
|
|
124
|
-
presenting
|
|
125
|
-
? "w-(--content-width)"
|
|
126
|
-
: "min-h-[100px] px-11 pt-3 pb-6 min-w-[500px]",
|
|
127
|
-
)}
|
|
128
|
-
style={presenting ? undefined : style}
|
|
97
|
+
className="flex flex-col gap-5 box-content min-h-[100px] px-11 pt-3 pb-6 min-w-[500px] z-1"
|
|
98
|
+
style={style}
|
|
129
99
|
>
|
|
130
100
|
{children}
|
|
131
101
|
</div>
|
|
@@ -30,24 +30,11 @@ interface Props extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
30
30
|
canMoveLeft: boolean;
|
|
31
31
|
canMoveRight: boolean;
|
|
32
32
|
footer?: React.ReactNode;
|
|
33
|
-
/**
|
|
34
|
-
* If true, dragging is disabled and the column chrome is hidden
|
|
35
|
-
* (e.g. while presenting).
|
|
36
|
-
*/
|
|
37
|
-
presenting?: boolean;
|
|
38
33
|
}
|
|
39
34
|
|
|
40
35
|
const SortableColumnInternal = React.forwardRef(
|
|
41
36
|
(
|
|
42
|
-
{
|
|
43
|
-
columnId,
|
|
44
|
-
canDelete,
|
|
45
|
-
canMoveLeft,
|
|
46
|
-
canMoveRight,
|
|
47
|
-
footer,
|
|
48
|
-
presenting,
|
|
49
|
-
...props
|
|
50
|
-
}: Props,
|
|
37
|
+
{ columnId, canDelete, canMoveLeft, canMoveRight, footer, ...props }: Props,
|
|
51
38
|
ref: React.Ref<HTMLDivElement>,
|
|
52
39
|
) => {
|
|
53
40
|
const {
|
|
@@ -58,7 +45,7 @@ const SortableColumnInternal = React.forwardRef(
|
|
|
58
45
|
transition,
|
|
59
46
|
isDragging,
|
|
60
47
|
isOver,
|
|
61
|
-
} = useSortable({ id: columnId
|
|
48
|
+
} = useSortable({ id: columnId });
|
|
62
49
|
|
|
63
50
|
const style: React.CSSProperties = {
|
|
64
51
|
transform: transform
|
|
@@ -91,11 +78,7 @@ const SortableColumnInternal = React.forwardRef(
|
|
|
91
78
|
};
|
|
92
79
|
|
|
93
80
|
const dragHandle = (
|
|
94
|
-
<div
|
|
95
|
-
data-testid="column-header"
|
|
96
|
-
className="px-2 pb-0 group flex items-center overflow-hidden border-b border-(--slate-7)"
|
|
97
|
-
hidden={presenting}
|
|
98
|
-
>
|
|
81
|
+
<div className="px-2 pb-0 group flex items-center overflow-hidden border-b border-(--slate-7)">
|
|
99
82
|
<Tooltip content="Move column left" side="top" delayDuration={300}>
|
|
100
83
|
<Button
|
|
101
84
|
variant="text"
|
|
@@ -178,10 +161,7 @@ const SortableColumnInternal = React.forwardRef(
|
|
|
178
161
|
isOver && "bg-accent/20", // Add a background color when dragging over
|
|
179
162
|
)}
|
|
180
163
|
>
|
|
181
|
-
<div
|
|
182
|
-
data-testid="column-frame"
|
|
183
|
-
className={cn(!presenting && "border border-(--slate-7)")}
|
|
184
|
-
>
|
|
164
|
+
<div className="border border-(--slate-7)">
|
|
185
165
|
{dragHandle}
|
|
186
166
|
{props.children}
|
|
187
167
|
</div>
|
|
@@ -12,7 +12,6 @@ import { MockRequestClient } from "@/__mocks__/requests";
|
|
|
12
12
|
import { aiCompletionCellAtom } from "@/core/ai/state";
|
|
13
13
|
import type { CellActions } from "@/core/cells/cells";
|
|
14
14
|
import { notebookAtom } from "@/core/cells/cells";
|
|
15
|
-
import { signatureHintField } from "@/core/codemirror/completion/signature-hint";
|
|
16
15
|
import {
|
|
17
16
|
configOverridesAtom,
|
|
18
17
|
platformAtom,
|
|
@@ -1826,38 +1825,6 @@ describe("useCellEditorNavigationProps", () => {
|
|
|
1826
1825
|
expect(focusCell).not.toHaveBeenCalled();
|
|
1827
1826
|
});
|
|
1828
1827
|
|
|
1829
|
-
it("should dismiss the signature hint when Escape is pressed without exiting to command mode", () => {
|
|
1830
|
-
mockSimplifySelection.mockReturnValue(false);
|
|
1831
|
-
mockCompletionStatus.mockReturnValue(null);
|
|
1832
|
-
|
|
1833
|
-
const dispatch = vi.fn();
|
|
1834
|
-
const mockEditorView = {
|
|
1835
|
-
current: {
|
|
1836
|
-
state: {
|
|
1837
|
-
selection: { main: { from: 9, to: 9, empty: true } },
|
|
1838
|
-
field: vi.fn((field: unknown) =>
|
|
1839
|
-
field === signatureHintField ? { pos: 9 } : false,
|
|
1840
|
-
),
|
|
1841
|
-
},
|
|
1842
|
-
dispatch,
|
|
1843
|
-
} as unknown as EditorView,
|
|
1844
|
-
};
|
|
1845
|
-
|
|
1846
|
-
const { result } = renderWithProvider(() =>
|
|
1847
|
-
useCellEditorNavigationProps(mockCellId, mockEditorView),
|
|
1848
|
-
);
|
|
1849
|
-
|
|
1850
|
-
const mockEvent = Mocks.keyboardEvent({ key: "Escape" });
|
|
1851
|
-
|
|
1852
|
-
act(() => {
|
|
1853
|
-
result.current.onKeyDown?.(mockEvent);
|
|
1854
|
-
});
|
|
1855
|
-
|
|
1856
|
-
// The hint is dismissed (dispatch called) but we stay in edit mode.
|
|
1857
|
-
expect(dispatch).toHaveBeenCalled();
|
|
1858
|
-
expect(focusCell).not.toHaveBeenCalled();
|
|
1859
|
-
});
|
|
1860
|
-
|
|
1861
1828
|
it("should continue propagation for other keys", () => {
|
|
1862
1829
|
const mockEditorView = { current: null };
|
|
1863
1830
|
const { result } = renderWithProvider(() =>
|
|
@@ -22,10 +22,6 @@ import {
|
|
|
22
22
|
} from "@/core/cells/pending-cut-service";
|
|
23
23
|
import { usePendingDeleteService } from "@/core/cells/pending-delete-service";
|
|
24
24
|
import { scrollCellIntoView } from "@/core/cells/scrollCellIntoView";
|
|
25
|
-
import {
|
|
26
|
-
closeSignatureHint,
|
|
27
|
-
signatureHintField,
|
|
28
|
-
} from "@/core/codemirror/completion/signature-hint";
|
|
29
25
|
import {
|
|
30
26
|
hotkeysAtom,
|
|
31
27
|
isAiFeatureEnabled,
|
|
@@ -717,9 +713,7 @@ export function useCellEditorNavigationProps(
|
|
|
717
713
|
return;
|
|
718
714
|
}
|
|
719
715
|
|
|
720
|
-
const hasSignatureHelp =
|
|
721
|
-
Boolean(state.field(signatureHelpTooltipField, false)) ||
|
|
722
|
-
Boolean(state.field(signatureHintField, false));
|
|
716
|
+
const hasSignatureHelp = state.field(signatureHelpTooltipField, false);
|
|
723
717
|
const hasAutocompletePopup = completionStatus(state) !== null;
|
|
724
718
|
if (hasSignatureHelp) {
|
|
725
719
|
closeSignatureHelp(view);
|
|
@@ -790,5 +784,4 @@ export function closeSignatureHelp(view: EditorView) {
|
|
|
790
784
|
if (view.state.field(signatureHelpTooltipField, false)) {
|
|
791
785
|
view.dispatch({ effects: setSignatureHelpTooltip.of(null) });
|
|
792
786
|
}
|
|
793
|
-
closeSignatureHint(view);
|
|
794
787
|
}
|