@marimo-team/frontend 0.23.7-dev17 → 0.23.7-dev19
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/assets/{CellStatus-Cb08qBNj.js → CellStatus-CSvTla4f.js} +1 -1
- package/dist/assets/{JsonOutput-BqavrgK2.js → JsonOutput-JTrlf9N4.js} +1 -1
- package/dist/assets/{MarimoErrorOutput-DyaTrW3L.js → MarimoErrorOutput-hJIljqUO.js} +1 -1
- package/dist/assets/{RenderHTML-CvnUbELu.js → RenderHTML-a81krr2r.js} +1 -1
- package/dist/assets/{add-cell-with-ai-CsUwlDQR.js → add-cell-with-ai-DfJY2bip.js} +1 -1
- package/dist/assets/{add-connection-dialog-B00bTtAj.js → add-connection-dialog-Dr86oIaM.js} +1 -1
- package/dist/assets/{agent-panel-vnhI1dDS.js → agent-panel-BqqMglHo.js} +1 -1
- package/dist/assets/{ai-model-dropdown-E3o7Xd1q.js → ai-model-dropdown-BtI9PY1X.js} +1 -1
- package/dist/assets/{app-config-button-DTjn2zGb.js → app-config-button-BE6k0AGO.js} +1 -1
- package/dist/assets/{cell-editor-C41pv5M8.js → cell-editor-BnpmZwdT.js} +8 -8
- package/dist/assets/{cell-link-sLKimSIQ.js → cell-link-DieESi6t.js} +1 -1
- package/dist/assets/{cells-Vnv1zw09.js → cells-CQvqgbJL.js} +1 -1
- package/dist/assets/{chat-display-sbJsmezM.js → chat-display-DXa2yk_L.js} +1 -1
- package/dist/assets/{chat-panel-DFLJ558d.js → chat-panel-B_FKBw0c.js} +1 -1
- package/dist/assets/{chat-ui-BWV8p_Y-.js → chat-ui-DRuFbdVZ.js} +1 -1
- package/dist/assets/{column-preview-DYtdLerF.js → column-preview-B59x-AoX.js} +1 -1
- package/dist/assets/{command-palette-CvoYeZJD.js → command-palette-BM-axWW4.js} +1 -1
- package/dist/assets/{common-BhQv6499.js → common-DstWRPls.js} +1 -1
- package/dist/assets/{components-c7ywwQgj.js → components-BKjSTOL0.js} +1 -1
- package/dist/assets/{components-BA-LgiMU.js → components-BLTMoYca.js} +1 -1
- package/dist/assets/{datasource-BGeucDqU.js → datasource-BpHWX4lD.js} +1 -1
- package/dist/assets/{dependency-graph-panel-Dm8aJtqe.js → dependency-graph-panel-DVAWOnhj.js} +1 -1
- package/dist/assets/{documentation-panel-BmTIHvGw.js → documentation-panel-DOwrxSmS.js} +1 -1
- package/dist/assets/{download-CHV3J2Ib.js → download-D37eAThw.js} +1 -1
- package/dist/assets/{edit-page-Dvj9-hG8.js → edit-page-DZuEJBmv.js} +3 -3
- package/dist/assets/{error-panel-yG2LOaXm.js → error-panel-iXq4blF1.js} +1 -1
- package/dist/assets/{file-explorer-panel-Bsp9TexR.js → file-explorer-panel-YmaDORzk.js} +1 -1
- package/dist/assets/{file-icons-Cisq31t9.js → file-icons-CJjHFZoa.js} +1 -1
- package/dist/assets/{floating-outline-CnVsBFJf.js → floating-outline-CRNblX2_.js} +1 -1
- package/dist/assets/{focus-bWAnl_NC.js → focus-BOQLCb0u.js} +1 -1
- package/dist/assets/{form-iTIO7T75.js → form-Zq0BEAeQ.js} +1 -1
- package/dist/assets/{home-page-CSSZCATB.js → home-page-CFZknmVJ.js} +1 -1
- package/dist/assets/{hooks-CxyxjDM-.js → hooks-BhxMMR6X.js} +1 -1
- package/dist/assets/{html-to-image-WbbYaIba.js → html-to-image-D1De-o9R.js} +1 -1
- package/dist/assets/{index-BmG6rFrZ.js → index-BTq_h4uZ.js} +4 -4
- package/dist/assets/{index-BcFmKehD.css → index-DisN5cp_.css} +1 -1
- package/dist/assets/{kiosk-mode-DPxzN-M0.js → kiosk-mode-DGC0xDP_.js} +1 -1
- package/dist/assets/{layout-B3ilKFRj.js → layout-C74kqxlS.js} +3 -3
- package/dist/assets/{logs-panel-7jkC5Vwq.js → logs-panel-B8xVxjgp.js} +1 -1
- package/dist/assets/{markdown-renderer-CXVa5ubo.js → markdown-renderer-DDfK2Hm1.js} +1 -1
- package/dist/assets/{name-cell-input-DP5q5hou.js → name-cell-input-BOJED96M.js} +1 -1
- package/dist/assets/{outline-panel-CAMKZApa.js → outline-panel-b7DUTxCg.js} +1 -1
- package/dist/assets/{packages-panel-BqWdwyLN.js → packages-panel-CsjVrbrw.js} +1 -1
- package/dist/assets/{panels-BaOloRiT.js → panels-rOdN-lhQ.js} +1 -1
- package/dist/assets/{process-output-3R47GJ28.js → process-output-lWggtdHR.js} +1 -1
- package/dist/assets/{radio-group-BdIsm_qJ.js → radio-group-dnHLEMQN.js} +1 -1
- package/dist/assets/{readonly-python-code-Dz8x4isw.js → readonly-python-code-B2nKkRm8.js} +1 -1
- package/dist/assets/{reveal-component-BomJwrt3.js → reveal-component-CRXRtrKQ.js} +1 -1
- package/dist/assets/{run-page-DOVpxgC2.js → run-page-HwiYpW0n.js} +1 -1
- package/dist/assets/{scratchpad-panel-CK721GBB.js → scratchpad-panel-CQPeL9uQ.js} +1 -1
- package/dist/assets/{session-panel-_DOPOxmi.js → session-panel-DDsg3OVJ.js} +1 -1
- package/dist/assets/{snippets-panel-CtEyZp6T.js → snippets-panel-CL4Fe7G1.js} +1 -1
- package/dist/assets/{state-DujssAPg.js → state-Cy8CWhme.js} +1 -1
- package/dist/assets/{state-CZ60VH86.js → state-Qlb7fpYs.js} +1 -1
- package/dist/assets/{textarea-CUCKX5FP.js → textarea-BIlunvBI.js} +1 -1
- package/dist/assets/{tracing-B84tRfOs.js → tracing-DxGrQWpp.js} +1 -1
- package/dist/assets/{tracing-panel-Cv--myyS.js → tracing-panel-CkSlaa2T.js} +2 -2
- package/dist/assets/{useCellActionButton-Mkc0xJ7L.js → useCellActionButton-BUDcn6TS.js} +1 -1
- package/dist/assets/{useDeleteCell-C67FKMcv.js → useDeleteCell-BImYFHqx.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-BdgKnqQ5.js → useDependencyPanelTab-DjkP1aZy.js} +1 -1
- package/dist/assets/{useNotebookActions-C_PqW3GC.js → useNotebookActions-CcSrDfx2.js} +1 -1
- package/dist/assets/{useRunCells-C991pS4a.js → useRunCells-CHuy8C5z.js} +1 -1
- package/dist/assets/{useSplitCell-FJGXiUyn.js → useSplitCell-BxJOt_Lh.js} +1 -1
- package/dist/index.html +23 -23
- package/package.json +1 -1
- package/src/components/editor/navigation/__tests__/clipboard.test.ts +0 -1
- package/src/components/editor/navigation/clipboard.ts +20 -24
- package/src/core/cells/__tests__/cells.test.ts +12 -12
- package/src/core/cells/__tests__/pending-cut-service.test.tsx +14 -36
- package/src/core/cells/pending-cut-service.ts +1 -10
- package/src/css/app/Cell.css +2 -5
package/dist/index.html
CHANGED
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
<marimo-server-token data-token="{{ server_token }}" hidden></marimo-server-token>
|
|
67
67
|
<!-- /TODO -->
|
|
68
68
|
<title>{{ title }}</title>
|
|
69
|
-
<script type="module" crossorigin src="./assets/index-
|
|
69
|
+
<script type="module" crossorigin src="./assets/index-BTq_h4uZ.js"></script>
|
|
70
70
|
<link rel="modulepreload" crossorigin href="./assets/preload-helper-DItdS47A.js">
|
|
71
71
|
<link rel="modulepreload" crossorigin href="./assets/chunk-LvLJmgfZ.js">
|
|
72
72
|
<link rel="modulepreload" crossorigin href="./assets/react-Bj1aDYRI.js">
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
<link rel="modulepreload" crossorigin href="./assets/debounce-DhnxH9Rh.js">
|
|
134
134
|
<link rel="modulepreload" crossorigin href="./assets/database-zap-kIkTfzTX.js">
|
|
135
135
|
<link rel="modulepreload" crossorigin href="./assets/main-B0OX4z33.js">
|
|
136
|
-
<link rel="modulepreload" crossorigin href="./assets/cells-
|
|
136
|
+
<link rel="modulepreload" crossorigin href="./assets/cells-CQvqgbJL.js">
|
|
137
137
|
<link rel="modulepreload" crossorigin href="./assets/ErrorBoundary-DyYDV0HI.js">
|
|
138
138
|
<link rel="modulepreload" crossorigin href="./assets/kbd-B3Breaz2.js">
|
|
139
139
|
<link rel="modulepreload" crossorigin href="./assets/useInstallPackage-CScpUItd.js">
|
|
@@ -147,33 +147,33 @@
|
|
|
147
147
|
<link rel="modulepreload" crossorigin href="./assets/usePress-CfcdTqJM.js">
|
|
148
148
|
<link rel="modulepreload" crossorigin href="./assets/input-DW6LU13i.js">
|
|
149
149
|
<link rel="modulepreload" crossorigin href="./assets/ImperativeModal-CvOOClOZ.js">
|
|
150
|
-
<link rel="modulepreload" crossorigin href="./assets/cell-link-
|
|
150
|
+
<link rel="modulepreload" crossorigin href="./assets/cell-link-DieESi6t.js">
|
|
151
151
|
<link rel="modulepreload" crossorigin href="./assets/multi-map-CUuNtzHt.js">
|
|
152
152
|
<link rel="modulepreload" crossorigin href="./assets/alert-DvqcBMUv.js">
|
|
153
153
|
<link rel="modulepreload" crossorigin href="./assets/chevron-right-CG5QYXYk.js">
|
|
154
154
|
<link rel="modulepreload" crossorigin href="./assets/dropdown-menu-CR7cnzLX.js">
|
|
155
155
|
<link rel="modulepreload" crossorigin href="./assets/links-Dpap8NI2.js">
|
|
156
|
-
<link rel="modulepreload" crossorigin href="./assets/useRunCells-
|
|
156
|
+
<link rel="modulepreload" crossorigin href="./assets/useRunCells-CHuy8C5z.js">
|
|
157
157
|
<link rel="modulepreload" crossorigin href="./assets/copy-DqHGjTAN.js">
|
|
158
158
|
<link rel="modulepreload" crossorigin href="./assets/copy-BwrPA9zQ.js">
|
|
159
159
|
<link rel="modulepreload" crossorigin href="./assets/copy-icon-8abB4Lgh.js">
|
|
160
|
-
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-
|
|
161
|
-
<link rel="modulepreload" crossorigin href="./assets/datasource-
|
|
162
|
-
<link rel="modulepreload" crossorigin href="./assets/state-
|
|
160
|
+
<link rel="modulepreload" crossorigin href="./assets/RenderHTML-a81krr2r.js">
|
|
161
|
+
<link rel="modulepreload" crossorigin href="./assets/datasource-BpHWX4lD.js">
|
|
162
|
+
<link rel="modulepreload" crossorigin href="./assets/state-Cy8CWhme.js">
|
|
163
163
|
<link rel="modulepreload" crossorigin href="./assets/sparkles-CZ5WmLPA.js">
|
|
164
|
-
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-
|
|
164
|
+
<link rel="modulepreload" crossorigin href="./assets/MarimoErrorOutput-hJIljqUO.js">
|
|
165
165
|
<link rel="modulepreload" crossorigin href="./assets/spinner-Bhir8k53.js">
|
|
166
|
-
<link rel="modulepreload" crossorigin href="./assets/html-to-image-
|
|
167
|
-
<link rel="modulepreload" crossorigin href="./assets/focus-
|
|
166
|
+
<link rel="modulepreload" crossorigin href="./assets/html-to-image-D1De-o9R.js">
|
|
167
|
+
<link rel="modulepreload" crossorigin href="./assets/focus-BOQLCb0u.js">
|
|
168
168
|
<link rel="modulepreload" crossorigin href="./assets/useAsyncData-BFC6lWG9.js">
|
|
169
169
|
<link rel="modulepreload" crossorigin href="./assets/LazyAnyLanguageCodeMirror-CXbgDeVw.js">
|
|
170
170
|
<link rel="modulepreload" crossorigin href="./assets/micromark-factory-space-DzSMahmM.js">
|
|
171
171
|
<link rel="modulepreload" crossorigin href="./assets/chunk-5FQGJX7Z-BReOK4Lg.js">
|
|
172
|
-
<link rel="modulepreload" crossorigin href="./assets/markdown-renderer-
|
|
172
|
+
<link rel="modulepreload" crossorigin href="./assets/markdown-renderer-DDfK2Hm1.js">
|
|
173
173
|
<link rel="modulepreload" crossorigin href="./assets/command-OHlV5HHD.js">
|
|
174
174
|
<link rel="modulepreload" crossorigin href="./assets/popover-Bz_0Vkyf.js">
|
|
175
175
|
<link rel="modulepreload" crossorigin href="./assets/errors-CPlNr33a.js">
|
|
176
|
-
<link rel="modulepreload" crossorigin href="./assets/download-
|
|
176
|
+
<link rel="modulepreload" crossorigin href="./assets/download-D37eAThw.js">
|
|
177
177
|
<link rel="modulepreload" crossorigin href="./assets/table-DPyRV1LT.js">
|
|
178
178
|
<link rel="modulepreload" crossorigin href="./assets/useIframeCapabilities-BfimgBBe.js">
|
|
179
179
|
<link rel="modulepreload" crossorigin href="./assets/error-banner-JKAA0BVv.js">
|
|
@@ -191,27 +191,27 @@
|
|
|
191
191
|
<link rel="modulepreload" crossorigin href="./assets/message-circle-CWm2KnSx.js">
|
|
192
192
|
<link rel="modulepreload" crossorigin href="./assets/trash-2-CKlZA04n.js">
|
|
193
193
|
<link rel="modulepreload" crossorigin href="./assets/react-resizable-panels.browser.esm-BUNcfKXO.js">
|
|
194
|
-
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-
|
|
194
|
+
<link rel="modulepreload" crossorigin href="./assets/JsonOutput-JTrlf9N4.js">
|
|
195
195
|
<link rel="modulepreload" crossorigin href="./assets/chart-no-axes-column-nqk474t8.js">
|
|
196
196
|
<link rel="modulepreload" crossorigin href="./assets/square-function-D1dlJvD8.js">
|
|
197
197
|
<link rel="modulepreload" crossorigin href="./assets/spec-ByOlaO3e.js">
|
|
198
198
|
<link rel="modulepreload" crossorigin href="./assets/ellipsis-vertical-CkwWkOQL.js">
|
|
199
199
|
<link rel="modulepreload" crossorigin href="./assets/refresh-cw-DHwG4Mac.js">
|
|
200
200
|
<link rel="modulepreload" crossorigin href="./assets/tree-actions-Bzr5XDGx.js">
|
|
201
|
-
<link rel="modulepreload" crossorigin href="./assets/components-
|
|
202
|
-
<link rel="modulepreload" crossorigin href="./assets/column-preview-
|
|
201
|
+
<link rel="modulepreload" crossorigin href="./assets/components-BLTMoYca.js">
|
|
202
|
+
<link rel="modulepreload" crossorigin href="./assets/column-preview-B59x-AoX.js">
|
|
203
203
|
<link rel="modulepreload" crossorigin href="./assets/icons-D9TuFTJG.js">
|
|
204
|
-
<link rel="modulepreload" crossorigin href="./assets/radio-group-
|
|
205
|
-
<link rel="modulepreload" crossorigin href="./assets/floating-outline-
|
|
204
|
+
<link rel="modulepreload" crossorigin href="./assets/radio-group-dnHLEMQN.js">
|
|
205
|
+
<link rel="modulepreload" crossorigin href="./assets/floating-outline-CRNblX2_.js">
|
|
206
206
|
<link rel="modulepreload" crossorigin href="./assets/objectWithoutPropertiesLoose-DaPAPabU.js">
|
|
207
207
|
<link rel="modulepreload" crossorigin href="./assets/esm-BmrwxxCo.js">
|
|
208
208
|
<link rel="modulepreload" crossorigin href="./assets/eye-off-n1Li95bE.js">
|
|
209
209
|
<link rel="modulepreload" crossorigin href="./assets/plus-BgB18UzY.js">
|
|
210
|
-
<link rel="modulepreload" crossorigin href="./assets/readonly-python-code-
|
|
210
|
+
<link rel="modulepreload" crossorigin href="./assets/readonly-python-code-B2nKkRm8.js">
|
|
211
211
|
<link rel="modulepreload" crossorigin href="./assets/file-headphone-BrQspHac.js">
|
|
212
212
|
<link rel="modulepreload" crossorigin href="./assets/file-BrdxGLRX.js">
|
|
213
213
|
<link rel="modulepreload" crossorigin href="./assets/image-DQHXdEQn.js">
|
|
214
|
-
<link rel="modulepreload" crossorigin href="./assets/file-icons-
|
|
214
|
+
<link rel="modulepreload" crossorigin href="./assets/file-icons-CJjHFZoa.js">
|
|
215
215
|
<link rel="modulepreload" crossorigin href="./assets/switch-BT9Ki10B.js">
|
|
216
216
|
<link rel="modulepreload" crossorigin href="./assets/events-BRAWQiYK.js">
|
|
217
217
|
<link rel="modulepreload" crossorigin href="./assets/globals-B64vMQ0L.js">
|
|
@@ -220,11 +220,11 @@
|
|
|
220
220
|
<link rel="modulepreload" crossorigin href="./assets/memoize-Tp7rARFe.js">
|
|
221
221
|
<link rel="modulepreload" crossorigin href="./assets/get-C-qh_et5.js">
|
|
222
222
|
<link rel="modulepreload" crossorigin href="./assets/_baseSet-CxV9N1bc.js">
|
|
223
|
-
<link rel="modulepreload" crossorigin href="./assets/state-
|
|
223
|
+
<link rel="modulepreload" crossorigin href="./assets/state-Qlb7fpYs.js">
|
|
224
224
|
<link rel="modulepreload" crossorigin href="./assets/label-xHqFtfdz.js">
|
|
225
|
-
<link rel="modulepreload" crossorigin href="./assets/textarea-
|
|
225
|
+
<link rel="modulepreload" crossorigin href="./assets/textarea-BIlunvBI.js">
|
|
226
226
|
<link rel="modulepreload" crossorigin href="./assets/refresh-ccw-C-n2VFP5.js">
|
|
227
|
-
<link rel="modulepreload" crossorigin href="./assets/form-
|
|
227
|
+
<link rel="modulepreload" crossorigin href="./assets/form-Zq0BEAeQ.js">
|
|
228
228
|
<link rel="modulepreload" crossorigin href="./assets/renderShortcut-D_8sQXCD.js">
|
|
229
229
|
<link rel="modulepreload" crossorigin href="./assets/field-CD7Io4xo.js">
|
|
230
230
|
<link rel="modulepreload" crossorigin href="./assets/RSPContexts-eRifaAal.js">
|
|
@@ -247,7 +247,7 @@
|
|
|
247
247
|
<link rel="stylesheet" crossorigin href="./assets/cells-jmgGt1lS.css">
|
|
248
248
|
<link rel="stylesheet" crossorigin href="./assets/markdown-renderer-DdDKmWlR.css">
|
|
249
249
|
<link rel="stylesheet" crossorigin href="./assets/JsonOutput-B7vuddcd.css">
|
|
250
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
250
|
+
<link rel="stylesheet" crossorigin href="./assets/index-DisN5cp_.css">
|
|
251
251
|
</head>
|
|
252
252
|
<body>
|
|
253
253
|
<div id="root"></div>
|
package/package.json
CHANGED
|
@@ -42,9 +42,19 @@ const ClipboardCellDataSchema = z.object({
|
|
|
42
42
|
version: z.literal("1.0"),
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
interface ClipboardCellInput {
|
|
46
|
+
code: string;
|
|
47
|
+
name?: string;
|
|
48
|
+
config?: CellConfig;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function toPlainText(cells: ClipboardCellInput[]): string {
|
|
52
|
+
return cells.map((cell) => cell.code).join("\n\n");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
async function writeCellsToClipboard(
|
|
56
|
+
cells: ClipboardCellInput[],
|
|
57
|
+
): Promise<void> {
|
|
48
58
|
const clipboardData: ClipboardCellData = {
|
|
49
59
|
cells: cells.map((cell) => ({
|
|
50
60
|
code: cell.code,
|
|
@@ -53,17 +63,9 @@ function buildClipboardPayload(
|
|
|
53
63
|
})),
|
|
54
64
|
version: "1.0",
|
|
55
65
|
};
|
|
56
|
-
const plainText = cells.map((cell) => cell.code).join("\n\n");
|
|
57
|
-
return { clipboardData, plainText };
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
async function writeCellsToClipboard(
|
|
61
|
-
clipboardData: ClipboardCellData,
|
|
62
|
-
plainText: string,
|
|
63
|
-
): Promise<void> {
|
|
64
66
|
const clipboardItem = new ClipboardItemBuilder()
|
|
65
67
|
.add(MARIMO_CELL_MIMETYPE, clipboardData)
|
|
66
|
-
.add("text/plain",
|
|
68
|
+
.add("text/plain", toPlainText(cells))
|
|
67
69
|
.build();
|
|
68
70
|
await navigator.clipboard.write([clipboardItem]);
|
|
69
71
|
}
|
|
@@ -80,14 +82,11 @@ export function useCellClipboard() {
|
|
|
80
82
|
.filter(Boolean);
|
|
81
83
|
|
|
82
84
|
if (cells.length === 0) {
|
|
83
|
-
// No cells to copy
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
86
87
|
|
|
87
|
-
const { clipboardData, plainText } = buildClipboardPayload(cells);
|
|
88
|
-
|
|
89
88
|
try {
|
|
90
|
-
await writeCellsToClipboard(
|
|
89
|
+
await writeCellsToClipboard(cells);
|
|
91
90
|
pendingCutActions.clear();
|
|
92
91
|
toastSuccess(cells.length);
|
|
93
92
|
} catch (error) {
|
|
@@ -95,7 +94,7 @@ export function useCellClipboard() {
|
|
|
95
94
|
|
|
96
95
|
// Fallback to simple text copy
|
|
97
96
|
try {
|
|
98
|
-
await copyToClipboard(
|
|
97
|
+
await copyToClipboard(toPlainText(cells));
|
|
99
98
|
pendingCutActions.clear();
|
|
100
99
|
toastSuccess(cells.length);
|
|
101
100
|
} catch {
|
|
@@ -110,21 +109,18 @@ export function useCellClipboard() {
|
|
|
110
109
|
const cells = validCellIds.map((cellId) => notebook.cellData[cellId]);
|
|
111
110
|
|
|
112
111
|
if (cells.length === 0) {
|
|
113
|
-
// No cells to cut
|
|
114
112
|
return;
|
|
115
113
|
}
|
|
116
114
|
|
|
117
|
-
const { clipboardData, plainText } = buildClipboardPayload(cells);
|
|
118
|
-
|
|
119
115
|
try {
|
|
120
|
-
await writeCellsToClipboard(
|
|
121
|
-
pendingCutActions.markForCut({ cellIds: validCellIds
|
|
116
|
+
await writeCellsToClipboard(cells);
|
|
117
|
+
pendingCutActions.markForCut({ cellIds: validCellIds });
|
|
122
118
|
} catch (error) {
|
|
123
119
|
Logger.error("Failed to cut cells to clipboard", error);
|
|
124
120
|
try {
|
|
125
|
-
await copyToClipboard(
|
|
121
|
+
await copyToClipboard(toPlainText(cells));
|
|
126
122
|
// Mark cells as pending cut instead of deleting immediately
|
|
127
|
-
pendingCutActions.markForCut({ cellIds: validCellIds
|
|
123
|
+
pendingCutActions.markForCut({ cellIds: validCellIds });
|
|
128
124
|
} catch {
|
|
129
125
|
toastError();
|
|
130
126
|
}
|
|
@@ -622,7 +622,7 @@ describe("cell reducer", () => {
|
|
|
622
622
|
before: false,
|
|
623
623
|
});
|
|
624
624
|
actions.createNewCell({
|
|
625
|
-
cellId: "1"
|
|
625
|
+
cellId: cellId("1"),
|
|
626
626
|
before: false,
|
|
627
627
|
});
|
|
628
628
|
expect(formatCells(state)).toMatchInlineSnapshot(`
|
|
@@ -637,8 +637,8 @@ describe("cell reducer", () => {
|
|
|
637
637
|
|
|
638
638
|
// Move first two cells after the third
|
|
639
639
|
actions.moveCellsRelativeTo({
|
|
640
|
-
cellIds: [firstCellId, "1"
|
|
641
|
-
targetCellId: "2"
|
|
640
|
+
cellIds: [firstCellId, cellId("1")],
|
|
641
|
+
targetCellId: cellId("2"),
|
|
642
642
|
position: "after",
|
|
643
643
|
});
|
|
644
644
|
expect(formatCells(state)).toMatchInlineSnapshot(`
|
|
@@ -658,7 +658,7 @@ describe("cell reducer", () => {
|
|
|
658
658
|
before: false,
|
|
659
659
|
});
|
|
660
660
|
actions.createNewCell({
|
|
661
|
-
cellId: "1"
|
|
661
|
+
cellId: cellId("1"),
|
|
662
662
|
before: false,
|
|
663
663
|
});
|
|
664
664
|
expect(formatCells(state)).toMatchInlineSnapshot(`
|
|
@@ -682,14 +682,14 @@ describe("cell reducer", () => {
|
|
|
682
682
|
{
|
|
683
683
|
columnId: col.id,
|
|
684
684
|
index: col.indexOfOrThrow(
|
|
685
|
-
"1"
|
|
685
|
+
cellId("1"),
|
|
686
686
|
) as import("@/utils/id-tree").CellIndex,
|
|
687
687
|
},
|
|
688
688
|
];
|
|
689
689
|
|
|
690
690
|
actions.moveCellsRelativeTo({
|
|
691
|
-
cellIds: [firstCellId, "1"
|
|
692
|
-
targetCellId: "2"
|
|
691
|
+
cellIds: [firstCellId, cellId("1")],
|
|
692
|
+
targetCellId: cellId("2"),
|
|
693
693
|
position: "after",
|
|
694
694
|
previousPlacements,
|
|
695
695
|
});
|
|
@@ -721,7 +721,7 @@ describe("cell reducer", () => {
|
|
|
721
721
|
before: false,
|
|
722
722
|
});
|
|
723
723
|
actions.createNewCell({
|
|
724
|
-
cellId: "1"
|
|
724
|
+
cellId: cellId("1"),
|
|
725
725
|
before: false,
|
|
726
726
|
});
|
|
727
727
|
|
|
@@ -736,14 +736,14 @@ describe("cell reducer", () => {
|
|
|
736
736
|
{
|
|
737
737
|
columnId: col.id,
|
|
738
738
|
index: col.indexOfOrThrow(
|
|
739
|
-
"1"
|
|
739
|
+
cellId("1"),
|
|
740
740
|
) as import("@/utils/id-tree").CellIndex,
|
|
741
741
|
},
|
|
742
742
|
];
|
|
743
743
|
|
|
744
744
|
actions.moveCellsRelativeTo({
|
|
745
|
-
cellIds: [firstCellId, "1"
|
|
746
|
-
targetCellId: "2"
|
|
745
|
+
cellIds: [firstCellId, cellId("1")],
|
|
746
|
+
targetCellId: cellId("2"),
|
|
747
747
|
position: "after",
|
|
748
748
|
previousPlacements,
|
|
749
749
|
});
|
|
@@ -757,7 +757,7 @@ describe("cell reducer", () => {
|
|
|
757
757
|
"
|
|
758
758
|
`);
|
|
759
759
|
|
|
760
|
-
actions.deleteCell({ cellId: "2"
|
|
760
|
+
actions.deleteCell({ cellId: cellId("2") });
|
|
761
761
|
expect(formatCells(state)).toMatchInlineSnapshot(`
|
|
762
762
|
"
|
|
763
763
|
[0] ''
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { act, renderHook } from "@testing-library/react";
|
|
4
4
|
import { createStore, Provider } from "jotai";
|
|
5
5
|
import { describe, expect, it } from "vitest";
|
|
6
|
+
import { cellId } from "@/__tests__/branded";
|
|
6
7
|
import type { CellId } from "@/core/cells/ids";
|
|
7
8
|
import {
|
|
8
9
|
pendingCutStateAtom,
|
|
@@ -20,15 +21,10 @@ function createTestWrapper() {
|
|
|
20
21
|
return { wrapper, store };
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
const mockClipboardData = {
|
|
24
|
-
cells: [{ code: "x = 1", name: "cell1" }],
|
|
25
|
-
version: "1.0" as const,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
24
|
describe("pending-cut-service", () => {
|
|
29
|
-
it("markForCut sets cellIds
|
|
25
|
+
it("markForCut sets cellIds", () => {
|
|
30
26
|
const { wrapper, store } = createTestWrapper();
|
|
31
|
-
const cellIds: CellId[] = ["cell-1"
|
|
27
|
+
const cellIds: CellId[] = [cellId("cell-1"), cellId("cell-2")];
|
|
32
28
|
|
|
33
29
|
const { result } = renderHook(
|
|
34
30
|
() => ({
|
|
@@ -39,20 +35,16 @@ describe("pending-cut-service", () => {
|
|
|
39
35
|
);
|
|
40
36
|
|
|
41
37
|
act(() => {
|
|
42
|
-
result.current.actions.markForCut({
|
|
43
|
-
cellIds,
|
|
44
|
-
clipboardData: mockClipboardData,
|
|
45
|
-
});
|
|
38
|
+
result.current.actions.markForCut({ cellIds });
|
|
46
39
|
});
|
|
47
40
|
|
|
48
41
|
const state = store.get(pendingCutStateAtom);
|
|
49
42
|
expect(state.cellIds).toEqual(new Set(cellIds));
|
|
50
|
-
expect(state.clipboardData).toEqual(mockClipboardData);
|
|
51
43
|
});
|
|
52
44
|
|
|
53
45
|
it("clear resets to initial state", () => {
|
|
54
46
|
const { wrapper, store } = createTestWrapper();
|
|
55
|
-
const cellIds: CellId[] = ["cell-1"
|
|
47
|
+
const cellIds: CellId[] = [cellId("cell-1")];
|
|
56
48
|
|
|
57
49
|
const { result } = renderHook(
|
|
58
50
|
() => ({
|
|
@@ -63,10 +55,7 @@ describe("pending-cut-service", () => {
|
|
|
63
55
|
);
|
|
64
56
|
|
|
65
57
|
act(() => {
|
|
66
|
-
result.current.actions.markForCut({
|
|
67
|
-
cellIds,
|
|
68
|
-
clipboardData: mockClipboardData,
|
|
69
|
-
});
|
|
58
|
+
result.current.actions.markForCut({ cellIds });
|
|
70
59
|
});
|
|
71
60
|
expect(store.get(pendingCutStateAtom).cellIds.size).toBe(1);
|
|
72
61
|
|
|
@@ -75,28 +64,24 @@ describe("pending-cut-service", () => {
|
|
|
75
64
|
});
|
|
76
65
|
const state = store.get(pendingCutStateAtom);
|
|
77
66
|
expect(state.cellIds.size).toBe(0);
|
|
78
|
-
expect(state.clipboardData).toBeNull();
|
|
79
67
|
});
|
|
80
68
|
|
|
81
69
|
it("useIsPendingCut returns true when cellId is marked for cut", () => {
|
|
82
70
|
const { wrapper } = createTestWrapper();
|
|
83
|
-
const
|
|
71
|
+
const targetCellId = cellId("cell-1");
|
|
84
72
|
|
|
85
73
|
const { result: actionsResult } = renderHook(() => usePendingCutActions(), {
|
|
86
74
|
wrapper,
|
|
87
75
|
});
|
|
88
76
|
const { result: isPendingResult } = renderHook(
|
|
89
|
-
() => useIsPendingCut(
|
|
77
|
+
() => useIsPendingCut(targetCellId),
|
|
90
78
|
{ wrapper },
|
|
91
79
|
);
|
|
92
80
|
|
|
93
81
|
expect(isPendingResult.current).toBe(false);
|
|
94
82
|
|
|
95
83
|
act(() => {
|
|
96
|
-
actionsResult.current.markForCut({
|
|
97
|
-
cellIds: [cellId],
|
|
98
|
-
clipboardData: mockClipboardData,
|
|
99
|
-
});
|
|
84
|
+
actionsResult.current.markForCut({ cellIds: [targetCellId] });
|
|
100
85
|
});
|
|
101
86
|
|
|
102
87
|
expect(isPendingResult.current).toBe(true);
|
|
@@ -104,19 +89,15 @@ describe("pending-cut-service", () => {
|
|
|
104
89
|
|
|
105
90
|
it("useIsPendingCut returns false when cellId is not marked for cut", () => {
|
|
106
91
|
const { wrapper } = createTestWrapper();
|
|
107
|
-
const { result } = renderHook(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
);
|
|
92
|
+
const { result } = renderHook(() => useIsPendingCut(cellId("other-cell")), {
|
|
93
|
+
wrapper,
|
|
94
|
+
});
|
|
111
95
|
|
|
112
96
|
const { result: actionsResult } = renderHook(() => usePendingCutActions(), {
|
|
113
97
|
wrapper,
|
|
114
98
|
});
|
|
115
99
|
act(() => {
|
|
116
|
-
actionsResult.current.markForCut({
|
|
117
|
-
cellIds: ["cell-1" as CellId],
|
|
118
|
-
clipboardData: mockClipboardData,
|
|
119
|
-
});
|
|
100
|
+
actionsResult.current.markForCut({ cellIds: [cellId("cell-1")] });
|
|
120
101
|
});
|
|
121
102
|
|
|
122
103
|
expect(result.current).toBe(false);
|
|
@@ -134,10 +115,7 @@ describe("pending-cut-service", () => {
|
|
|
134
115
|
expect(hasPendingResult.current).toBe(false);
|
|
135
116
|
|
|
136
117
|
act(() => {
|
|
137
|
-
actionsResult.current.markForCut({
|
|
138
|
-
cellIds: ["cell-1" as CellId],
|
|
139
|
-
clipboardData: mockClipboardData,
|
|
140
|
-
});
|
|
118
|
+
actionsResult.current.markForCut({ cellIds: [cellId("cell-1")] });
|
|
141
119
|
});
|
|
142
120
|
|
|
143
121
|
expect(hasPendingResult.current).toBe(true);
|
|
@@ -1,31 +1,24 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
3
|
import { atom, useAtomValue } from "jotai";
|
|
4
|
-
import type { ClipboardCellData } from "@/components/editor/navigation/clipboard";
|
|
5
4
|
import type { CellId } from "@/core/cells/ids";
|
|
6
5
|
import { createReducerAndAtoms } from "@/utils/createReducer";
|
|
7
6
|
|
|
8
7
|
interface PendingCutState {
|
|
9
8
|
cellIds: Set<CellId>;
|
|
10
|
-
clipboardData: ClipboardCellData | null;
|
|
11
9
|
}
|
|
12
10
|
|
|
13
11
|
const initialState = (): PendingCutState => ({
|
|
14
12
|
cellIds: new Set(),
|
|
15
|
-
clipboardData: null,
|
|
16
13
|
});
|
|
17
14
|
|
|
18
15
|
const {
|
|
19
16
|
valueAtom: pendingCutStateAtom,
|
|
20
17
|
useActions: usePendingCutActionsInternal,
|
|
21
18
|
} = createReducerAndAtoms(initialState, {
|
|
22
|
-
markForCut: (
|
|
23
|
-
_state,
|
|
24
|
-
action: { cellIds: CellId[]; clipboardData: ClipboardCellData },
|
|
25
|
-
) => {
|
|
19
|
+
markForCut: (_state, action: { cellIds: CellId[] }) => {
|
|
26
20
|
return {
|
|
27
21
|
cellIds: new Set(action.cellIds),
|
|
28
|
-
clipboardData: action.clipboardData,
|
|
29
22
|
};
|
|
30
23
|
},
|
|
31
24
|
clear: () => {
|
|
@@ -33,10 +26,8 @@ const {
|
|
|
33
26
|
},
|
|
34
27
|
});
|
|
35
28
|
|
|
36
|
-
// Re-export the state atom
|
|
37
29
|
export { pendingCutStateAtom };
|
|
38
30
|
|
|
39
|
-
// Derived atom just for cell IDs (for easier consumption)
|
|
40
31
|
export const pendingCutCellIdsAtom = atom(
|
|
41
32
|
(get) => get(pendingCutStateAtom).cellIds,
|
|
42
33
|
);
|
package/src/css/app/Cell.css
CHANGED
|
@@ -75,14 +75,11 @@
|
|
|
75
75
|
|
|
76
76
|
/* Styling for cells marked for cut */
|
|
77
77
|
&.pending-cut {
|
|
78
|
-
opacity: 0.6;
|
|
79
|
-
border-style: dashed;
|
|
80
|
-
border-color: var(--amber-7);
|
|
81
|
-
|
|
82
78
|
.output-area,
|
|
83
79
|
.cm-gutters,
|
|
84
80
|
.cm {
|
|
85
|
-
background-color: var(--
|
|
81
|
+
background-color: var(--gray-2);
|
|
82
|
+
opacity: 0.55;
|
|
86
83
|
}
|
|
87
84
|
}
|
|
88
85
|
|