@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.
- package/dist/{ConnectedDataExplorerComponent-WqG-xX4l.js → ConnectedDataExplorerComponent-Du3_nUzI.js} +13 -13
- package/dist/{ErrorBoundary-BNx_OSVo.js → ErrorBoundary-DE6tzZf-.js} +2 -2
- package/dist/{any-language-editor-rPSlOll9.js → any-language-editor-DN1R-1KZ.js} +5 -5
- package/dist/{button-vQhauTmO.js → button-BacYv-bE.js} +7 -1
- package/dist/{capabilities-BEHzIS99.js → capabilities-D_4LYhSU.js} +1 -1
- package/dist/{chat-ui-k2kqhCv5.js → chat-ui-CsPewo4h.js} +16 -16
- package/dist/{check-nrzHDi45.js → check-C9OoNtR4.js} +1 -1
- package/dist/{code-visibility-DZ_6U5hT.js → code-visibility-DBnAQPtB.js} +664 -663
- package/dist/{copy-UhDed7D4.js → copy-COam1EG7.js} +2 -2
- package/dist/{dist-DYGLrbYQ.js → dist--2Bqjvs0.js} +2 -2
- package/dist/{error-banner-BHAkVFc2.js → error-banner-DFPfz_Qf.js} +2 -2
- package/dist/{esm-Bqu9AE2K.js → esm-M837UxV5.js} +1 -1
- package/dist/{extends-9Yl5BEcg.js → extends-9MVIxxRo.js} +4 -4
- package/dist/{formats-BV4bOfMI.js → formats-d6MhLuQ9.js} +4 -4
- package/dist/{glide-data-editor-BDTq6YUb.js → glide-data-editor-DkzAInWG.js} +9 -9
- package/dist/{html-to-image-C86pQALH.js → html-to-image-DXwLcQ6l.js} +95 -88
- package/dist/{input-AKkGXdyV.js → input-CbEz_aj_.js} +6 -6
- package/dist/{label-E3ZJXHu8.js → label-WfTSU8L4.js} +2 -2
- package/dist/{loader-YPuQvn1Y.js → loader-Boph2xIS.js} +1 -1
- package/dist/main.js +1753 -1626
- package/dist/{mermaid-QFAR9YgY.js → mermaid-CJW9vIyO.js} +5 -5
- package/dist/{process-output-nNw4OpSj.js → process-output-C6_e1pT_.js} +3 -3
- package/dist/{reveal-component-BxDb5eK0.js → reveal-component-DIzKQ1NS.js} +11 -11
- package/dist/{spec-B45_YCNI.js → spec-Bv-XlYiv.js} +4 -4
- package/dist/{strings-Cq2s9_EQ.js → strings-Dq_j3Rxw.js} +4 -4
- package/dist/style.css +2 -2
- package/dist/{swiper-component-BNa_4kh2.js → swiper-component-5HoSsPi1.js} +2 -2
- package/dist/{toDate-Do1xRzAo.js → toDate-D-l5s8nn.js} +3 -3
- package/dist/{tooltip-Bz3OAwrU.js → tooltip-Czds6Qr8.js} +3 -3
- package/dist/{types-D8gEGs4R.js → types-C2Ir191_.js} +1 -1
- package/dist/{useAsyncData-CL3o2p4i.js → useAsyncData-1Dhzjfwf.js} +1 -1
- package/dist/{useDateFormatter-BC6iSz9g.js → useDateFormatter-CMnRuVmN.js} +2 -2
- package/dist/{useDeepCompareMemoize-BPx2MuOK.js → useDeepCompareMemoize-CDWT3BDz.js} +1 -1
- package/dist/{useIframeCapabilities-C6Ta3EyP.js → useIframeCapabilities-DWIYvDh7.js} +1 -1
- package/dist/{useLifecycle-C3Ec71q0.js → useLifecycle-AHlswLw-.js} +3 -3
- package/dist/{useTheme-ZhT6uIu3.js → useTheme-BrYvK-_A.js} +2 -2
- package/dist/{vega-component-C3AWYGAL.js → vega-component-Pk6lyc_a.js} +10 -10
- package/dist/{zod-DXqkaI_w.js → zod-CijjQh4u.js} +1 -1
- package/package.json +3 -3
- package/src/components/ai/display-helpers.tsx +5 -5
- package/src/components/app-config/ai-config.tsx +5 -5
- package/src/components/app-config/mcp-config.tsx +3 -3
- package/src/components/chat/acp/agent-panel.tsx +3 -3
- package/src/components/chat/acp/blocks.tsx +36 -38
- package/src/components/chat/acp/common.tsx +12 -16
- package/src/components/chat/acp/scroll-to-bottom-button.tsx +1 -1
- package/src/components/chat/acp/session-tabs.tsx +2 -2
- package/src/components/chat/chat-history-popover.tsx +1 -1
- package/src/components/chat/chat-panel.tsx +47 -23
- package/src/components/data-table/TableBottomBar.tsx +4 -1
- package/src/components/data-table/columns.tsx +2 -2
- package/src/components/data-table/data-table.tsx +26 -17
- package/src/components/data-table/filter-pill-editor.tsx +1 -1
- package/src/components/dependency-graph/minimap-content.tsx +1 -1
- package/src/components/editor/RecoveryButton.tsx +1 -1
- package/src/components/editor/actions/pair-with-agent-modal.tsx +2 -2
- package/src/components/editor/actions/useNotebookActions.tsx +4 -4
- package/src/components/editor/ai/__tests__/completion-utils.test.ts +138 -2
- package/src/components/editor/ai/ai-completion-editor.tsx +1 -1
- package/src/components/editor/ai/completion-utils.ts +124 -21
- package/src/components/editor/cell/CreateCellButton.tsx +1 -1
- package/src/components/editor/chrome/panels/empty-state.tsx +1 -1
- package/src/components/editor/chrome/panels/outline/floating-outline.tsx +1 -1
- package/src/components/editor/chrome/wrapper/pending-ai-cells.tsx +1 -1
- package/src/components/editor/columns/cell-column.tsx +1 -1
- package/src/components/editor/columns/sortable-column.tsx +2 -2
- package/src/components/editor/output/MarimoErrorOutput.tsx +1 -1
- package/src/components/editor/output/TextOutput.tsx +2 -2
- package/src/components/home/components.tsx +4 -4
- package/src/components/icons/github.tsx +21 -0
- package/src/components/icons/youtube.tsx +21 -0
- package/src/components/slides/minimap.tsx +2 -2
- package/src/components/slides/reveal-component.tsx +1 -1
- package/src/components/storage/components.tsx +3 -7
- package/src/components/ui/alert.tsx +1 -1
- package/src/components/ui/command.tsx +2 -2
- package/src/components/ui/reorderable-list.tsx +1 -1
- package/src/components/ui/table.tsx +2 -5
- package/src/core/codemirror/go-to-definition/__tests__/commands.test.ts +67 -0
- package/src/core/codemirror/go-to-definition/__tests__/utils.test.ts +47 -0
- package/src/core/codemirror/go-to-definition/commands.ts +47 -30
- package/src/core/codemirror/go-to-definition/utils.ts +0 -1
- package/src/core/codemirror/language/languages/sql/renderers.tsx +60 -68
- package/src/core/codemirror/reactive-references/__tests__/analyzer.test.ts +54 -0
- package/src/core/codemirror/reactive-references/analyzer.ts +44 -35
- package/src/core/hotkeys/hotkeys.ts +1 -0
- package/src/core/islands/__tests__/bridge.test.ts +25 -0
- package/src/core/islands/__tests__/parse.test.ts +585 -1
- package/src/core/islands/__tests__/test-utils.tsx +10 -1
- package/src/core/islands/bridge.ts +6 -1
- package/src/core/islands/constants.ts +2 -0
- package/src/core/islands/parse.ts +293 -13
- package/src/plugins/impl/DataTablePlugin.tsx +20 -1
- package/src/plugins/impl/FileBrowserPlugin.tsx +165 -74
- package/src/plugins/impl/MatrixPlugin.tsx +2 -2
- package/src/plugins/impl/TabsPlugin.tsx +1 -1
- package/src/plugins/impl/__tests__/DataTablePlugin.test.tsx +141 -1
- package/src/plugins/impl/__tests__/FileBrowserPlugin.test.tsx +314 -0
- package/src/plugins/impl/anywidget/AnyWidgetPlugin.tsx +4 -1
- package/src/plugins/impl/anywidget/__tests__/AnyWidgetPlugin.test.tsx +34 -0
- package/src/plugins/impl/anywidget/__tests__/model.test.ts +19 -0
- package/src/plugins/impl/anywidget/model.ts +15 -0
- package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +1 -1
- package/src/plugins/impl/mpl-interactive/MplInteractivePlugin.tsx +155 -98
- package/src/plugins/impl/mpl-interactive/__tests__/MplInteractivePlugin.test.tsx +154 -1
- 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
|
-
"
|
|
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 "
|
|
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
|
-
//
|
|
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
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
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
|
-
|
|
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
|
-
|
|
308
|
-
|
|
309
|
-
|
|
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
|
-
|
|
314
|
-
|
|
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;
|
|
@@ -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
|
{
|