@marimo-team/islands 0.23.12-dev2 → 0.23.12-dev21

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 (106) hide show
  1. package/dist/{ConnectedDataExplorerComponent-WqG-xX4l.js → ConnectedDataExplorerComponent-Du3_nUzI.js} +13 -13
  2. package/dist/{ErrorBoundary-BNx_OSVo.js → ErrorBoundary-DE6tzZf-.js} +2 -2
  3. package/dist/{any-language-editor-rPSlOll9.js → any-language-editor-DN1R-1KZ.js} +5 -5
  4. package/dist/{button-vQhauTmO.js → button-BacYv-bE.js} +7 -1
  5. package/dist/{capabilities-BEHzIS99.js → capabilities-D_4LYhSU.js} +1 -1
  6. package/dist/{chat-ui-k2kqhCv5.js → chat-ui-CsPewo4h.js} +16 -16
  7. package/dist/{check-nrzHDi45.js → check-C9OoNtR4.js} +1 -1
  8. package/dist/{code-visibility-DZ_6U5hT.js → code-visibility-DBnAQPtB.js} +664 -663
  9. package/dist/{copy-UhDed7D4.js → copy-COam1EG7.js} +2 -2
  10. package/dist/{dist-DYGLrbYQ.js → dist--2Bqjvs0.js} +2 -2
  11. package/dist/{error-banner-BHAkVFc2.js → error-banner-DFPfz_Qf.js} +2 -2
  12. package/dist/{esm-Bqu9AE2K.js → esm-M837UxV5.js} +1 -1
  13. package/dist/{extends-9Yl5BEcg.js → extends-9MVIxxRo.js} +4 -4
  14. package/dist/{formats-BV4bOfMI.js → formats-d6MhLuQ9.js} +4 -4
  15. package/dist/{glide-data-editor-BDTq6YUb.js → glide-data-editor-DkzAInWG.js} +9 -9
  16. package/dist/{html-to-image-C86pQALH.js → html-to-image-DXwLcQ6l.js} +95 -88
  17. package/dist/{input-AKkGXdyV.js → input-CbEz_aj_.js} +6 -6
  18. package/dist/{label-E3ZJXHu8.js → label-WfTSU8L4.js} +2 -2
  19. package/dist/{loader-YPuQvn1Y.js → loader-Boph2xIS.js} +1 -1
  20. package/dist/main.js +1753 -1626
  21. package/dist/{mermaid-QFAR9YgY.js → mermaid-CJW9vIyO.js} +5 -5
  22. package/dist/{process-output-nNw4OpSj.js → process-output-C6_e1pT_.js} +3 -3
  23. package/dist/{reveal-component-BxDb5eK0.js → reveal-component-DIzKQ1NS.js} +11 -11
  24. package/dist/{spec-B45_YCNI.js → spec-Bv-XlYiv.js} +4 -4
  25. package/dist/{strings-Cq2s9_EQ.js → strings-Dq_j3Rxw.js} +4 -4
  26. package/dist/style.css +2 -2
  27. package/dist/{swiper-component-BNa_4kh2.js → swiper-component-5HoSsPi1.js} +2 -2
  28. package/dist/{toDate-Do1xRzAo.js → toDate-D-l5s8nn.js} +3 -3
  29. package/dist/{tooltip-Bz3OAwrU.js → tooltip-Czds6Qr8.js} +3 -3
  30. package/dist/{types-D8gEGs4R.js → types-C2Ir191_.js} +1 -1
  31. package/dist/{useAsyncData-CL3o2p4i.js → useAsyncData-1Dhzjfwf.js} +1 -1
  32. package/dist/{useDateFormatter-BC6iSz9g.js → useDateFormatter-CMnRuVmN.js} +2 -2
  33. package/dist/{useDeepCompareMemoize-BPx2MuOK.js → useDeepCompareMemoize-CDWT3BDz.js} +1 -1
  34. package/dist/{useIframeCapabilities-C6Ta3EyP.js → useIframeCapabilities-DWIYvDh7.js} +1 -1
  35. package/dist/{useLifecycle-C3Ec71q0.js → useLifecycle-AHlswLw-.js} +3 -3
  36. package/dist/{useTheme-ZhT6uIu3.js → useTheme-BrYvK-_A.js} +2 -2
  37. package/dist/{vega-component-C3AWYGAL.js → vega-component-Pk6lyc_a.js} +10 -10
  38. package/dist/{zod-DXqkaI_w.js → zod-CijjQh4u.js} +1 -1
  39. package/package.json +3 -3
  40. package/src/components/ai/display-helpers.tsx +5 -5
  41. package/src/components/app-config/ai-config.tsx +5 -5
  42. package/src/components/app-config/mcp-config.tsx +3 -3
  43. package/src/components/chat/acp/agent-panel.tsx +3 -3
  44. package/src/components/chat/acp/blocks.tsx +36 -38
  45. package/src/components/chat/acp/common.tsx +12 -16
  46. package/src/components/chat/acp/scroll-to-bottom-button.tsx +1 -1
  47. package/src/components/chat/acp/session-tabs.tsx +2 -2
  48. package/src/components/chat/chat-history-popover.tsx +1 -1
  49. package/src/components/chat/chat-panel.tsx +47 -23
  50. package/src/components/data-table/TableBottomBar.tsx +4 -1
  51. package/src/components/data-table/columns.tsx +2 -2
  52. package/src/components/data-table/data-table.tsx +26 -17
  53. package/src/components/data-table/filter-pill-editor.tsx +1 -1
  54. package/src/components/dependency-graph/minimap-content.tsx +1 -1
  55. package/src/components/editor/RecoveryButton.tsx +1 -1
  56. package/src/components/editor/actions/pair-with-agent-modal.tsx +2 -2
  57. package/src/components/editor/actions/useNotebookActions.tsx +4 -4
  58. package/src/components/editor/ai/__tests__/completion-utils.test.ts +138 -2
  59. package/src/components/editor/ai/ai-completion-editor.tsx +1 -1
  60. package/src/components/editor/ai/completion-utils.ts +124 -21
  61. package/src/components/editor/cell/CreateCellButton.tsx +1 -1
  62. package/src/components/editor/chrome/panels/empty-state.tsx +1 -1
  63. package/src/components/editor/chrome/panels/outline/floating-outline.tsx +1 -1
  64. package/src/components/editor/chrome/wrapper/pending-ai-cells.tsx +1 -1
  65. package/src/components/editor/columns/cell-column.tsx +1 -1
  66. package/src/components/editor/columns/sortable-column.tsx +2 -2
  67. package/src/components/editor/output/MarimoErrorOutput.tsx +1 -1
  68. package/src/components/editor/output/TextOutput.tsx +2 -2
  69. package/src/components/home/components.tsx +4 -4
  70. package/src/components/icons/github.tsx +21 -0
  71. package/src/components/icons/youtube.tsx +21 -0
  72. package/src/components/slides/minimap.tsx +2 -2
  73. package/src/components/slides/reveal-component.tsx +1 -1
  74. package/src/components/storage/components.tsx +3 -7
  75. package/src/components/ui/alert.tsx +1 -1
  76. package/src/components/ui/command.tsx +2 -2
  77. package/src/components/ui/reorderable-list.tsx +1 -1
  78. package/src/components/ui/table.tsx +2 -5
  79. package/src/core/codemirror/go-to-definition/__tests__/commands.test.ts +67 -0
  80. package/src/core/codemirror/go-to-definition/__tests__/utils.test.ts +47 -0
  81. package/src/core/codemirror/go-to-definition/commands.ts +47 -30
  82. package/src/core/codemirror/go-to-definition/utils.ts +0 -1
  83. package/src/core/codemirror/language/languages/sql/renderers.tsx +60 -68
  84. package/src/core/codemirror/reactive-references/__tests__/analyzer.test.ts +54 -0
  85. package/src/core/codemirror/reactive-references/analyzer.ts +44 -35
  86. package/src/core/hotkeys/hotkeys.ts +1 -0
  87. package/src/core/islands/__tests__/bridge.test.ts +25 -0
  88. package/src/core/islands/__tests__/parse.test.ts +585 -1
  89. package/src/core/islands/__tests__/test-utils.tsx +10 -1
  90. package/src/core/islands/bridge.ts +6 -1
  91. package/src/core/islands/constants.ts +2 -0
  92. package/src/core/islands/parse.ts +293 -13
  93. package/src/plugins/impl/DataTablePlugin.tsx +20 -1
  94. package/src/plugins/impl/FileBrowserPlugin.tsx +165 -74
  95. package/src/plugins/impl/MatrixPlugin.tsx +2 -2
  96. package/src/plugins/impl/TabsPlugin.tsx +1 -1
  97. package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +141 -1
  98. package/src/plugins/impl/__tests__/FileBrowserPlugin.test.tsx +314 -0
  99. package/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx +4 -1
  100. package/src/plugins/impl/anywidget/__tests__/AnyWidgetPlugin.test.tsx +34 -0
  101. package/src/plugins/impl/anywidget/__tests__/model.test.ts +19 -0
  102. package/src/plugins/impl/anywidget/model.ts +15 -0
  103. package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +1 -1
  104. package/src/plugins/impl/mpl-interactive/MplInteractivePlugin.tsx +155 -98
  105. package/src/plugins/impl/mpl-interactive/__tests__/MplInteractivePlugin.test.tsx +154 -1
  106. package/src/plugins/impl/mpl-interactive/mpl-websocket-shim.ts +10 -0
@@ -16,7 +16,7 @@ const SCOPE_CREATING_NODES = new Set([
16
16
  "FunctionDefinition",
17
17
  "LambdaExpression",
18
18
  "ArrayComprehensionExpression",
19
- "SetComprehension",
19
+ "SetComprehensionExpression",
20
20
  "DictionaryComprehensionExpression",
21
21
  "ComprehensionExpression",
22
22
  "ClassDefinition",
@@ -152,7 +152,7 @@ export function findReactiveVariables(options: {
152
152
  }
153
153
  case "ArrayComprehensionExpression":
154
154
  case "DictionaryComprehensionExpression":
155
- case "SetComprehension":
155
+ case "SetComprehensionExpression":
156
156
  case "ComprehensionExpression": {
157
157
  // Domprehension variables - look for VariableName or TupleExpression after 'for'
158
158
  const subCursor = node.cursor();
@@ -276,49 +276,52 @@ export function findReactiveVariables(options: {
276
276
  break;
277
277
  }
278
278
  case "ImportStatement": {
279
- // Handle import x
279
+ // The grammar emits a single ImportStatement for both `import x [as y]`
280
+ // and `from m import x [as y], ...`. Direct children mix keywords,
281
+ // module-path names (before `import`), imported names, and aliases.
282
+ // Only post-`import` names that aren't shadowed by a following `as`
283
+ // (and the alias itself when `as` is present) bind in the current
284
+ // scope.
280
285
  const subCursor = node.cursor();
281
286
  subCursor.firstChild();
282
- do {
283
- if (subCursor.name === "VariableName") {
284
- const varName = options.state.doc.sliceString(
285
- subCursor.from,
286
- subCursor.to,
287
- );
288
-
289
- const currentScope =
290
- currentScopeStack[currentScopeStack.length - 1] ?? -1;
291
- if (!allDeclarations.has(currentScope)) {
292
- allDeclarations.set(currentScope, new Set());
293
- }
294
- allDeclarations.get(currentScope)?.add(varName);
287
+ const currentScope =
288
+ currentScopeStack[currentScopeStack.length - 1] ?? -1;
289
+ if (!allDeclarations.has(currentScope)) {
290
+ allDeclarations.set(currentScope, new Set());
291
+ }
292
+ const scope = allDeclarations.get(currentScope);
293
+ let pastImport = false;
294
+ let pending: string | null = null;
295
+ const commit = () => {
296
+ if (pending !== null) {
297
+ scope?.add(pending);
295
298
  }
296
- } while (subCursor.nextSibling());
297
-
298
- break;
299
- }
300
- case "ImportFromStatement": {
301
- // Handle from x import y as z
302
- const subCursor = node.cursor();
303
- subCursor.firstChild();
304
- let foundImport = false;
299
+ pending = null;
300
+ };
305
301
  do {
306
302
  if (subCursor.name === "import") {
307
- foundImport = true;
308
- } else if (foundImport && subCursor.name === "VariableName") {
309
- const varName = options.state.doc.sliceString(
303
+ pastImport = true;
304
+ continue;
305
+ }
306
+ if (!pastImport) {
307
+ continue;
308
+ }
309
+ if (subCursor.name === "as") {
310
+ // Drop the imported name; the next VariableName is the alias.
311
+ pending = null;
312
+ continue;
313
+ }
314
+ if (subCursor.name === "VariableName") {
315
+ commit();
316
+ pending = options.state.doc.sliceString(
310
317
  subCursor.from,
311
318
  subCursor.to,
312
319
  );
313
- // Add to the current innermost scope
314
- const currentScope =
315
- currentScopeStack[currentScopeStack.length - 1] ?? -1;
316
- if (!allDeclarations.has(currentScope)) {
317
- allDeclarations.set(currentScope, new Set());
318
- }
319
- allDeclarations.get(currentScope)?.add(varName);
320
+ } else if (subCursor.name === ",") {
321
+ commit();
320
322
  }
321
323
  } while (subCursor.nextSibling());
324
+ commit();
322
325
 
323
326
  break;
324
327
  }
@@ -424,6 +427,12 @@ export function findReactiveVariables(options: {
424
427
  const nodeName = cursor.name;
425
428
  const nodeStart = cursor.from;
426
429
 
430
+ // Names inside an import statement are module paths, imported names, or
431
+ // aliases — none of them are reactive *uses* of an outer-cell global.
432
+ if (nodeName === "ImportStatement") {
433
+ return;
434
+ }
435
+
427
436
  const isNewScope = SCOPE_CREATING_NODES.has(nodeName);
428
437
 
429
438
  let currentScopeStack = scopeStack;
@@ -374,6 +374,7 @@ const DEFAULT_HOT_KEY = {
374
374
  name: "Show all code",
375
375
  group: "Editing",
376
376
  key: NOT_SET,
377
+ additionalKeywords: ["unhide", "hide", "reveal", "show source"],
377
378
  },
378
379
  "global.hideAllCode": {
379
380
  name: "Hide all code",
@@ -12,6 +12,7 @@ import {
12
12
  type Base64String = components["schemas"]["Base64String"];
13
13
  interface TestIslandApp {
14
14
  id: string;
15
+ payloadBacked?: boolean;
15
16
  cells: { code: string; idx: number; output: string }[];
16
17
  }
17
18
  interface TestExportContext {
@@ -142,6 +143,30 @@ describe("IslandsPyodideBridge", () => {
142
143
  });
143
144
  });
144
145
 
146
+ it("should ignore trusted export notebook code for a payload-backed app", async () => {
147
+ const payloadApp = {
148
+ id: "app-1",
149
+ payloadBacked: true,
150
+ cells: [{ code: "x = 1", idx: 0, output: "<div>1</div>" }],
151
+ };
152
+ mockParseMarimoIslandApps.mockReturnValue([payloadApp]);
153
+ mockGetMarimoExportContext.mockReturnValue({
154
+ trusted: true,
155
+ notebookCode: "full notebook should be ignored",
156
+ });
157
+ mockCreateMarimoFile.mockReturnValue("generated payload app");
158
+
159
+ await (
160
+ bridge as unknown as { startSessionsForAllApps(): Promise<void> }
161
+ ).startSessionsForAllApps();
162
+
163
+ expect(mockCreateMarimoFile).toHaveBeenCalledWith(payloadApp);
164
+ expect(mockStartSessionRequest).toHaveBeenCalledWith({
165
+ appId: "app-1",
166
+ code: "generated payload app",
167
+ });
168
+ });
169
+
145
170
  it("should keep synthesized per-app files for multiple reactive apps even when export context exists", async () => {
146
171
  mockParseMarimoIslandApps.mockReturnValue([
147
172
  {