@marimo-team/islands 0.19.3-dev32 → 0.19.3-dev34

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
@@ -56281,7 +56281,7 @@ Database schema: ${c}`), (_a3 = r2.aiFix) == null ? void 0 : _a3.setAiCompletion
56281
56281
  shouldFilter: false,
56282
56282
  children: [
56283
56283
  (0, import_jsx_runtime.jsx)(CommandInput, {
56284
- placeholder: "Search",
56284
+ placeholder: `Search among the top ${v.length} values`,
56285
56285
  autoFocus: true,
56286
56286
  onValueChange: (e3) => _(e3.trim())
56287
56287
  }),
@@ -101155,7 +101155,7 @@ Defaulting to \`null\`.`;
101155
101155
  return Logger.warn("Failed to get version from mount config"), null;
101156
101156
  }
101157
101157
  }
101158
- const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.3-dev32"), showCodeInRunModeAtom = atom(true);
101158
+ const marimoVersionAtom = atom(getVersionFromMountConfig() || "0.19.3-dev34"), showCodeInRunModeAtom = atom(true);
101159
101159
  atom(null);
101160
101160
  var VIRTUAL_FILE_REGEX = /\/@file\/([^\s"&'/]+)\.([\dA-Za-z]+)/g, VirtualFileTracker = class e {
101161
101161
  constructor() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.19.3-dev32",
3
+ "version": "0.19.3-dev34",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -593,7 +593,7 @@ const PopoverFilterByValues = <TData, TValue>({
593
593
  <>
594
594
  <Command className="text-sm outline-hidden" shouldFilter={false}>
595
595
  <CommandInput
596
- placeholder="Search"
596
+ placeholder={`Search among the top ${data.length} values`}
597
597
  autoFocus={true}
598
598
  onValueChange={(value) => setQuery(value.trim())}
599
599
  />
@@ -2,6 +2,7 @@
2
2
 
3
3
  import { useAtomValue } from "jotai";
4
4
  import { LoadingEllipsis } from "@/components/icons/loading-ellipsis";
5
+ import { Spinner } from "@/components/icons/spinner";
5
6
  import { Button } from "@/components/ui/button";
6
7
  import { DelayMount } from "@/components/utils/delay-mount";
7
8
  import {
@@ -10,24 +11,50 @@ import {
10
11
  isNotStartedAtom,
11
12
  } from "@/core/network/connection";
12
13
  import { useConnectToRuntime } from "@/core/runtime/config";
14
+ import { Banner } from "@/plugins/impl/common/error-banner";
13
15
  import { Tooltip } from "../../ui/tooltip";
14
16
  import { FloatingAlert } from "./floating-alert";
15
17
 
16
18
  const SHORT_DELAY_MS = 1000; // 1 second
19
+ const LONG_DELAY_MS = 5000; // 5 seconds
17
20
 
18
21
  export const ConnectingAlert: React.FC = () => {
19
22
  const isConnecting = useAtomValue(isConnectingAtom);
20
23
  const isClosed = useAtomValue(isClosedAtom);
21
24
 
22
25
  if (isConnecting) {
26
+ const subtleNotification = (
27
+ <Tooltip content="Connecting to a marimo runtime">
28
+ <div className="flex items-center">
29
+ <LoadingEllipsis size={5} className="text-yellow-500" />
30
+ </div>
31
+ </Tooltip>
32
+ );
33
+
34
+ const longNotification = (
35
+ <Banner
36
+ kind="info"
37
+ className="flex flex-col rounded py-2 px-4 animate-in slide-in-from-top w-fit"
38
+ >
39
+ <div className="flex flex-col gap-4 justify-between items-start text-muted-foreground text-base">
40
+ <div className="flex items-center gap-2">
41
+ <Spinner className="h-4 w-4" />
42
+ <p>Connecting to a marimo runtime ...</p>
43
+ </div>
44
+ </div>
45
+ </Banner>
46
+ );
47
+
48
+ // This waits for 1 second to show the subtle notification, then shows the long notification after 5 seconds.
23
49
  return (
24
50
  <DelayMount milliseconds={SHORT_DELAY_MS}>
25
- <div className="absolute top-4 m-0 flex items-center min-h-[28px] left-1/2 transform -translate-x-1/2 z-200 ">
26
- <Tooltip content="Connecting to a marimo runtime">
27
- <div className="flex items-center">
28
- <LoadingEllipsis size={5} className="text-yellow-500" />
29
- </div>
30
- </Tooltip>
51
+ <div className="m-0 flex items-center min-h-[28px] fixed top-5 left-1/2 transform -translate-x-1/2 z-200">
52
+ <DelayMount
53
+ milliseconds={LONG_DELAY_MS}
54
+ fallback={subtleNotification}
55
+ >
56
+ {longNotification}
57
+ </DelayMount>
31
58
  </div>
32
59
  </DelayMount>
33
60
  );
@@ -34,12 +34,6 @@ vi.mock("../connection", () => ({
34
34
  waitForConnectionOpen: vi.fn().mockResolvedValue(undefined),
35
35
  }));
36
36
 
37
- vi.mock("../../state/jotai", () => ({
38
- store: {
39
- get: vi.fn(() => true),
40
- },
41
- }));
42
-
43
37
  describe("createNetworkRequests", () => {
44
38
  let mockClient: any;
45
39
  let capturedCalls: Map<string, { hasParams: boolean; endpoint: string }>;
@@ -80,18 +74,6 @@ describe("createNetworkRequests", () => {
80
74
  });
81
75
 
82
76
  describe("special behavior", () => {
83
- it("sendRun should drop requests if not connected", async () => {
84
- const { store } = await import("../../state/jotai");
85
-
86
- vi.mocked(store.get).mockReturnValue(false);
87
-
88
- const requests = createNetworkRequests();
89
- const result = await requests.sendRun({} as any);
90
-
91
- expect(result).toBe(null);
92
- expect(mockClient.POST).not.toHaveBeenCalled();
93
- });
94
-
95
77
  it("exportAsHTML should set assetUrl in dev/test mode", async () => {
96
78
  const originalEnv = process.env.NODE_ENV;
97
79
  process.env.NODE_ENV = "development";
@@ -2,9 +2,8 @@
2
2
 
3
3
  import { once } from "lodash-es";
4
4
  import { getRuntimeManager } from "../runtime/config";
5
- import { store } from "../state/jotai";
6
5
  import { API, createClientWithRuntimeManager } from "./api";
7
- import { isConnectedAtom, waitForConnectionOpen } from "./connection";
6
+ import { waitForConnectionOpen } from "./connection";
8
7
  import type { EditRequests, RunRequests } from "./types";
9
8
 
10
9
  const { handleResponse, handleResponseReturnNull } = API;
@@ -105,11 +104,7 @@ export function createNetworkRequests(): EditRequests & RunRequests {
105
104
  .then(handleResponseReturnNull);
106
105
  },
107
106
  sendRun: async (request) => {
108
- // Rather than waiting, we just drop all sendRun requests if the connection is not open.
109
- // Otherwise we can get into a weird state of sending requests for cells that no longer exist.
110
- if (!store.get(isConnectedAtom)) {
111
- return null;
112
- }
107
+ await waitForConnectionOpen();
113
108
  return getClient()
114
109
  .POST("/api/kernel/run", {
115
110
  body: request,