@marimo-team/islands 0.22.1-dev23 → 0.22.1-dev27
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/main.js +3 -3
- package/package.json +6 -17
- package/src/__tests__/main.test.tsx +12 -14
- package/src/components/ai/ai-provider-icon.tsx +1 -2
- package/src/components/data-table/cell-selection/types.ts +3 -2
- package/src/components/data-table/charts/charts.tsx +2 -2
- package/src/components/data-table/column-formatting/types.ts +3 -2
- package/src/components/data-table/column-header.tsx +4 -2
- package/src/components/data-table/column-wrapping/types.ts +3 -2
- package/src/components/data-table/copy-column/types.ts +3 -2
- package/src/components/data-table/focus-row/types.ts +3 -2
- package/src/components/data-table/range-focus/__tests__/atoms.test.ts +11 -11
- package/src/components/data-table/range-focus/__tests__/use-cell-range-selection.test.ts +9 -11
- package/src/components/editor/__tests__/data-attributes.test.tsx +93 -94
- package/src/components/editor/actions/name-cell-input.tsx +4 -2
- package/src/components/editor/actions/useCellActionButton.tsx +4 -2
- package/src/components/editor/cell/CellStatus.tsx +4 -5
- package/src/components/editor/cell/cell-context-menu.tsx +4 -2
- package/src/components/editor/cell/code/cell-editor.tsx +2 -1
- package/src/components/editor/cell/toolbar.tsx +2 -1
- package/src/components/editor/renderers/vertical-layout/vertical-layout.tsx +11 -12
- package/src/components/storage/__tests__/storage-snippets.test.ts +4 -6
- package/src/components/tracing/tracing.test.tsx +30 -30
- package/src/components/ui/badge.tsx +2 -1
- package/src/components/ui/button.tsx +2 -1
- package/src/components/ui/calendar.tsx +3 -2
- package/src/components/ui/combobox.tsx +2 -1
- package/src/components/ui/date-input.tsx +7 -6
- package/src/components/ui/date-picker.tsx +6 -4
- package/src/components/ui/field.tsx +1 -2
- package/src/components/ui/progress.tsx +3 -2
- package/src/components/ui/query-param-preserving-link.tsx +4 -2
- package/src/components/ui/sheet.tsx +2 -1
- package/src/components/ui/textarea.tsx +1 -2
- package/src/core/ai/context/providers/cell-output.ts +1 -2
- package/src/core/ai/tools/edit-notebook-tool.ts +4 -3
- package/src/core/ai/tools/run-cells-tool.ts +4 -3
- package/src/core/cells/__tests__/add-missing-import.test.ts +23 -22
- package/src/core/cells/__tests__/cell.test.ts +14 -13
- package/src/core/cells/logs.ts +1 -1
- package/src/core/codemirror/cells/__tests__/extensions.test.ts +15 -17
- package/src/core/codemirror/copilot/transport.ts +1 -2
- package/src/core/codemirror/language/languages/markdown.ts +1 -3
- package/src/core/codemirror/language/languages/python.ts +4 -0
- package/src/core/codemirror/language/languages/sql/completion-sources.tsx +4 -6
- package/src/core/codemirror/language/languages/sql/sql.ts +1 -3
- package/src/core/codemirror/reactive-references/__tests__/analyzer.test.ts +28 -42
- package/src/core/datasets/data-source-connections.ts +4 -2
- package/src/core/dom/__tests__/htmlUtils.test.ts +8 -14
- package/src/core/dom/__tests__/outline.test.ts +2 -3
- package/src/core/islands/__tests__/parse.test.ts +8 -7
- package/src/core/saving/__tests__/filename.test.ts +7 -6
- package/src/core/static/__tests__/download-html.test.ts +16 -15
- package/src/core/static/__tests__/files.test.ts +30 -28
- package/src/css/app/Cell.css +5 -2
- package/src/css/globals.css +40 -14
- package/src/plugins/impl/DataEditorPlugin.tsx +4 -2
- package/src/plugins/impl/FormPlugin.tsx +1 -2
- package/src/plugins/impl/data-frames/forms/__tests__/form.test.tsx +7 -9
- package/src/plugins/impl/vega/__tests__/make-selectable.test.ts +13 -14
- package/src/plugins/layout/ImageComparisonPlugin.tsx +1 -3
- package/src/plugins/stateless-plugin.ts +4 -2
- package/src/utils/__tests__/cell-urls.test.ts +24 -21
- package/src/utils/__tests__/filenames.test.ts +15 -14
- package/src/utils/__tests__/json-parser.test.ts +14 -21
- package/src/utils/__tests__/path.test.ts +34 -31
- package/src/utils/__tests__/urls.test.ts +19 -18
- package/src/utils/tracer.ts +1 -0
package/dist/main.js
CHANGED
|
@@ -44365,7 +44365,7 @@ ${c}
|
|
|
44365
44365
|
}),
|
|
44366
44366
|
E.map((e2, d2) => (0, import_jsx_runtime.jsx)(TabsContent, {
|
|
44367
44367
|
value: e2.tabName,
|
|
44368
|
-
className: "h-[400px] mt-
|
|
44368
|
+
className: "h-[400px] mt-0",
|
|
44369
44369
|
children: (0, import_jsx_runtime.jsx)(ChartPanel, {
|
|
44370
44370
|
tableData: r,
|
|
44371
44371
|
chartConfig: e2.config,
|
|
@@ -44447,7 +44447,7 @@ ${c}
|
|
|
44447
44447
|
q
|
|
44448
44448
|
]);
|
|
44449
44449
|
return (0, import_jsx_runtime.jsxs)("div", {
|
|
44450
|
-
className: "flex flex-row gap-2 h-full rounded-md border pr-2",
|
|
44450
|
+
className: "flex flex-row gap-2 h-full rounded-md border-t pr-2",
|
|
44451
44451
|
children: [
|
|
44452
44452
|
(0, import_jsx_runtime.jsxs)("div", {
|
|
44453
44453
|
className: `relative flex flex-col gap-2 overflow-auto px-2 py-3 scrollbar-thin transition-width duration-200 ${O ? "w-8" : "w-[300px]"}`,
|
|
@@ -65401,7 +65401,7 @@ ${c}
|
|
|
65401
65401
|
return Logger.warn("Failed to get version from mount config"), null;
|
|
65402
65402
|
}
|
|
65403
65403
|
}
|
|
65404
|
-
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.22.1-
|
|
65404
|
+
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.22.1-dev27"), showCodeInRunModeAtom = atom(true);
|
|
65405
65405
|
atom(null);
|
|
65406
65406
|
var VIRTUAL_FILE_REGEX = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, VirtualFileTracker = class e {
|
|
65407
65407
|
constructor() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marimo-team/islands",
|
|
3
|
-
"version": "0.22.1-
|
|
3
|
+
"version": "0.22.1-dev27",
|
|
4
4
|
"main": "dist/main.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -103,7 +103,6 @@
|
|
|
103
103
|
"dequal": "^2.0.3",
|
|
104
104
|
"dnd-core": "^16.0.1",
|
|
105
105
|
"dompurify": "^3.3.1",
|
|
106
|
-
"eslint-plugin-header": "^3.1.1",
|
|
107
106
|
"htm": "^3.1.1",
|
|
108
107
|
"html-react-parser": "^5.2.14",
|
|
109
108
|
"html-to-image": "1.11.13",
|
|
@@ -172,9 +171,9 @@
|
|
|
172
171
|
"build": "cross-env vite build",
|
|
173
172
|
"test": "vitest",
|
|
174
173
|
"typecheck": "tsgo",
|
|
175
|
-
"
|
|
176
|
-
"lint
|
|
177
|
-
"lint:
|
|
174
|
+
"format": "oxfmt --config ../.oxfmtrc.json",
|
|
175
|
+
"lint": "run-s lint:oxlint lint:stylelint",
|
|
176
|
+
"lint:oxlint": "oxlint --fix",
|
|
178
177
|
"lint:stylelint": "stylelint src/**/*.css --fix",
|
|
179
178
|
"preview": "vite preview",
|
|
180
179
|
"dev:quarto": "VITE_MARIMO_ISLANDS=true vite",
|
|
@@ -191,7 +190,6 @@
|
|
|
191
190
|
"devDependencies": {
|
|
192
191
|
"@babel/plugin-proposal-decorators": "^7.28.6",
|
|
193
192
|
"@babel/preset-typescript": "^7.25.9",
|
|
194
|
-
"@biomejs/biome": "2.3.13",
|
|
195
193
|
"@codecov/vite-plugin": "^1.9.1",
|
|
196
194
|
"@csstools/postcss-light-dark-function": "^2.0.11",
|
|
197
195
|
"@playwright/test": "^1.58.2",
|
|
@@ -209,24 +207,15 @@
|
|
|
209
207
|
"@types/react": "^19.2.10",
|
|
210
208
|
"@types/react-dom": "^19.2.3",
|
|
211
209
|
"@types/timestring": "^6.0.5",
|
|
212
|
-
"@typescript-eslint/eslint-plugin": "^7.15.0",
|
|
213
|
-
"@typescript-eslint/parser": "^7.15.0",
|
|
214
210
|
"@vitejs/plugin-react": "^5.1.4",
|
|
215
211
|
"babel-plugin-react-compiler": "19.1.0-rc.3",
|
|
216
212
|
"blob-polyfill": "^7.0.20220408",
|
|
217
213
|
"cross-env": "^7.0.3",
|
|
218
|
-
"eslint": "^8.57.0",
|
|
219
|
-
"eslint-config-prettier": "^9.1.0",
|
|
220
|
-
"eslint-plugin-react": "^7.34.3",
|
|
221
|
-
"eslint-plugin-react-hooks": "^6.0.0-rc.1",
|
|
222
|
-
"eslint-plugin-react-you-might-not-need-an-effect": "^0.5.1",
|
|
223
|
-
"eslint-plugin-ssr-friendly": "^1.3.0",
|
|
224
|
-
"eslint-plugin-storybook": "^9.0.14",
|
|
225
|
-
"eslint-plugin-unicorn": "^54.0.0",
|
|
226
|
-
"eslint-plugin-vitest": "^0.4.1",
|
|
227
214
|
"jsdom": "^24.1.3",
|
|
228
215
|
"msw": "^2.12.7",
|
|
229
216
|
"npm-run-all2": "^6.2.6",
|
|
217
|
+
"oxfmt": "^0.42.0",
|
|
218
|
+
"oxlint": "^1.58.0",
|
|
230
219
|
"postcss": "^8.5.6",
|
|
231
220
|
"postcss-plugin-namespace": "^0.0.3",
|
|
232
221
|
"react": "^19.2.4",
|
|
@@ -45,20 +45,18 @@ describe("main", () => {
|
|
|
45
45
|
store.set(configOverridesAtom, {});
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
it.each([
|
|
49
|
-
"
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
expect(store.get(showCodeInRunModeAtom)).toBe(true);
|
|
61
|
-
});
|
|
48
|
+
it.each(["edit", "read", "home", "run"])(
|
|
49
|
+
"should mount with mode %s",
|
|
50
|
+
(_mode) => {
|
|
51
|
+
const el = document.createElement("div");
|
|
52
|
+
mount({ mode: "edit" }, el);
|
|
53
|
+
|
|
54
|
+
expect(store.get(viewStateAtom).mode).toBe("edit");
|
|
55
|
+
expect(store.get(filenameAtom)).toBeDefined();
|
|
56
|
+
expect(store.get(marimoVersionAtom)).toBe("unknown");
|
|
57
|
+
expect(store.get(showCodeInRunModeAtom)).toBe(true);
|
|
58
|
+
},
|
|
59
|
+
);
|
|
62
60
|
|
|
63
61
|
it("should not mount with invalid mode", () => {
|
|
64
62
|
const el = document.createElement("div");
|
|
@@ -36,8 +36,7 @@ const icons: Record<ProviderId | ExternalAgentId, string> = {
|
|
|
36
36
|
opencode: OpencodeIcon,
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
export interface AiProviderIconProps
|
|
40
|
-
extends React.HTMLAttributes<HTMLImageElement> {
|
|
39
|
+
export interface AiProviderIconProps extends React.HTMLAttributes<HTMLImageElement> {
|
|
41
40
|
provider: keyof typeof icons | "openai-compatible";
|
|
42
41
|
className?: string;
|
|
43
42
|
}
|
|
@@ -40,8 +40,9 @@ export interface CellSelectionInstance<TData extends RowData> {
|
|
|
40
40
|
declare module "@tanstack/react-table" {
|
|
41
41
|
interface TableState extends CellSelectionTableState {}
|
|
42
42
|
|
|
43
|
-
interface TableOptionsResolved<
|
|
44
|
-
extends
|
|
43
|
+
interface TableOptionsResolved<
|
|
44
|
+
TData extends RowData,
|
|
45
|
+
> extends CellSelectionOptions {}
|
|
45
46
|
|
|
46
47
|
interface Table<TData extends RowData> extends CellSelectionInstance<TData> {}
|
|
47
48
|
|
|
@@ -257,7 +257,7 @@ export const TablePanel: React.FC<TablePanelProps> = ({
|
|
|
257
257
|
saveTabChartType(tab.tabName, chartType);
|
|
258
258
|
};
|
|
259
259
|
return (
|
|
260
|
-
<TabsContent key={idx} value={tab.tabName} className="h-[400px] mt-
|
|
260
|
+
<TabsContent key={idx} value={tab.tabName} className="h-[400px] mt-0">
|
|
261
261
|
<ChartPanel
|
|
262
262
|
tableData={data}
|
|
263
263
|
chartConfig={tab.config}
|
|
@@ -475,7 +475,7 @@ export const ChartPanel: React.FC<{
|
|
|
475
475
|
);
|
|
476
476
|
|
|
477
477
|
return (
|
|
478
|
-
<div className="flex flex-row gap-2 h-full rounded-md border pr-2">
|
|
478
|
+
<div className="flex flex-row gap-2 h-full rounded-md border-t pr-2">
|
|
479
479
|
<div
|
|
480
480
|
className={`relative flex flex-col gap-2 overflow-auto px-2 py-3 scrollbar-thin transition-width duration-200 ${formCollapsed ? "w-8" : "w-[300px]"}`}
|
|
481
481
|
>
|
|
@@ -48,8 +48,9 @@ declare module "@tanstack/react-table" {
|
|
|
48
48
|
//merge column formatting's state with the existing table state
|
|
49
49
|
interface TableState extends ColumnFormattingTableState {}
|
|
50
50
|
//merge column formatting's options with the existing table options
|
|
51
|
-
interface TableOptionsResolved<
|
|
52
|
-
extends
|
|
51
|
+
interface TableOptionsResolved<
|
|
52
|
+
TData extends RowData,
|
|
53
|
+
> extends ColumnFormattingOptions {}
|
|
53
54
|
//merge column formatting's instance APIs with the existing table instance APIs
|
|
54
55
|
interface Column<TData extends RowData> extends ColumnFormattingInstance {}
|
|
55
56
|
}
|
|
@@ -63,8 +63,10 @@ import { stringifyUnknownValue } from "./utils";
|
|
|
63
63
|
|
|
64
64
|
const TOP_K_ROWS = 30;
|
|
65
65
|
|
|
66
|
-
interface DataTableColumnHeaderProps<
|
|
67
|
-
|
|
66
|
+
interface DataTableColumnHeaderProps<
|
|
67
|
+
TData,
|
|
68
|
+
TValue,
|
|
69
|
+
> extends React.HTMLAttributes<HTMLDivElement> {
|
|
68
70
|
column: Column<TData, TValue>;
|
|
69
71
|
header: React.ReactNode;
|
|
70
72
|
justify?: "left" | "center" | "right";
|
|
@@ -22,8 +22,9 @@ export interface ColumnWrappingInstance {
|
|
|
22
22
|
declare module "@tanstack/react-table" {
|
|
23
23
|
interface TableState extends ColumnWrappingTableState {}
|
|
24
24
|
|
|
25
|
-
interface TableOptionsResolved<
|
|
26
|
-
extends
|
|
25
|
+
interface TableOptionsResolved<
|
|
26
|
+
TData extends RowData,
|
|
27
|
+
> extends ColumnWrappingOptions {}
|
|
27
28
|
|
|
28
29
|
interface Column<TData extends RowData> extends ColumnWrappingInstance {}
|
|
29
30
|
}
|
|
@@ -12,8 +12,9 @@ export interface CopyColumnInstance {
|
|
|
12
12
|
|
|
13
13
|
// Use declaration merging to add our new feature APIs
|
|
14
14
|
declare module "@tanstack/react-table" {
|
|
15
|
-
interface TableOptionsResolved<
|
|
16
|
-
extends
|
|
15
|
+
interface TableOptionsResolved<
|
|
16
|
+
TData extends RowData,
|
|
17
|
+
> extends CopyColumnOptions {}
|
|
17
18
|
|
|
18
19
|
interface Column<TData extends RowData> extends CopyColumnInstance {}
|
|
19
20
|
}
|
|
@@ -25,8 +25,9 @@ export interface FocusRowInstance {
|
|
|
25
25
|
declare module "@tanstack/react-table" {
|
|
26
26
|
interface TableState extends FocusRowTableState {}
|
|
27
27
|
|
|
28
|
-
interface TableOptionsResolved<
|
|
29
|
-
extends
|
|
28
|
+
interface TableOptionsResolved<
|
|
29
|
+
TData extends RowData,
|
|
30
|
+
> extends FocusRowOptions {}
|
|
30
31
|
|
|
31
32
|
interface Row<TData extends RowData> extends FocusRowInstance {}
|
|
32
33
|
}
|
|
@@ -56,18 +56,18 @@ function createMockCell(
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
function createMockTable(): Table<T> {
|
|
59
|
-
const mockToggleSelected = vi
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
const mockToggleSelected = vi
|
|
60
|
+
.fn()
|
|
61
|
+
.mockImplementation(function (this: { isSelected: boolean }) {
|
|
62
|
+
this.isSelected = !this.isSelected;
|
|
63
|
+
return { isSelected: this.isSelected };
|
|
64
|
+
});
|
|
65
65
|
|
|
66
|
-
const mockGetIsSelected = vi
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
66
|
+
const mockGetIsSelected = vi
|
|
67
|
+
.fn()
|
|
68
|
+
.mockImplementation(function (this: { isSelected: boolean }) {
|
|
69
|
+
return this.isSelected;
|
|
70
|
+
});
|
|
71
71
|
|
|
72
72
|
const rows = [
|
|
73
73
|
{
|
|
@@ -23,17 +23,15 @@ describe("isInteractiveTarget", () => {
|
|
|
23
23
|
expect(isInteractiveTarget(createMouseEvent(span, cell))).toBe(false);
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
it.each([
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
expect(isInteractiveTarget(createMouseEvent(el, cell))).toBe(true);
|
|
36
|
-
});
|
|
26
|
+
it.each(["input", "button", "select", "textarea"])(
|
|
27
|
+
"returns true when clicking a <%s>",
|
|
28
|
+
(tag) => {
|
|
29
|
+
const cell = document.createElement("td");
|
|
30
|
+
const el = document.createElement(tag);
|
|
31
|
+
cell.append(el);
|
|
32
|
+
expect(isInteractiveTarget(createMouseEvent(el, cell))).toBe(true);
|
|
33
|
+
},
|
|
34
|
+
);
|
|
37
35
|
|
|
38
36
|
it("returns true when clicking an <a> link", () => {
|
|
39
37
|
const cell = document.createElement("td");
|
|
@@ -33,108 +33,107 @@ beforeAll(() => {
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
describe("Cell data attributes", () => {
|
|
36
|
-
it.each([
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const cid = cellId("test");
|
|
43
|
-
const cellName = "test_cell";
|
|
36
|
+
it.each(["edit", "read", "present"])(
|
|
37
|
+
"should render cell with data-cell-id and data-cell-name in %s mode",
|
|
38
|
+
(mode) => {
|
|
39
|
+
const { store, wrapper } = createTestWrapper();
|
|
40
|
+
const cid = cellId("test");
|
|
41
|
+
const cellName = "test_cell";
|
|
44
42
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
43
|
+
const userConfig: UserConfig = {
|
|
44
|
+
display: {
|
|
45
|
+
cell_output: "below",
|
|
46
|
+
code_editor_font_size: 14,
|
|
47
|
+
dataframes: "rich",
|
|
48
|
+
default_table_page_size: 10,
|
|
49
|
+
default_table_max_columns: 10,
|
|
50
|
+
default_width: "normal",
|
|
51
|
+
theme: "light",
|
|
52
|
+
reference_highlighting: false,
|
|
53
|
+
},
|
|
54
|
+
keymap: { preset: "default" },
|
|
55
|
+
completion: {
|
|
56
|
+
activate_on_typing: true,
|
|
57
|
+
signature_hint_on_typing: false,
|
|
58
|
+
copilot: false,
|
|
59
|
+
},
|
|
60
|
+
formatting: { line_length: 88 },
|
|
61
|
+
package_management: { manager: "pip" },
|
|
62
|
+
runtime: {
|
|
63
|
+
auto_instantiate: false,
|
|
64
|
+
default_sql_output: "native",
|
|
65
|
+
auto_reload: "off",
|
|
66
|
+
on_cell_change: "lazy",
|
|
67
|
+
watcher_on_save: "lazy",
|
|
68
|
+
reactive_tests: true,
|
|
69
|
+
output_max_bytes: 1_000_000,
|
|
70
|
+
std_stream_max_bytes: 1_000_000,
|
|
71
|
+
pythonpath: [],
|
|
72
|
+
dotenv: [".env"],
|
|
73
|
+
},
|
|
74
|
+
server: {
|
|
75
|
+
browser: "default",
|
|
76
|
+
follow_symlink: false,
|
|
77
|
+
},
|
|
78
|
+
save: { autosave: "off", autosave_delay: 1000, format_on_save: false },
|
|
79
|
+
ai: {},
|
|
80
|
+
} as UserConfig;
|
|
83
81
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
82
|
+
const notebook = MockNotebook.notebookState({
|
|
83
|
+
cellData: {
|
|
84
|
+
[cid]: {
|
|
85
|
+
code: "",
|
|
86
|
+
name: cellName,
|
|
87
|
+
edited: false,
|
|
88
|
+
serializedEditorState: null,
|
|
89
|
+
config: {
|
|
90
|
+
disabled: false,
|
|
91
|
+
hide_code: false,
|
|
92
|
+
column: null,
|
|
93
|
+
},
|
|
95
94
|
},
|
|
96
95
|
},
|
|
97
|
-
}
|
|
98
|
-
});
|
|
96
|
+
});
|
|
99
97
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
98
|
+
notebook.cellRuntime[cid] = createCellRuntimeState({
|
|
99
|
+
status: "idle",
|
|
100
|
+
output: null,
|
|
101
|
+
consoleOutputs: [],
|
|
102
|
+
interrupted: false,
|
|
103
|
+
errored: false,
|
|
104
|
+
stopped: false,
|
|
105
|
+
staleInputs: false,
|
|
106
|
+
runStartTimestamp: null,
|
|
107
|
+
lastRunStartTimestamp: null,
|
|
108
|
+
runElapsedTimeMs: null,
|
|
109
|
+
debuggerActive: false,
|
|
110
|
+
outline: null,
|
|
111
|
+
});
|
|
114
112
|
|
|
115
|
-
|
|
113
|
+
store.set(notebookAtom, notebook);
|
|
116
114
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
115
|
+
const { container } = render(
|
|
116
|
+
<TooltipProvider>
|
|
117
|
+
<Cell
|
|
118
|
+
cellId={cid}
|
|
119
|
+
mode={mode as AppMode}
|
|
120
|
+
canDelete={true}
|
|
121
|
+
userConfig={userConfig}
|
|
122
|
+
isCollapsed={false}
|
|
123
|
+
collapseCount={0}
|
|
124
|
+
canMoveX={false}
|
|
125
|
+
theme="light"
|
|
126
|
+
showPlaceholder={false}
|
|
127
|
+
/>
|
|
128
|
+
</TooltipProvider>,
|
|
129
|
+
{ wrapper },
|
|
130
|
+
);
|
|
133
131
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
const cellElement = container.querySelector(`[data-cell-id="${cid}"]`);
|
|
133
|
+
expect(cellElement).toBeTruthy();
|
|
134
|
+
expect(cellElement?.getAttribute("data-cell-name")).toBe(cellName);
|
|
135
|
+
},
|
|
136
|
+
);
|
|
138
137
|
});
|
|
139
138
|
|
|
140
139
|
describe("Output data attributes", () => {
|
|
@@ -14,8 +14,10 @@ import { useOnMount } from "@/hooks/useLifecycle";
|
|
|
14
14
|
import { cn } from "@/utils/cn";
|
|
15
15
|
import { Events } from "@/utils/events";
|
|
16
16
|
|
|
17
|
-
interface Props
|
|
18
|
-
|
|
17
|
+
interface Props extends Omit<
|
|
18
|
+
React.InputHTMLAttributes<HTMLInputElement>,
|
|
19
|
+
"onChange"
|
|
20
|
+
> {
|
|
19
21
|
value: string;
|
|
20
22
|
onChange: (newName: string) => void;
|
|
21
23
|
placeholder?: string;
|
|
@@ -65,8 +65,10 @@ import { useSplitCellCallback } from "../cell/useSplitCell";
|
|
|
65
65
|
import { NameCellInput } from "./name-cell-input";
|
|
66
66
|
import type { ActionButton } from "./types";
|
|
67
67
|
|
|
68
|
-
export interface CellActionButtonProps
|
|
69
|
-
|
|
68
|
+
export interface CellActionButtonProps extends Pick<
|
|
69
|
+
CellData,
|
|
70
|
+
"name" | "config"
|
|
71
|
+
> {
|
|
70
72
|
cellId: CellId;
|
|
71
73
|
status: RuntimeState;
|
|
72
74
|
hasOutput: boolean;
|
|
@@ -16,11 +16,10 @@ import "./cell-status.css";
|
|
|
16
16
|
import { formatDistanceToNow } from "date-fns";
|
|
17
17
|
import { Time } from "@/utils/time";
|
|
18
18
|
|
|
19
|
-
export interface CellStatusComponentProps
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
> {
|
|
19
|
+
export interface CellStatusComponentProps extends Pick<
|
|
20
|
+
CellRuntimeState,
|
|
21
|
+
"status" | "runStartTimestamp" | "interrupted" | "lastRunStartTimestamp"
|
|
22
|
+
> {
|
|
24
23
|
editing: boolean;
|
|
25
24
|
edited: boolean;
|
|
26
25
|
disabled: boolean;
|
|
@@ -34,8 +34,10 @@ import {
|
|
|
34
34
|
useCellActionButtons,
|
|
35
35
|
} from "../actions/useCellActionButton";
|
|
36
36
|
|
|
37
|
-
interface Props
|
|
38
|
-
|
|
37
|
+
interface Props extends Pick<
|
|
38
|
+
CellActionButtonProps,
|
|
39
|
+
"cellId" | "getEditorView"
|
|
40
|
+
> {
|
|
39
41
|
children: React.ReactNode;
|
|
40
42
|
}
|
|
41
43
|
|
|
@@ -47,7 +47,8 @@ import { useSplitCellCallback } from "../useSplitCell";
|
|
|
47
47
|
import { LanguageToggles } from "./language-toggle";
|
|
48
48
|
|
|
49
49
|
export interface CellEditorProps
|
|
50
|
-
extends
|
|
50
|
+
extends
|
|
51
|
+
Pick<CellRuntimeState, "status">,
|
|
51
52
|
Pick<CellData, "id" | "code" | "serializedEditorState" | "config"> {
|
|
52
53
|
runCell: () => void;
|
|
53
54
|
theme: Theme;
|
|
@@ -27,7 +27,8 @@ const toolbarItemVariants = cva(
|
|
|
27
27
|
);
|
|
28
28
|
|
|
29
29
|
interface ToolbarItemProps
|
|
30
|
-
extends
|
|
30
|
+
extends
|
|
31
|
+
VariantProps<typeof toolbarItemVariants>,
|
|
31
32
|
React.HTMLAttributes<HTMLButtonElement> {
|
|
32
33
|
tooltip: React.ReactNode;
|
|
33
34
|
disabled?: boolean;
|
|
@@ -311,18 +311,17 @@ const ActionButtons: React.FC<{
|
|
|
311
311
|
);
|
|
312
312
|
};
|
|
313
313
|
|
|
314
|
-
interface VerticalCellProps
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
> {
|
|
314
|
+
interface VerticalCellProps extends Pick<
|
|
315
|
+
CellRuntimeState,
|
|
316
|
+
| "output"
|
|
317
|
+
| "consoleOutputs"
|
|
318
|
+
| "status"
|
|
319
|
+
| "stopped"
|
|
320
|
+
| "errored"
|
|
321
|
+
| "interrupted"
|
|
322
|
+
| "staleInputs"
|
|
323
|
+
| "runStartTimestamp"
|
|
324
|
+
> {
|
|
326
325
|
cellOutputArea: "above" | "below";
|
|
327
326
|
cellId: CellId;
|
|
328
327
|
config: CellConfig;
|
|
@@ -147,9 +147,8 @@ describe("download-file snippet", () => {
|
|
|
147
147
|
});
|
|
148
148
|
|
|
149
149
|
it("obstore gcs backend", () => {
|
|
150
|
-
expect(
|
|
151
|
-
|
|
152
|
-
).toMatchInlineSnapshot(`
|
|
150
|
+
expect(downloadSnippet.getCode(makeCtx({ protocol: "gcs" })))
|
|
151
|
+
.toMatchInlineSnapshot(`
|
|
153
152
|
"from datetime import timedelta
|
|
154
153
|
from obstore import sign
|
|
155
154
|
|
|
@@ -162,9 +161,8 @@ describe("download-file snippet", () => {
|
|
|
162
161
|
});
|
|
163
162
|
|
|
164
163
|
it("obstore cloudflare backend", () => {
|
|
165
|
-
expect(
|
|
166
|
-
|
|
167
|
-
).toMatchInlineSnapshot(`
|
|
164
|
+
expect(downloadSnippet.getCode(makeCtx({ protocol: "cloudflare" })))
|
|
165
|
+
.toMatchInlineSnapshot(`
|
|
168
166
|
"from datetime import timedelta
|
|
169
167
|
from obstore import sign
|
|
170
168
|
|