@marimo-team/islands 0.20.5-dev76 → 0.20.5-dev79

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
@@ -70720,7 +70720,7 @@ Image URL: ${r.imageUrl}`)), contextToXml({
70720
70720
  return Logger.warn("Failed to get version from mount config"), null;
70721
70721
  }
70722
70722
  }
70723
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.20.5-dev76"), showCodeInRunModeAtom = atom(true);
70723
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.20.5-dev79"), showCodeInRunModeAtom = atom(true);
70724
70724
  atom(null);
70725
70725
  var import_compiler_runtime$89 = require_compiler_runtime();
70726
70726
  function useKeydownOnElement(e, r) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.20.5-dev76",
3
+ "version": "0.20.5-dev79",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -247,6 +247,27 @@ function applyVimCommands(vimCommands: VimCommand[]) {
247
247
  }
248
248
  }
249
249
 
250
+ type VimWithGlobalState = typeof Vim & {
251
+ getVimGlobalState_?: () => {
252
+ macroModeState?: {
253
+ isRecording: boolean;
254
+ isPlaying: boolean;
255
+ };
256
+ };
257
+ };
258
+
259
+ function isMacroActive() {
260
+ const getGlobalState = (Vim as VimWithGlobalState).getVimGlobalState_;
261
+ if (typeof getGlobalState !== "function") {
262
+ return false;
263
+ }
264
+ const macroModeState = getGlobalState()?.macroModeState;
265
+ if (!macroModeState) {
266
+ return false;
267
+ }
268
+ return Boolean(macroModeState.isRecording || macroModeState.isPlaying);
269
+ }
270
+
250
271
  class CodeMirrorVimSync {
251
272
  private instances = new Set<EditorView>();
252
273
  private isBroadcasting = false;
@@ -275,10 +296,13 @@ class CodeMirrorVimSync {
275
296
  return;
276
297
  }
277
298
  invariant("mode" in e, 'Expected event to have a "mode" property');
299
+ const skipBroadcast = isMacroActive();
278
300
  this.isBroadcasting = true;
279
301
  // We use onIdle to keep the focused editor snappy
280
302
  onIdle(() => {
281
- this.broadcastModeChange(instance, e.mode, e.subMode);
303
+ if (!skipBroadcast) {
304
+ this.broadcastModeChange(instance, e.mode, e.subMode);
305
+ }
282
306
  this.isBroadcasting = false;
283
307
  });
284
308
  });
@@ -338,9 +362,9 @@ class CodeMirrorVimSync {
338
362
  }
339
363
  break;
340
364
  case "insert":
341
- // Only enter insert mode if we're not already in it
365
+ // only enter insert mode if we're not already in it
342
366
  if (!vim.insertMode) {
343
- Vim.handleKey(cm, "i", "");
367
+ Vim.handleKey(cm, "i", "mapping");
344
368
  }
345
369
  break;
346
370
  case "visual":