@marimo-team/islands 0.24.1-dev3 → 0.24.1-dev31

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.
Files changed (72) hide show
  1. package/dist/{ConnectedDataExplorerComponent-BUC1MrsF.js → ConnectedDataExplorerComponent-yEsovh7C.js} +4 -4
  2. package/dist/arrays-Ct6XviUd.js +59 -0
  3. package/dist/{capabilities-BilXeZ7p.js → capabilities-DNKeBoT5.js} +1 -1
  4. package/dist/{chat-ui-ChBRy1iT.js → chat-ui-ChbH2I73.js} +3 -3
  5. package/dist/{common-BvTQu-LJ.js → common-ZoATHjIZ.js} +17 -11
  6. package/dist/{formats-Dz0QNUEa.js → formats-BZtMpeQe.js} +1 -1
  7. package/dist/{glide-data-editor-BI2i_IEE.js → glide-data-editor-aimC_hok.js} +3 -1
  8. package/dist/{html-to-image-BtNr4zrO.js → html-to-image-BzT-fb14.js} +2357 -2325
  9. package/dist/{input-BRE2a7Ay.js → input-CqV2ZPgL.js} +1 -1
  10. package/dist/{loader-DTnbNSVZ.js → loader-Chm6nOqy.js} +1 -1
  11. package/dist/main.js +1196 -1088
  12. package/dist/{once-Boutk_9X.js → once-D1_qYl2e.js} +1 -1
  13. package/dist/{process-output-Dch8KCi8.js → process-output-C8Q8G6-g.js} +1 -1
  14. package/dist/{react-vega-zyfTF9SY.js → react-vega-BE2Uv1cq.js} +1 -1
  15. package/dist/{reveal-component-qNkzuPp3.js → reveal-component-CBpmFHpU.js} +5 -5
  16. package/dist/{spec-BL1GSUUF.js → spec-DR1CyTOo.js} +2 -0
  17. package/dist/style.css +1 -1
  18. package/dist/{swiper-component-Cx0cRWLk.js → swiper-component-UYicacis.js} +1 -1
  19. package/dist/{useIframeCapabilities-CxuXXwjj.js → useIframeCapabilities-BbnoLKxG.js} +1 -1
  20. package/dist/{vega-component-CioKuDut.js → vega-component-xrHju6oo.js} +5 -5
  21. package/dist/{vega-embed-container-BRjjqRGz.js → vega-embed-container-B1tc-DoN.js} +2 -2
  22. package/dist/{vega-loader.browser-CGb-2Kwi.js → vega-loader.browser-VFQfHaoV.js} +1 -1
  23. package/package.json +1 -1
  24. package/src/components/app-config/optional-features.test.ts +78 -0
  25. package/src/components/app-config/optional-features.tsx +33 -6
  26. package/src/components/data-table/__tests__/column_formatting.test.ts +7 -0
  27. package/src/components/data-table/charts/__tests__/schemas.test.ts +17 -2
  28. package/src/components/data-table/charts/chart-spec/types.ts +2 -0
  29. package/src/components/data-table/column-formatting/feature.ts +1 -0
  30. package/src/components/data-table/column-formatting/types.ts +1 -0
  31. package/src/components/data-table/column-summary/chart-spec-model.tsx +1 -0
  32. package/src/components/data-table/column-summary/column-summary.tsx +1 -0
  33. package/src/components/data-table/columns.tsx +4 -3
  34. package/src/components/datasets/__tests__/icons.test.ts +10 -2
  35. package/src/components/datasets/icons.tsx +4 -0
  36. package/src/components/datasources/__tests__/components.test.tsx +14 -1
  37. package/src/components/datasources/datasources.tsx +2 -40
  38. package/src/components/editor/chrome/panels/components.tsx +35 -0
  39. package/src/components/editor/chrome/panels/file-explorer-panel.tsx +10 -0
  40. package/src/components/editor/chrome/panels/session-panel.tsx +12 -4
  41. package/src/components/editor/connections/__tests__/quick-add-data-sources.test.tsx +2 -0
  42. package/src/components/editor/connections/add-connection-dialog.tsx +5 -1
  43. package/src/components/editor/connections/quick-add-data-sources.tsx +11 -7
  44. package/src/components/editor/connections/storage/__tests__/__snapshots__/as-code.test.ts.snap +43 -0
  45. package/src/components/editor/connections/storage/__tests__/as-code.test.ts +127 -0
  46. package/src/components/editor/connections/storage/add-storage-form.tsx +11 -1
  47. package/src/components/editor/connections/storage/as-code.ts +30 -1
  48. package/src/components/editor/connections/storage/schemas.ts +63 -0
  49. package/src/core/codemirror/code-lens/__tests__/popover.test.ts +13 -0
  50. package/src/core/codemirror/code-lens/popover.tsx +11 -5
  51. package/src/core/codemirror/language/languages/sql/__tests__/renderers.test.tsx +15 -4
  52. package/src/core/codemirror/language/languages/sql/renderers.tsx +1 -0
  53. package/src/core/datasets/__tests__/data-source-discovery.test.ts +277 -0
  54. package/src/core/datasets/data-source-connections.ts +36 -0
  55. package/src/core/datasets/data-source-discovery.ts +92 -0
  56. package/src/core/kernel/messages.ts +1 -0
  57. package/src/core/websocket/useMarimoKernelConnection.tsx +11 -3
  58. package/src/hooks/useDataSourceDiscovery.ts +50 -9
  59. package/src/plugins/impl/MatrixPlugin.tsx +256 -35
  60. package/src/plugins/impl/__tests__/DataEditorPlugin.test.ts +13 -1
  61. package/src/plugins/impl/__tests__/MatrixPlugin.test.tsx +540 -3
  62. package/src/plugins/impl/data-editor/glide-data-editor.tsx +1 -0
  63. package/src/plugins/impl/data-editor/glide-utils.ts +1 -0
  64. package/src/plugins/impl/data-frames/__tests__/schema.test.ts +9 -1
  65. package/src/plugins/impl/data-frames/utils/__tests__/operators.test.ts +8 -0
  66. package/src/plugins/impl/data-frames/utils/operators.ts +1 -1
  67. package/src/plugins/impl/matplotlib/__tests__/matplotlib-renderer.test.ts +184 -24
  68. package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +40 -7
  69. package/src/plugins/impl/vega/__tests__/vega.test.ts +22 -4
  70. package/src/plugins/impl/vega/utils.ts +3 -0
  71. package/dist/arrays-C56grfjL.js +0 -55
  72. package/src/hooks/__tests__/useDataSourceDiscovery.test.ts +0 -80
@@ -3,7 +3,7 @@ import { c as useEventListener, h as cn, t as Button } from "./button-Dr2uAwhT.j
3
3
  import { t as require_react } from "./react-DhGsCS90.js";
4
4
  import { t as require_compiler_runtime } from "./compiler-runtime-DsR6imPN.js";
5
5
  import { t as require_jsx_runtime } from "./jsx-runtime-Dp_oQwaf.js";
6
- import { t as useIframeCapabilities } from "./useIframeCapabilities-CxuXXwjj.js";
6
+ import { t as useIframeCapabilities } from "./useIframeCapabilities-BbnoLKxG.js";
7
7
  var import_compiler_runtime = require_compiler_runtime(), import_react = /* @__PURE__ */ __toESM(require_react(), 1);
8
8
  function isObject$2(t2) {
9
9
  return typeof t2 == "object" && !!t2 && "constructor" in t2 && t2.constructor === Object;
@@ -1,7 +1,7 @@
1
1
  import { o as __toESM } from "./chunk-Bfp04NdC.js";
2
2
  import { t as require_react } from "./react-DhGsCS90.js";
3
3
  import { t as require_compiler_runtime } from "./compiler-runtime-DsR6imPN.js";
4
- import { t as getIframeCapabilities } from "./capabilities-BilXeZ7p.js";
4
+ import { t as getIframeCapabilities } from "./capabilities-DNKeBoT5.js";
5
5
  var import_compiler_runtime = require_compiler_runtime();
6
6
  require_react();
7
7
  function useIframeCapabilities() {
@@ -10,12 +10,12 @@ import { n as ErrorBanner } from "./error-banner-BwCLtmkH.js";
10
10
  import { t as Tooltip } from "./tooltip-BtUxZT5h.js";
11
11
  import { t as debounce_default } from "./debounce-D784bpms.js";
12
12
  import { A as useEvent_default, n as useTheme } from "./useTheme-BzEXeAR5.js";
13
- import { s as uniq } from "./arrays-C56grfjL.js";
13
+ import { c as uniq } from "./arrays-Ct6XviUd.js";
14
14
  import { t as Objects } from "./objects-UzwQd5gx.js";
15
- import { a as isValid, i as AlertTitle, n as Alert, t as arrow } from "./formats-Dz0QNUEa.js";
16
- import { A as getContainerWidth, n as formats } from "./vega-loader.browser-CGb-2Kwi.js";
17
- import { a as tooltipHandler, n as vegaLoadData } from "./loader-DTnbNSVZ.js";
18
- import { t as j } from "./react-vega-zyfTF9SY.js";
15
+ import { a as isValid, i as AlertTitle, n as Alert, t as arrow } from "./formats-BZtMpeQe.js";
16
+ import { A as getContainerWidth, n as formats } from "./vega-loader.browser-VFQfHaoV.js";
17
+ import { a as tooltipHandler, n as vegaLoadData } from "./loader-Chm6nOqy.js";
18
+ import { t as j } from "./react-vega-BE2Uv1cq.js";
19
19
  import "./defaultLocale-CMezyvMc.js";
20
20
  import "./defaultLocale-DMZFeDB8.js";
21
21
  import { t as useAsyncData } from "./useAsyncData-CDcbh-Qv.js";
@@ -2,8 +2,8 @@ import { o as __toESM } from "./chunk-Bfp04NdC.js";
2
2
  import { t as require_react } from "./react-DhGsCS90.js";
3
3
  import { t as require_compiler_runtime } from "./compiler-runtime-DsR6imPN.js";
4
4
  import { t as require_jsx_runtime } from "./jsx-runtime-Dp_oQwaf.js";
5
- import { A as getContainerWidth } from "./vega-loader.browser-CGb-2Kwi.js";
6
- import { n as q } from "./react-vega-zyfTF9SY.js";
5
+ import { A as getContainerWidth } from "./vega-loader.browser-VFQfHaoV.js";
6
+ import { n as q } from "./react-vega-BE2Uv1cq.js";
7
7
  import "./defaultLocale-CMezyvMc.js";
8
8
  import "./defaultLocale-DMZFeDB8.js";
9
9
  import { t as useVegaContainerRemeasure } from "./use-vega-container-remeasure-B7OD7yUY.js";
@@ -410,7 +410,7 @@ function getContainerWidth(o) {
410
410
  }
411
411
  }
412
412
  function getVegaFieldTypes(F) {
413
- return !F || Object.keys(F).length === 0 ? "auto" : Objects.mapValues(F, (o) => o === "date" || o === "time" ? "string" : o === "datetime" ? "date" : o);
413
+ return !F || Object.keys(F).length === 0 ? "auto" : Objects.mapValues(F, (o) => o === "geometry" || o === "date" || o === "time" ? "string" : o === "datetime" ? "date" : o);
414
414
  }
415
415
  var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13;
416
416
  function objectConverter(o) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marimo-team/islands",
3
- "version": "0.24.1-dev3",
3
+ "version": "0.24.1-dev31",
4
4
  "main": "dist/main.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",
@@ -0,0 +1,78 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import { describe, expect, it } from "vitest";
4
+ import { isPackageRequirementInstalled } from "./optional-features";
5
+
6
+ describe("isPackageRequirementInstalled", () => {
7
+ const installedPackages = [
8
+ { name: "mcp", version: "2.0.0" },
9
+ { name: "polars", version: "1.8.2" },
10
+ ];
11
+
12
+ it("requires the package to be installed", () => {
13
+ expect(
14
+ isPackageRequirementInstalled({ name: "missing" }, installedPackages),
15
+ ).toBe(false);
16
+ });
17
+
18
+ it("accepts an installed package without a minimum version", () => {
19
+ expect(
20
+ isPackageRequirementInstalled({ name: "polars" }, installedPackages),
21
+ ).toBe(true);
22
+ });
23
+
24
+ it("rejects an installed package below the minimum version", () => {
25
+ expect(
26
+ isPackageRequirementInstalled(
27
+ { name: "mcp", minVersion: "2.1.0" },
28
+ installedPackages,
29
+ ),
30
+ ).toBe(false);
31
+ });
32
+
33
+ it.each(["2.0.0rc1", "2.0.0.dev1", "2.0.0-beta1"])(
34
+ "rejects the prerelease version %s",
35
+ (version) => {
36
+ expect(
37
+ isPackageRequirementInstalled({ name: "mcp", minVersion: "2.0.0" }, [
38
+ { name: "mcp", version },
39
+ ]),
40
+ ).toBe(false);
41
+ },
42
+ );
43
+
44
+ it.each(["2.1.0rc1", "3.0.0rc1"])(
45
+ "accepts the later prerelease version %s",
46
+ (version) => {
47
+ expect(
48
+ isPackageRequirementInstalled({ name: "mcp", minVersion: "2.0.0" }, [
49
+ { name: "mcp", version },
50
+ ]),
51
+ ).toBe(true);
52
+ },
53
+ );
54
+
55
+ it("accepts an installed package at or above the minimum version", () => {
56
+ expect(
57
+ isPackageRequirementInstalled(
58
+ { name: "mcp", minVersion: "2.0.0" },
59
+ installedPackages,
60
+ ),
61
+ ).toBe(true);
62
+ expect(
63
+ isPackageRequirementInstalled(
64
+ { name: "mcp", minVersion: "1.9.0" },
65
+ installedPackages,
66
+ ),
67
+ ).toBe(true);
68
+ });
69
+
70
+ it("normalizes extras in the requirement name", () => {
71
+ expect(
72
+ isPackageRequirementInstalled(
73
+ { name: "polars[pyarrow]" },
74
+ installedPackages,
75
+ ),
76
+ ).toBe(true);
77
+ });
78
+ });
@@ -20,6 +20,7 @@ import { isWasm } from "@/core/wasm/utils";
20
20
  import { useAsyncData } from "@/hooks/useAsyncData";
21
21
  import { ErrorBanner } from "@/plugins/impl/common/error-banner";
22
22
  import { cn } from "@/utils/cn";
23
+ import { semverSort } from "@/utils/versions";
23
24
  import { SettingSubtitle } from "./common";
24
25
 
25
26
  interface Package {
@@ -27,6 +28,35 @@ interface Package {
27
28
  minVersion?: string;
28
29
  }
29
30
 
31
+ interface InstalledPackage {
32
+ name: string;
33
+ version: string;
34
+ }
35
+
36
+ const PEP_440_PRERELEASE =
37
+ /^((?:\d+!)?\d+(?:\.\d+)*)(?:[-_.]?(?:a|b|c|rc|alpha|beta|pre|preview|dev)\d*)/i;
38
+
39
+ export function isPackageRequirementInstalled(
40
+ requirement: Package,
41
+ installedPackages: InstalledPackage[],
42
+ ): boolean {
43
+ const packageName = requirement.name.split("[")[0];
44
+ const installedPackage = installedPackages.find(
45
+ (pkg) => pkg.name === packageName,
46
+ );
47
+ if (!installedPackage) {
48
+ return false;
49
+ }
50
+ if (!requirement.minVersion) {
51
+ return true;
52
+ }
53
+ const prerelease = installedPackage.version.match(PEP_440_PRERELEASE);
54
+ if (prerelease) {
55
+ return semverSort(prerelease[1], requirement.minVersion) > 0;
56
+ }
57
+ return semverSort(installedPackage.version, requirement.minVersion) >= 0;
58
+ }
59
+
30
60
  interface OptionalFeature {
31
61
  id: string;
32
62
  /**
@@ -77,8 +107,8 @@ const OPTIONAL_DEPENDENCIES: OptionalFeature[] = [
77
107
  },
78
108
  {
79
109
  id: "mcp",
80
- packagesRequired: [{ name: "mcp", minVersion: "1" }],
81
- additionalPackageInstalls: [{ name: "pydantic", minVersion: "2" }],
110
+ packagesRequired: [{ name: "mcp", minVersion: "2.0.0" }],
111
+ additionalPackageInstalls: [],
82
112
  description: "Connect to MCP servers",
83
113
  },
84
114
  {
@@ -123,9 +153,6 @@ export const OptionalFeatures: React.FC = () => {
123
153
  }
124
154
 
125
155
  const installedPackages = data?.packages || [];
126
- const installedPackageNames = new Set(
127
- installedPackages.map((pkg) => pkg.name),
128
- );
129
156
 
130
157
  return (
131
158
  <div className="flex-1 flex flex-col overflow-hidden gap-2">
@@ -149,7 +176,7 @@ export const OptionalFeatures: React.FC = () => {
149
176
  <TableBody>
150
177
  {OPTIONAL_DEPENDENCIES.map((dep) => {
151
178
  const isInstalled = dep.packagesRequired.every((pkg) =>
152
- installedPackageNames.has(pkg.name.split("[")[0]),
179
+ isPackageRequirementInstalled(pkg, installedPackages),
153
180
  );
154
181
  const packageSpec = dep.packagesRequired
155
182
  .map((pkg) => pkg.name)
@@ -5,6 +5,7 @@ import {
5
5
  prettyScientificNumber,
6
6
  } from "@/utils/numbers";
7
7
  import { applyFormat } from "../column-formatting/feature";
8
+ import { formatOptions } from "../column-formatting/types";
8
9
 
9
10
  const locale = "en-US";
10
11
 
@@ -128,3 +129,9 @@ describe("applyFormat", () => {
128
129
  ).toBe(123);
129
130
  });
130
131
  });
132
+
133
+ describe("formatOptions", () => {
134
+ it("has no geometry format options", () => {
135
+ expect(formatOptions.geometry).toEqual([]);
136
+ });
137
+ });
@@ -14,7 +14,7 @@ describe("ChartSchema", () => {
14
14
 
15
15
  it("normalizes an unrecognized axis column type", () => {
16
16
  const result = ChartSchema.parse({
17
- general: { xColumn: { field: "geom", type: "geometry" } },
17
+ general: { xColumn: { field: "geom", type: "bogus_type" } },
18
18
  });
19
19
 
20
20
  expect(result.general?.xColumn?.type).toBe("unknown");
@@ -24,7 +24,7 @@ describe("ChartSchema", () => {
24
24
  const result = ChartSchema.parse({
25
25
  tooltips: {
26
26
  auto: false,
27
- fields: [{ field: "geom", type: "geometry" }],
27
+ fields: [{ field: "geom", type: "bogus_type" }],
28
28
  },
29
29
  });
30
30
 
@@ -32,4 +32,19 @@ describe("ChartSchema", () => {
32
32
  { field: "geom", type: "unknown" },
33
33
  ]);
34
34
  });
35
+
36
+ it("keeps geometry axis and tooltip field types", () => {
37
+ const result = ChartSchema.parse({
38
+ general: { xColumn: { field: "geom", type: "geometry" } },
39
+ tooltips: {
40
+ auto: false,
41
+ fields: [{ field: "geom", type: "geometry" }],
42
+ },
43
+ });
44
+
45
+ expect(result.general?.xColumn?.type).toBe("geometry");
46
+ expect(result.tooltips?.fields).toEqual([
47
+ { field: "geom", type: "geometry" },
48
+ ]);
49
+ });
35
50
  });
@@ -29,6 +29,7 @@ export function convertDataTypeToVega(
29
29
  return "quantitative";
30
30
  case "string":
31
31
  case "boolean":
32
+ case "geometry":
32
33
  case "unknown":
33
34
  return "nominal";
34
35
  case "date":
@@ -51,6 +52,7 @@ export function convertDataTypeToSelectable(
51
52
  return "number";
52
53
  case "string":
53
54
  case "boolean":
55
+ case "geometry":
54
56
  case "unknown":
55
57
  return "string";
56
58
  case "date":
@@ -214,6 +214,7 @@ export const applyFormat = (
214
214
  return value;
215
215
  }
216
216
  case undefined:
217
+ case "geometry":
217
218
  case "unknown":
218
219
  return value;
219
220
  default:
@@ -13,6 +13,7 @@ export const formatOptions = {
13
13
  number: ["Auto", "Percent", "Scientific", "Engineering", "Integer"],
14
14
  string: ["Uppercase", "Lowercase", "Capitalize", "Title"],
15
15
  boolean: ["Yes/No", "On/Off"],
16
+ geometry: [],
16
17
  unknown: [],
17
18
  } as const satisfies Record<DataType, string[]>;
18
19
 
@@ -836,6 +836,7 @@ export class ColumnChartSpecModel<T> {
836
836
  transform: transforms,
837
837
  };
838
838
  }
839
+ case "geometry":
839
840
  case "unknown":
840
841
  return null;
841
842
  default:
@@ -155,6 +155,7 @@ export const TableColumnSummary = <TData, TValue>({
155
155
  );
156
156
  }
157
157
  return null;
158
+ case "geometry":
158
159
  case "unknown":
159
160
  return (
160
161
  <div className="flex flex-col whitespace-pre">
@@ -320,9 +320,8 @@ export function generateColumns<T>({
320
320
  },
321
321
  // Remove any default filtering
322
322
  filterFn: undefined,
323
- // Can only sort if key is defined
324
- // For example, unnamed index columns, won't be sortable
325
- enableSorting: !!key,
323
+ // Unnamed index columns and geometry columns are not sortable
324
+ enableSorting: !!key && getMeta(key).dataType !== "geometry",
326
325
  meta: {
327
326
  ...getMeta(key),
328
327
  width: columnWidths?.[key],
@@ -485,6 +484,8 @@ function getFilterTypeForFieldType(
485
484
  return "time";
486
485
  case "boolean":
487
486
  return "boolean";
487
+ case "geometry":
488
+ return undefined;
488
489
  default:
489
490
  return undefined;
490
491
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { describe, expect, it } from "vitest";
4
4
  import type { DataType } from "@/core/kernel/messages";
5
- import { DATA_TYPE_ICON, resolveDataType } from "../icons";
5
+ import { DATA_TYPE_ICON, getDataTypeColor, resolveDataType } from "../icons";
6
6
 
7
7
  describe("resolveDataType", () => {
8
8
  it("passes through every mapped data type", () => {
@@ -12,7 +12,15 @@ describe("resolveDataType", () => {
12
12
  });
13
13
 
14
14
  it("resolves unmapped data types to unknown", () => {
15
- expect(resolveDataType("geometry" as DataType)).toBe("unknown");
15
+ expect(resolveDataType("bogus_type" as DataType)).toBe("unknown");
16
+ });
17
+
18
+ it("resolves geometry with its icon and color", () => {
19
+ expect(resolveDataType("geometry")).toBe("geometry");
20
+ expect(DATA_TYPE_ICON.geometry).toBeDefined();
21
+ expect(getDataTypeColor("geometry")).toBe(
22
+ "bg-(--cyan-4) dark:bg-(--cyan-5)",
23
+ );
16
24
  });
17
25
 
18
26
  it("resolves data types shadowing Object.prototype keys to unknown", () => {
@@ -7,6 +7,7 @@ import {
7
7
  CurlyBracesIcon,
8
8
  HashIcon,
9
9
  type LucideIcon,
10
+ MapPinIcon,
10
11
  ToggleLeftIcon,
11
12
  TypeIcon,
12
13
  } from "lucide-react";
@@ -27,6 +28,7 @@ export const DATA_TYPE_ICON: Record<DataType | SelectableDataType, LucideIcon> =
27
28
  number: HashIcon,
28
29
  string: TypeIcon,
29
30
  integer: HashIcon,
31
+ geometry: MapPinIcon,
30
32
  unknown: CurlyBracesIcon,
31
33
  };
32
34
 
@@ -56,6 +58,8 @@ export function getDataTypeColor(
56
58
  return "bg-(--purple-4)";
57
59
  case "string":
58
60
  return "bg-(--blue-4)";
61
+ case "geometry":
62
+ return "bg-(--cyan-4) dark:bg-(--cyan-5)";
59
63
  case "unknown":
60
64
  return "bg-(--slate-4) dark:bg-(--slate-6)";
61
65
  default:
@@ -12,7 +12,7 @@ describe("ColumnName", () => {
12
12
 
13
13
  try {
14
14
  const unrecognized = render(
15
- <ColumnName columnName="geom" dataType={"geometry" as DataType} />,
15
+ <ColumnName columnName="geom" dataType={"bogus_type" as DataType} />,
16
16
  );
17
17
  const unknown = render(
18
18
  <ColumnName columnName="geom" dataType="unknown" />,
@@ -26,4 +26,17 @@ describe("ColumnName", () => {
26
26
  warn.mockRestore();
27
27
  }
28
28
  });
29
+
30
+ it("renders geometry with a distinct icon", () => {
31
+ const geometry = render(
32
+ <ColumnName columnName="geom" dataType="geometry" />,
33
+ );
34
+ const unknown = render(<ColumnName columnName="geom" dataType="unknown" />);
35
+
36
+ expect(geometry.container.querySelector(".lucide-map-pin")).not.toBeNull();
37
+ expect(unknown.container.querySelector(".lucide-braces")).not.toBeNull();
38
+ expect(geometry.container.innerHTML).not.toEqual(
39
+ unknown.container.innerHTML,
40
+ );
41
+ });
29
42
  });
@@ -21,15 +21,11 @@ import { cellIdsAtom, useCellActions } from "@/core/cells/cells";
21
21
  import { useLastFocusedCellId } from "@/core/cells/focus";
22
22
  import { autoInstantiateAtom } from "@/core/config/config";
23
23
  import {
24
- dataConnectionsMapAtom,
24
+ connectionsAtom,
25
25
  type SQLTableContext,
26
26
  useDataSourceActions,
27
27
  } from "@/core/datasets/data-source-connections";
28
- import {
29
- DEFAULT_DUCKDB_DATABASE,
30
- DUCKDB_ENGINE,
31
- INTERNAL_SQL_ENGINES,
32
- } from "@/core/datasets/engines";
28
+ import { DUCKDB_ENGINE } from "@/core/datasets/engines";
33
29
  import {
34
30
  PreviewSQLSchemaList,
35
31
  PreviewSQLTable,
@@ -224,40 +220,6 @@ export function filterEmptyDatabases(databases: Database[]): Database[] {
224
220
  return changed ? result : databases;
225
221
  }
226
222
 
227
- /**
228
- * This atom is used to get the data connections that are available to the user.
229
- * It filters out the internal engines if it has no databases or if it has only the in-memory database and no schemas.
230
- */
231
- export const connectionsAtom = atom((get) => {
232
- const dataConnections = new Map(get(dataConnectionsMapAtom));
233
-
234
- // Filter out the internal engines if it has no databases
235
- // Or if it has only the in-memory database and no schemas
236
- for (const engine of INTERNAL_SQL_ENGINES) {
237
- const connection = dataConnections.get(engine);
238
- if (!connection) {
239
- continue;
240
- }
241
-
242
- if (connection.databases.length === 0) {
243
- dataConnections.delete(engine);
244
- }
245
-
246
- if (
247
- connection.databases.length === 1 &&
248
- connection.databases[0].name === DEFAULT_DUCKDB_DATABASE &&
249
- connection.databases[0].schemas.length === 0
250
- ) {
251
- dataConnections.delete(engine);
252
- }
253
- }
254
-
255
- // Put internal engines last to prioritize user-defined connections
256
- return sortBy([...dataConnections.values()], (connection) =>
257
- INTERNAL_SQL_ENGINES.has(connection.name) ? 1 : 0,
258
- );
259
- });
260
-
261
223
  export const DataSources: React.FC = () => {
262
224
  const [searchValue, setSearchValue] = React.useState<string>("");
263
225
  const [hideEmpty, setHideEmpty] = useAtom(hideEmptyDatasourcesAtom);
@@ -8,6 +8,9 @@ import {
8
8
  } from "@/components/ui/accordion";
9
9
  import { Badge } from "@/components/ui/badge";
10
10
  import { cn } from "@/utils/cn";
11
+ import { SparklesIcon } from "lucide-react";
12
+ import { Tooltip } from "@/components/ui/tooltip";
13
+ import type { DataSourceDiscoveryGroup } from "@/core/datasets/data-source-discovery";
11
14
 
12
15
  /**
13
16
  * Styled AccordionItem for sidebar panels.
@@ -80,9 +83,41 @@ const PanelBadge = ({
80
83
  );
81
84
  PanelBadge.displayName = "PanelBadge";
82
85
 
86
+ const DiscoveredSourcesBadge = ({
87
+ count,
88
+ type,
89
+ }: {
90
+ count: number;
91
+ type: DataSourceDiscoveryGroup;
92
+ }) => {
93
+ if (count === 0) {
94
+ return null;
95
+ }
96
+
97
+ let noun: string;
98
+ if (type === "database") {
99
+ noun = count === 1 ? "database" : "databases";
100
+ } else {
101
+ noun = count === 1 ? "remote storage" : "remote storages";
102
+ }
103
+ const content = `${count} ${noun} detected in your environment, ready to quick-add`;
104
+
105
+ return (
106
+ <Tooltip content={content}>
107
+ <span>
108
+ <PanelBadge className="gap-0.5 border-(--blue-6) bg-(--blue-3) text-(--blue-11)">
109
+ <SparklesIcon className="h-2.5 w-2.5" />
110
+ {count}
111
+ </PanelBadge>
112
+ </span>
113
+ </Tooltip>
114
+ );
115
+ };
116
+
83
117
  export {
84
118
  PanelAccordionItem,
85
119
  PanelAccordionTrigger,
86
120
  PanelAccordionContent,
87
121
  PanelBadge,
122
+ DiscoveredSourcesBadge,
88
123
  };
@@ -7,11 +7,13 @@ import useResizeObserver from "use-resize-observer";
7
7
  import { StorageInspector } from "@/components/storage/storage-inspector";
8
8
  import { Accordion } from "@/components/ui/accordion";
9
9
  import { storageNamespacesAtom } from "@/core/storage/state";
10
+ import { useDetectedDataSources } from "@/hooks/useDataSourceDiscovery";
10
11
  import { cn } from "@/utils/cn";
11
12
  import { TreeDndProvider } from "../../file-tree/dnd-wrapper";
12
13
  import { FileExplorer } from "../../file-tree/file-explorer";
13
14
  import { useFileExplorerUpload } from "../../file-tree/upload";
14
15
  import {
16
+ DiscoveredSourcesBadge,
15
17
  PanelAccordionContent,
16
18
  PanelAccordionItem,
17
19
  PanelAccordionTrigger,
@@ -58,6 +60,7 @@ const FileExplorerPanel: React.FC = () => {
58
60
 
59
61
  const storageNamespaces = useAtomValue(storageNamespacesAtom);
60
62
  const remoteStorageConnections = storageNamespaces.length;
63
+ const pendingDataSources = useDetectedDataSources("storage");
61
64
 
62
65
  const openSections = useMemo<FileExplorerPanelSection[]>(() => {
63
66
  if (!state.hasUserInteracted && remoteStorageConnections > 0) {
@@ -81,6 +84,7 @@ const FileExplorerPanel: React.FC = () => {
81
84
 
82
85
  const availableContent = panelHeight - TRIGGER_HEIGHT * 2;
83
86
  const storageIsOpen = openSections.includes("remote-storage");
87
+ const showDiscoveredStorageBadge = pendingDataSources.length > 0;
84
88
  const bothOpen = storageIsOpen && openSections.includes("files");
85
89
 
86
90
  const storageMaxHeight = bothOpen
@@ -104,6 +108,12 @@ const FileExplorerPanel: React.FC = () => {
104
108
  {remoteStorageConnections > 0 && (
105
109
  <PanelBadge>{remoteStorageConnections}</PanelBadge>
106
110
  )}
111
+ {showDiscoveredStorageBadge && (
112
+ <DiscoveredSourcesBadge
113
+ count={pendingDataSources.length}
114
+ type="storage"
115
+ />
116
+ )}
107
117
  </PanelAccordionTrigger>
108
118
  <PanelAccordionContent
109
119
  className="overflow-auto"
@@ -3,16 +3,16 @@
3
3
  import { useAtom, useAtomValue } from "jotai";
4
4
  import { DatabaseIcon, VariableIcon } from "lucide-react";
5
5
  import React, { useCallback } from "react";
6
- import {
7
- connectionsAtom,
8
- DataSources,
9
- } from "@/components/datasources/datasources";
6
+ import { DataSources } from "@/components/datasources/datasources";
10
7
  import { Accordion } from "@/components/ui/accordion";
11
8
  import { VariableTable } from "@/components/variables/variables-table";
12
9
  import { useCellIds } from "@/core/cells/cells";
10
+ import { connectionsAtom } from "@/core/datasets/data-source-connections";
13
11
  import { datasetTablesAtom } from "@/core/datasets/state";
14
12
  import { useVariables } from "@/core/variables/state";
13
+ import { useDetectedDataSources } from "@/hooks/useDataSourceDiscovery";
15
14
  import {
15
+ DiscoveredSourcesBadge,
16
16
  PanelAccordionContent,
17
17
  PanelAccordionItem,
18
18
  PanelAccordionTrigger,
@@ -28,6 +28,7 @@ const SessionPanel: React.FC = () => {
28
28
  const cellIds = useCellIds();
29
29
  const tables = useAtomValue(datasetTablesAtom);
30
30
  const dataConnections = useAtomValue(connectionsAtom);
31
+ const pendingDataSources = useDetectedDataSources("database");
31
32
  const [state, setState] = useAtom(sessionPanelAtom);
32
33
 
33
34
  const datasourcesCount = tables.length + dataConnections.length;
@@ -50,6 +51,7 @@ const SessionPanel: React.FC = () => {
50
51
 
51
52
  const isDatasourcesOpen = openSections.includes("datasources");
52
53
  const showDatasourcesBadge = !isDatasourcesOpen && datasourcesCount > 0;
54
+ const showDiscoveredDataSourcesBadge = pendingDataSources.length > 0;
53
55
 
54
56
  return (
55
57
  <Accordion
@@ -63,6 +65,12 @@ const SessionPanel: React.FC = () => {
63
65
  <DatabaseIcon className="w-4 h-4" />
64
66
  Data sources
65
67
  {showDatasourcesBadge && <PanelBadge>{datasourcesCount}</PanelBadge>}
68
+ {showDiscoveredDataSourcesBadge && (
69
+ <DiscoveredSourcesBadge
70
+ count={pendingDataSources.length}
71
+ type="database"
72
+ />
73
+ )}
66
74
  </PanelAccordionTrigger>
67
75
  <PanelAccordionContent>
68
76
  <DataSources />
@@ -28,6 +28,7 @@ const sources: DetectedDataSource[] = [
28
28
  },
29
29
  ],
30
30
  code: "engine = create_engine()",
31
+ hidesWhen: { kind: "dialect", substrings: ["postgres"] },
31
32
  },
32
33
  {
33
34
  id: "pyiceberg-prod",
@@ -52,6 +53,7 @@ const sources: DetectedDataSource[] = [
52
53
  },
53
54
  ],
54
55
  code: 'catalog = load_catalog("prod")',
56
+ hidesWhen: { kind: "dialect", substrings: ["iceberg"] },
55
57
  },
56
58
  ];
57
59
 
@@ -87,7 +87,11 @@ export const AddConnectionDialogContent: React.FC<{
87
87
  <span className="block">{codeSnippetHint}</span>
88
88
  </DialogDescription>
89
89
  </DialogHeader>
90
- <AutoDiscoveredDataSources onSubmit={onClose} className="-mt-2" />
90
+ <AutoDiscoveredDataSources
91
+ onSubmit={onClose}
92
+ className="-mt-2"
93
+ group={activeTab === "storage" ? "storage" : "database"}
94
+ />
91
95
  <Tabs
92
96
  value={activeTab}
93
97
  onValueChange={(v) => setActiveTab(v as ConnectionTab)}