@marimo-team/islands 0.21.2-dev33 → 0.21.2-dev36

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
@@ -70858,7 +70858,7 @@ Image URL: ${r.imageUrl}`)), contextToXml({
70858
70858
  return Logger.warn("Failed to get version from mount config"), null;
70859
70859
  }
70860
70860
  }
70861
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.21.2-dev33"), showCodeInRunModeAtom = atom(true);
70861
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.21.2-dev36"), showCodeInRunModeAtom = atom(true);
70862
70862
  atom(null);
70863
70863
  var import_compiler_runtime$89 = require_compiler_runtime();
70864
70864
  function useKeydownOnElement(e, r) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.21.2-dev33",
3
+ "version": "0.21.2-dev36",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -1,44 +1,24 @@
1
1
  /* Copyright 2026 Marimo. All rights reserved. */
2
2
 
3
- import { EditorState } from "@codemirror/state";
4
- import { EditorView } from "@codemirror/view";
5
- import { describe, expect, it, vi } from "vitest";
6
- import { completionKeymap } from "../keymap";
3
+ import { completionKeymap as defaultCompletionKeymap } from "@codemirror/autocomplete";
4
+ import { describe, expect, it } from "vitest";
5
+ import { filterCompletionBindings } from "../keymap";
7
6
 
8
7
  describe("completionKeymap", () => {
9
- it("should propagate Escape key when completion is pending", () => {
10
- const state = EditorState.create({
11
- extensions: [completionKeymap()],
12
- });
13
- const view = new EditorView({ state });
14
-
15
- // Mock completionStatus to return "pending"
16
- vi.spyOn(view.state, "field").mockReturnValue("pending");
17
-
18
- view.dispatch({ changes: [], effects: [], annotations: [] });
19
- const result = false; // Mock the expected result
20
-
21
- // Should return false to propagate the Escape key
22
- expect(result).toBe(false);
23
-
24
- view.destroy();
8
+ it("upstream includes the macOS-only completion bindings we care about", () => {
9
+ expect(
10
+ defaultCompletionKeymap.some((binding) => binding.mac === "Alt-`"),
11
+ ).toBe(true);
12
+ expect(
13
+ defaultCompletionKeymap.some((binding) => binding.mac === "Alt-i"),
14
+ ).toBe(true);
25
15
  });
26
16
 
27
- it("should not propagate Escape key when completion is active", () => {
28
- const state = EditorState.create({
29
- extensions: [completionKeymap()],
30
- });
31
- const view = new EditorView({ state });
32
-
33
- // Mock completionStatus to return "active"
34
- vi.spyOn(view.state, "field").mockReturnValue("active");
35
-
36
- view.dispatch({ changes: [], effects: [], annotations: [] });
37
- const result = true; // Mock the expected result
38
-
39
- // Should return true to stop propagation
40
- expect(result).toBe(true);
17
+ it("removes Alt-backtick and Escape while keeping Alt-i", () => {
18
+ const filtered = filterCompletionBindings(defaultCompletionKeymap);
41
19
 
42
- view.destroy();
20
+ expect(filtered.some((binding) => binding.mac === "Alt-`")).toBe(false);
21
+ expect(filtered.some((binding) => binding.key === "Escape")).toBe(false);
22
+ expect(filtered.some((binding) => binding.mac === "Alt-i")).toBe(true);
43
23
  });
44
24
  });
@@ -6,7 +6,7 @@ import {
6
6
  moveCompletionSelection,
7
7
  } from "@codemirror/autocomplete";
8
8
  import { type Extension, Prec } from "@codemirror/state";
9
- import { keymap } from "@codemirror/view";
9
+ import { type KeyBinding, keymap } from "@codemirror/view";
10
10
  import { isInVimMode } from "../utils";
11
11
 
12
12
  const KEYS_TO_REMOVE = new Set<string | undefined>([
@@ -22,10 +22,20 @@ const KEYS_TO_REMOVE = new Set<string | undefined>([
22
22
  "Alt-`",
23
23
  ]);
24
24
 
25
- export function completionKeymap(): Extension {
26
- const withoutKeysToRemove = defaultCompletionKeymap.filter(
27
- (binding) => !KEYS_TO_REMOVE.has(binding.key),
25
+ function hasRemovedKeybinding(binding: KeyBinding): boolean {
26
+ return [binding.key, binding.mac, binding.linux, binding.win].some((key) =>
27
+ KEYS_TO_REMOVE.has(key),
28
28
  );
29
+ }
30
+
31
+ export function filterCompletionBindings(
32
+ bindings: readonly KeyBinding[],
33
+ ): readonly KeyBinding[] {
34
+ return bindings.filter((binding) => !hasRemovedKeybinding(binding));
35
+ }
36
+
37
+ export function completionKeymap(): Extension {
38
+ const withoutKeysToRemove = filterCompletionBindings(defaultCompletionKeymap);
29
39
 
30
40
  return Prec.highest(
31
41
  keymap.of([