@marimo-team/islands 0.23.2-dev12 → 0.23.2-dev13
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
CHANGED
|
@@ -68770,7 +68770,7 @@ ${c}
|
|
|
68770
68770
|
return Logger.warn("Failed to get version from mount config"), null;
|
|
68771
68771
|
}
|
|
68772
68772
|
}
|
|
68773
|
-
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.23.2-
|
|
68773
|
+
const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.23.2-dev13"), showCodeInRunModeAtom = atom(true);
|
|
68774
68774
|
atom(null);
|
|
68775
68775
|
var VIRTUAL_FILE_REGEX = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, VirtualFileTracker = class e {
|
|
68776
68776
|
constructor() {
|
package/package.json
CHANGED
|
@@ -9,9 +9,7 @@ exports[`snapshot all duplicate keymaps > default keymaps 2`] = `
|
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
"key": "ArrowDown",
|
|
12
|
-
"preventDefault": true,
|
|
13
12
|
"run": "run",
|
|
14
|
-
"stopPropagation": true,
|
|
15
13
|
},
|
|
16
14
|
{
|
|
17
15
|
"key": "ArrowDown",
|
|
@@ -27,9 +25,7 @@ exports[`snapshot all duplicate keymaps > default keymaps 2`] = `
|
|
|
27
25
|
},
|
|
28
26
|
{
|
|
29
27
|
"key": "ArrowUp",
|
|
30
|
-
"preventDefault": true,
|
|
31
28
|
"run": "run",
|
|
32
|
-
"stopPropagation": true,
|
|
33
29
|
},
|
|
34
30
|
{
|
|
35
31
|
"key": "ArrowUp",
|
|
@@ -118,15 +114,12 @@ exports[`snapshot all duplicate keymaps > vim keymaps 2`] = `
|
|
|
118
114
|
},
|
|
119
115
|
{
|
|
120
116
|
"key": "ArrowDown",
|
|
121
|
-
"preventDefault": true,
|
|
122
117
|
"run": "run",
|
|
123
|
-
"stopPropagation": true,
|
|
124
118
|
},
|
|
125
119
|
{
|
|
126
120
|
"key": "ArrowDown",
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
"shift": "selectLineDown",
|
|
121
|
+
"run": "<no name>",
|
|
122
|
+
"shift": "<no name>",
|
|
130
123
|
},
|
|
131
124
|
],
|
|
132
125
|
"ArrowUp": [
|
|
@@ -136,15 +129,12 @@ exports[`snapshot all duplicate keymaps > vim keymaps 2`] = `
|
|
|
136
129
|
},
|
|
137
130
|
{
|
|
138
131
|
"key": "ArrowUp",
|
|
139
|
-
"preventDefault": true,
|
|
140
132
|
"run": "run",
|
|
141
|
-
"stopPropagation": true,
|
|
142
133
|
},
|
|
143
134
|
{
|
|
144
135
|
"key": "ArrowUp",
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"shift": "selectLineUp",
|
|
136
|
+
"run": "<no name>",
|
|
137
|
+
"shift": "<no name>",
|
|
148
138
|
},
|
|
149
139
|
],
|
|
150
140
|
"Backspace": [
|
|
@@ -169,8 +169,6 @@ function cellKeymaps({
|
|
|
169
169
|
},
|
|
170
170
|
{
|
|
171
171
|
key: "ArrowUp",
|
|
172
|
-
preventDefault: true,
|
|
173
|
-
stopPropagation: true,
|
|
174
172
|
run: (ev) => {
|
|
175
173
|
// Skip if we are in the middle of an autocompletion
|
|
176
174
|
const hasAutocomplete = completionStatus(ev.state);
|
|
@@ -188,8 +186,6 @@ function cellKeymaps({
|
|
|
188
186
|
},
|
|
189
187
|
{
|
|
190
188
|
key: "ArrowDown",
|
|
191
|
-
preventDefault: true,
|
|
192
|
-
stopPropagation: true,
|
|
193
189
|
run: (ev) => {
|
|
194
190
|
// Skip if we are in the middle of an autocompletion
|
|
195
191
|
const hasAutocomplete = completionStatus(ev.state);
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
|
+
cursorCharLeft,
|
|
5
|
+
cursorCharRight,
|
|
6
|
+
cursorLineDown,
|
|
7
|
+
cursorLineUp,
|
|
4
8
|
insertNewlineAndIndent,
|
|
5
9
|
defaultKeymap as originalDefaultKeymap,
|
|
10
|
+
selectCharLeft,
|
|
11
|
+
selectCharRight,
|
|
12
|
+
selectLineDown,
|
|
13
|
+
selectLineUp,
|
|
6
14
|
toggleBlockComment,
|
|
7
15
|
toggleComment,
|
|
8
16
|
} from "@codemirror/commands";
|
|
@@ -13,7 +21,7 @@ import {
|
|
|
13
21
|
type KeyBinding,
|
|
14
22
|
keymap,
|
|
15
23
|
} from "@codemirror/view";
|
|
16
|
-
import { getCM, vim } from "@replit/codemirror-vim";
|
|
24
|
+
import { type CodeMirror, getCM, vim } from "@replit/codemirror-vim";
|
|
17
25
|
import type { KeymapConfig } from "@/core/config/config-schema";
|
|
18
26
|
import type { HotkeyProvider } from "@/core/hotkeys/hotkeys";
|
|
19
27
|
import { logNever } from "@/utils/assertNever";
|
|
@@ -62,6 +70,12 @@ export function keymapBundle(
|
|
|
62
70
|
},
|
|
63
71
|
),
|
|
64
72
|
),
|
|
73
|
+
// Arrow keys: use CodeMirror's cursor movement except in vim visual
|
|
74
|
+
// mode, where vim must handle them to maintain selection.
|
|
75
|
+
// The original cursorLineUp/Down bindings from the default keymap are
|
|
76
|
+
// filtered out (see defaultVimKeymap) because their preventDefault
|
|
77
|
+
// flag blocks vim's handler even when their run function returns false.
|
|
78
|
+
keymap.of(vimVisualModeArrowKeyBindings()),
|
|
65
79
|
// Base vim mode
|
|
66
80
|
vim({ status: false }),
|
|
67
81
|
// Custom vim keymaps for cell navigation
|
|
@@ -101,12 +115,22 @@ const overrideKeymap = (keymap: HotkeyProvider): readonly KeyBinding[] => {
|
|
|
101
115
|
};
|
|
102
116
|
|
|
103
117
|
const defaultVimKeymap = once(() => {
|
|
104
|
-
const toRemove = new Set([
|
|
118
|
+
const toRemove = new Set([
|
|
119
|
+
"Enter",
|
|
120
|
+
"Ctrl-v",
|
|
121
|
+
"ArrowUp",
|
|
122
|
+
"ArrowDown",
|
|
123
|
+
"ArrowLeft",
|
|
124
|
+
"ArrowRight",
|
|
125
|
+
]);
|
|
105
126
|
// Remove conflicting keys from the keymap
|
|
106
127
|
// Enter (<CR>) adds a new line
|
|
107
128
|
// - it should just go to the next line
|
|
108
129
|
// Ctrl-v goes to the bottom of the cell
|
|
109
130
|
// - should enter blockwise visual mode
|
|
131
|
+
// ArrowUp/ArrowDown (cursorLineUp/Down) always handle the event and have
|
|
132
|
+
// preventDefault, which blocks vim's handler from processing arrow keys.
|
|
133
|
+
// Replaced with visual-mode-aware wrappers in keymapBundle.
|
|
110
134
|
return defaultKeymap().filter(
|
|
111
135
|
(k) => !toRemove.has(k.key || k.mac || k.linux || k.win || ""),
|
|
112
136
|
);
|
|
@@ -155,6 +179,49 @@ function doubleCharacterListener(
|
|
|
155
179
|
]);
|
|
156
180
|
}
|
|
157
181
|
|
|
182
|
+
function isInVimVisualMode(cm: CodeMirror | undefined | null): boolean {
|
|
183
|
+
return cm?.state.vim?.visualMode === true;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* In vim visual mode, arrow keys must be handled by vim to maintain selection.
|
|
188
|
+
* Wrap each arrow key's run and shift so they defer to vim in visual mode,
|
|
189
|
+
* but use CodeMirror's cursor commands in all other modes.
|
|
190
|
+
*/
|
|
191
|
+
function vimVisualModeArrowKeyBindings(): KeyBinding[] {
|
|
192
|
+
const wrap =
|
|
193
|
+
(cmd: Command): Command =>
|
|
194
|
+
(view) => {
|
|
195
|
+
if (isInVimVisualMode(getCM(view))) {
|
|
196
|
+
return false;
|
|
197
|
+
}
|
|
198
|
+
return cmd(view);
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
return [
|
|
202
|
+
{
|
|
203
|
+
key: "ArrowDown",
|
|
204
|
+
run: wrap(cursorLineDown),
|
|
205
|
+
shift: wrap(selectLineDown),
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
key: "ArrowUp",
|
|
209
|
+
run: wrap(cursorLineUp),
|
|
210
|
+
shift: wrap(selectLineUp),
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
key: "ArrowLeft",
|
|
214
|
+
run: wrap(cursorCharLeft),
|
|
215
|
+
shift: wrap(selectCharLeft),
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
key: "ArrowRight",
|
|
219
|
+
run: wrap(cursorCharRight),
|
|
220
|
+
shift: wrap(selectCharRight),
|
|
221
|
+
},
|
|
222
|
+
];
|
|
223
|
+
}
|
|
224
|
+
|
|
158
225
|
export const visibleForTesting = {
|
|
159
226
|
defaultKeymap,
|
|
160
227
|
defaultVimKeymap,
|