@marimo-team/frontend 0.25.3-dev95 → 0.25.3-dev97
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/assets/{CellStatus-CplYFNTy.js → CellStatus-fK4n2NPc.js} +1 -1
- package/dist/assets/{ErrorBoundary-CdGuz4a_.js → ErrorBoundary-CAEGdoFW.js} +2 -2
- package/dist/assets/{JsonOutput-Csbov8Fx.js → JsonOutput-CyAKmZDD.js} +1 -1
- package/dist/assets/{MarimoErrorOutput-czclLlOn.js → MarimoErrorOutput-CgZvP0p0.js} +1 -1
- package/dist/assets/{RenderHTML-CNDedpS4.js → RenderHTML-DQvxDDNS.js} +1 -1
- package/dist/assets/{RunButton-CRfdOxVd.js → RunButton-BBDnDL6G.js} +1 -1
- package/dist/assets/{add-cell-with-ai-BAIX7r0P.js → add-cell-with-ai-Clg5FELx.js} +2 -2
- package/dist/assets/{add-connection-dialog-DrDuM-tI.js → add-connection-dialog-BqdWmD-7.js} +1 -1
- package/dist/assets/{agent-panel-CoXq_rlA.js → agent-panel-5RxG5Y82.js} +3 -3
- package/dist/assets/{ai-model-dropdown-COvWn46z.js → ai-model-dropdown-Bvl1ktQq.js} +2 -2
- package/dist/assets/{app-config-button-CtxoYG4F.js → app-config-button-0QTeQ2Mv.js} +1 -1
- package/dist/assets/{blob-DCjrjZKW.js → blob-5VcB8K_t.js} +1 -1
- package/dist/assets/{cache-panel-CbWZcBu0.js → cache-panel-BV-c7ed0.js} +1 -1
- package/dist/assets/{cell-editor-BnL0Sorl.js → cell-editor-Byw5y-oI.js} +2 -2
- package/dist/assets/{cell-link-BFbgKiRH.js → cell-link-C5yYyzuF.js} +1 -1
- package/dist/assets/{cells-yOs72eZm.js → cells-D_11MjVB.js} +13 -13
- package/dist/assets/{chat-display-DwRM41t_.js → chat-display-BCR_ySiV.js} +1 -1
- package/dist/assets/{chat-panel-DeTEdjxF.js → chat-panel-RPRvBsaU.js} +2 -2
- package/dist/assets/{chat-ui-D6XucD07.js → chat-ui-CGviVaRA.js} +3 -3
- package/dist/assets/column-preview-xe533-Cn.js +1 -0
- package/dist/assets/{command-palette-CA6yfNLb.js → command-palette-BB9bWdWp.js} +1 -1
- package/dist/assets/{common-B-ZYnO1x.js → common-CaeItbcI.js} +1 -1
- package/dist/assets/{components-vu2jLG08.js → components-G6frbw0c.js} +1 -1
- package/dist/assets/{datasource-BakEOWsf.js → datasource-deuXnlU-.js} +1 -1
- package/dist/assets/{dependency-graph-panel-DCGB3_id.js → dependency-graph-panel-CIykLnJe.js} +2 -2
- package/dist/assets/{documentation-panel-CpGZ2Dfn.js → documentation-panel-2PQ8kQLa.js} +1 -1
- package/dist/assets/{download-CV1k4XQ4.js → download-dK52bLxZ.js} +1 -1
- package/dist/assets/{edit-page-By7n2M84.js → edit-page-C2phWLKH.js} +6 -6
- package/dist/assets/{error-entries-JgrZYMbe.js → error-entries-3GVk2KjS.js} +1 -1
- package/dist/assets/{error-panel-DS7HWph-.js → error-panel-CzDRGPeC.js} +1 -1
- package/dist/assets/{feedback-button-eYsTCK-g.js → feedback-button-C5NgWpFg.js} +1 -1
- package/dist/assets/feedback-button-CONwLFpw.js +1 -0
- package/dist/assets/{file-explorer-panel-BTLwwwD4.js → file-explorer-panel-B50xDnTZ.js} +1 -1
- package/dist/assets/{file-name-input-BaR4h2Ud.js → file-name-input-DqwMSgGU.js} +1 -1
- package/dist/assets/{floating-outline-Drd73Quo.js → floating-outline-ChmAuvxz.js} +1 -1
- package/dist/assets/{gallery-page-DXUD11Rm.js → gallery-page-CiL8aMS1.js} +1 -1
- package/dist/assets/{glide-data-editor-DqBBoQBl.js → glide-data-editor-CqRclBkp.js} +1 -1
- package/dist/assets/{home-page-pgFFsmga.js → home-page-BgZVl4dP.js} +1 -1
- package/dist/assets/{hooks-D25kP4Sr.js → hooks-DM5n7Osw.js} +1 -1
- package/dist/assets/index-vCxv6WVQ.js +30 -0
- package/dist/assets/{layout-DLHIGZTK.js → layout-BpP8nTjb.js} +4 -4
- package/dist/assets/{logs-panel-D5AAD2s9.js → logs-panel-B5eVAZtH.js} +1 -1
- package/dist/assets/{markdown-renderer--CwVm4kJ.js → markdown-renderer-BWUzqkJM.js} +1 -1
- package/dist/assets/{name-cell-input-BFKZaNI5.js → name-cell-input-DXW68gRW.js} +1 -1
- package/dist/assets/{outline-panel-qcwRnl0R.js → outline-panel-DPxJhJ_A.js} +1 -1
- package/dist/assets/{packages-panel-DnSryNcz.js → packages-panel-gBE2FWQr.js} +1 -1
- package/dist/assets/{panel-accordion-state-BwJpDMVt.js → panel-accordion-state-CCF5Gxnc.js} +1 -1
- package/dist/assets/{panels-Aqzwb3UR.js → panels-BQYMF6p_.js} +1 -1
- package/dist/assets/{process-output-DuUfHYSr.js → process-output-Cw9IDcKQ.js} +1 -1
- package/dist/assets/{readonly-code-display-BY-9I_Yk.js → readonly-code-display-DYcZQ28T.js} +1 -1
- package/dist/assets/{readonly-python-code-DSyr-yE2.js → readonly-python-code-RFuQP50v.js} +1 -1
- package/dist/assets/{reveal-component-C_Lb7Mom.js → reveal-component-yRrDmCQz.js} +2 -2
- package/dist/assets/{run-page-ZTw-kCU-.js → run-page-CY65WUOu.js} +1 -1
- package/dist/assets/{runtime-details-state-B7gpnuXx.js → runtime-details-state-pobtu6TO.js} +1 -1
- package/dist/assets/scratchpad-panel-H44_pvb_.js +1 -0
- package/dist/assets/session-panel-Bnd1iXkO.js +1 -0
- package/dist/assets/{snippets-panel-BNadUJLU.js → snippets-panel-DKApxKx9.js} +1 -1
- package/dist/assets/{state-BaYudep3.js → state-Bl9BiY_s.js} +1 -1
- package/dist/assets/{state-_1LTGJQM.js → state-Dv059B3A.js} +1 -1
- package/dist/assets/{tracing-DbTgS4u9.js → tracing-Clwy4SlW.js} +1 -1
- package/dist/assets/{tracing-panel-CjlrpXPy.js → tracing-panel-BwjLG_aC.js} +2 -2
- package/dist/assets/{tree-actions-C_KYlaSv.js → tree-actions-BZNTQ12N.js} +1 -1
- package/dist/assets/{useAddCell-C0J8quGE.js → useAddCell-Cjuqk2YR.js} +1 -1
- package/dist/assets/{useCellActionButton-CbkOj6BE.js → useCellActionButton-MoWLvuGe.js} +1 -1
- package/dist/assets/{useDeleteCell-DHkF5wgS.js → useDeleteCell-BC-MW7d1.js} +1 -1
- package/dist/assets/{useDependencyPanelTab--yXJW6X5.js → useDependencyPanelTab-CZU7i-B3.js} +1 -1
- package/dist/assets/{useNotebookActions-dJQalORg.js → useNotebookActions-wFxVdRXQ.js} +1 -1
- package/dist/assets/{useRunCells-C_IwVJR_.js → useRunCells-ByaWxoIt.js} +1 -1
- package/dist/assets/{useSplitCell-Ci4MEUj8.js → useSplitCell-YJIystwv.js} +1 -1
- package/dist/index.html +20 -20
- package/package.json +1 -1
- package/src/components/app-config/ai-config.tsx +1 -0
- package/src/components/chat/acp/blocks.tsx +2 -2
- package/src/components/chat/chat-components.tsx +2 -0
- package/src/components/chat/chat-panel.tsx +6 -1
- package/src/components/data-table/__tests__/column-explorer.test.tsx +27 -1
- package/src/components/data-table/charts/__tests__/chart-panel.test.tsx +74 -1
- package/src/components/data-table/charts/__tests__/storage.test.ts +4 -1
- package/src/components/data-table/charts/charts.tsx +21 -6
- package/src/components/data-table/charts/storage.ts +16 -5
- package/src/components/data-table/column-explorer-panel/column-explorer.tsx +1 -1
- package/src/components/datasources/__tests__/column-actions.test.tsx +97 -0
- package/src/components/datasources/__tests__/column-preview.test.tsx +63 -2
- package/src/components/datasources/column-preview.tsx +8 -2
- package/src/components/datasources/datasources.tsx +12 -14
- package/src/components/debugger/debugger-code.tsx +5 -0
- package/src/components/dependency-graph/panels.tsx +2 -1
- package/src/components/editor/ai/ai-completion-editor.tsx +1 -0
- package/src/components/editor/alerts/startup-logs-alert.tsx +1 -0
- package/src/components/editor/cell/DeleteButton.tsx +1 -0
- package/src/components/editor/chrome/panels/cache-panel.tsx +1 -0
- package/src/components/editor/chrome/wrapper/__tests__/pending-ai-cells.test.tsx +58 -1
- package/src/components/editor/chrome/wrapper/pending-ai-cells.tsx +12 -2
- package/src/components/editor/notebook-banner.tsx +1 -0
- package/src/components/editor/output/ansi-reduce.ts +6 -0
- package/src/components/editor/output/console/ConsoleOutput.tsx +11 -7
- package/src/components/editor/package-alert.tsx +6 -4
- package/src/components/editor/renderers/vertical-layout/sidebar/toggle.tsx +7 -1
- package/src/components/mcp/mcp-status-indicator.tsx +1 -1
- package/src/components/scratchpad/scratchpad.tsx +2 -2
- package/src/components/slides/reveal-component.tsx +4 -2
- package/src/components/slides/slide-form.tsx +1 -0
- package/src/core/cells/__tests__/__snapshots__/cells.test.ts.snap +4 -0
- package/src/core/cells/__tests__/cell.test.ts +39 -0
- package/src/core/cells/__tests__/cells.test.ts +3 -1
- package/src/core/cells/__tests__/collapseConsoleOutputs.test.ts +54 -0
- package/src/core/cells/cell.ts +14 -3
- package/src/core/cells/cells.ts +1 -0
- package/src/core/cells/types.ts +10 -1
- package/src/core/codemirror/language/panel/panel.tsx +1 -0
- package/src/plugins/impl/RefreshPlugin.tsx +1 -0
- package/src/plugins/impl/chat/chat-ui.tsx +2 -1
- package/src/stories/button.stories.tsx +1 -0
- package/dist/assets/column-preview-DXM8SqGY.js +0 -1
- package/dist/assets/feedback-button-Dgs_HOOC.js +0 -1
- package/dist/assets/index-DNG4qQ-E.js +0 -30
- package/dist/assets/scratchpad-panel-D2IHkKoG.js +0 -1
- package/dist/assets/session-panel-cOSO3WCX.js +0 -1
|
@@ -219,6 +219,45 @@ describe("transitionCell serialization", () => {
|
|
|
219
219
|
});
|
|
220
220
|
});
|
|
221
221
|
|
|
222
|
+
describe("transitionCell console output ids", () => {
|
|
223
|
+
const output = (
|
|
224
|
+
data: string,
|
|
225
|
+
channel: OutputMessage["channel"] = "stdout",
|
|
226
|
+
): OutputMessage => ({
|
|
227
|
+
channel,
|
|
228
|
+
mimetype: "text/plain",
|
|
229
|
+
data,
|
|
230
|
+
timestamp: 0,
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it("assigns increasing ids to appended outputs", () => {
|
|
234
|
+
let cell = createCellRuntimeState({ status: "running" });
|
|
235
|
+
cell = transitionCell(cell, { console: output("a") } as CellMessage);
|
|
236
|
+
cell = transitionCell(cell, {
|
|
237
|
+
console: output("b", "stderr"),
|
|
238
|
+
} as CellMessage);
|
|
239
|
+
expect(cell.consoleOutputs.map((o) => o.id)).toEqual([1, 2]);
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
it("continues from the surviving maximum after a collapse", () => {
|
|
243
|
+
let cell = createCellRuntimeState({ status: "running" });
|
|
244
|
+
cell = transitionCell(cell, { console: output("a") } as CellMessage);
|
|
245
|
+
cell = transitionCell(cell, { console: output("b") } as CellMessage);
|
|
246
|
+
expect(cell.consoleOutputs.map((o) => o.id)).toEqual([1]);
|
|
247
|
+
cell = transitionCell(cell, {
|
|
248
|
+
console: output("c", "stderr"),
|
|
249
|
+
} as CellMessage);
|
|
250
|
+
expect(cell.consoleOutputs.map((o) => o.id)).toEqual([1, 2]);
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it("assigns ids when the kernel replaces the whole console", () => {
|
|
254
|
+
const cell = transitionCell(createCellRuntimeState({ status: "running" }), {
|
|
255
|
+
console: [output("a"), output("b", "stderr")],
|
|
256
|
+
} as CellMessage);
|
|
257
|
+
expect(cell.consoleOutputs.map((o) => o.id)).toEqual([1, 2]);
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
|
|
222
261
|
describe("transitionCell stdin resolution", () => {
|
|
223
262
|
describe.each([
|
|
224
263
|
{
|
|
@@ -1579,7 +1579,9 @@ describe("cell reducer", () => {
|
|
|
1579
1579
|
response: secret,
|
|
1580
1580
|
});
|
|
1581
1581
|
|
|
1582
|
-
expect(cells[0].consoleOutputs).toEqual([
|
|
1582
|
+
expect(cells[0].consoleOutputs).toEqual([
|
|
1583
|
+
{ ...prompt, id: 1, response: "" },
|
|
1584
|
+
]);
|
|
1583
1585
|
expect(JSON.stringify(cells[0].consoleOutputs)).not.toContain(secret);
|
|
1584
1586
|
});
|
|
1585
1587
|
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import { describe, expect, it } from "vitest";
|
|
4
4
|
import { StatefulOutputMessage } from "@/components/editor/output/ansi-reduce";
|
|
5
|
+
import type { ConsoleOutputMessage } from "@/core/cells/types";
|
|
5
6
|
import type { OutputMessage } from "@/core/kernel/messages";
|
|
6
7
|
import {
|
|
7
8
|
collapseConsoleOutputs,
|
|
@@ -279,6 +280,59 @@ describe("collapseConsoleOutputs", () => {
|
|
|
279
280
|
expect(result[0].data).toContain("Streaming output truncated");
|
|
280
281
|
});
|
|
281
282
|
|
|
283
|
+
it("keeps the first id when collapsing outputs", () => {
|
|
284
|
+
const consoleOutputs = [
|
|
285
|
+
{
|
|
286
|
+
mimetype: "text/plain",
|
|
287
|
+
channel: "output",
|
|
288
|
+
data: "Hello ",
|
|
289
|
+
timestamp: 0,
|
|
290
|
+
id: 7,
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
mimetype: "text/plain",
|
|
294
|
+
channel: "output",
|
|
295
|
+
data: "World",
|
|
296
|
+
timestamp: 0,
|
|
297
|
+
id: 8,
|
|
298
|
+
},
|
|
299
|
+
] satisfies ConsoleOutputMessage[];
|
|
300
|
+
const result = collapseConsoleOutputs(consoleOutputs);
|
|
301
|
+
expect(result).toHaveLength(1);
|
|
302
|
+
expect(result[0].data).toBe("Hello World");
|
|
303
|
+
expect((result[0] as ConsoleOutputMessage).id).toBe(7);
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
it("keeps ids on outputs that survive truncation", () => {
|
|
307
|
+
const consoleOutputs = [
|
|
308
|
+
{
|
|
309
|
+
mimetype: "text/plain",
|
|
310
|
+
channel: "output",
|
|
311
|
+
data: "one\ntwo",
|
|
312
|
+
timestamp: 0,
|
|
313
|
+
id: 1,
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
mimetype: "text/plain",
|
|
317
|
+
channel: "stderr",
|
|
318
|
+
data: "three\nfour",
|
|
319
|
+
timestamp: 0,
|
|
320
|
+
id: 2,
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
mimetype: "text/plain",
|
|
324
|
+
channel: "output",
|
|
325
|
+
data: "five",
|
|
326
|
+
timestamp: 0,
|
|
327
|
+
id: 3,
|
|
328
|
+
},
|
|
329
|
+
] satisfies ConsoleOutputMessage[];
|
|
330
|
+
const result = collapseConsoleOutputs(consoleOutputs, 3);
|
|
331
|
+
const ids = result.map((output) => (output as ConsoleOutputMessage).id);
|
|
332
|
+
expect(result[0].data).toContain("Streaming output truncated");
|
|
333
|
+
expect(ids).toEqual([undefined, 2, 3]);
|
|
334
|
+
});
|
|
335
|
+
|
|
282
336
|
describe("ANSI escape sequences", () => {
|
|
283
337
|
it("should handle cursor movement with collapse", () => {
|
|
284
338
|
const consoleOutputs: OutputMessage[] = [
|
package/src/core/cells/cell.ts
CHANGED
|
@@ -7,7 +7,12 @@ import { parseOutline } from "../dom/outline";
|
|
|
7
7
|
import type { CellMessage, OutputMessage } from "../kernel/messages";
|
|
8
8
|
import type { RuntimeState } from "../network/types";
|
|
9
9
|
import { collapseConsoleOutputs } from "./collapseConsoleOutputs";
|
|
10
|
-
import type { CellRuntimeState } from "./types";
|
|
10
|
+
import type { CellRuntimeState, ConsoleOutputMessage } from "./types";
|
|
11
|
+
|
|
12
|
+
// Ids increase with position, so the last output holds the maximum.
|
|
13
|
+
function nextConsoleOutputId(outputs: ConsoleOutputMessage[]): number {
|
|
14
|
+
return (outputs.at(-1)?.id ?? 0) + 1;
|
|
15
|
+
}
|
|
11
16
|
|
|
12
17
|
export function transitionCell(
|
|
13
18
|
cell: CellRuntimeState,
|
|
@@ -133,6 +138,7 @@ export function transitionCell(
|
|
|
133
138
|
mimetype: output.mimetype,
|
|
134
139
|
data: output.data,
|
|
135
140
|
timestamp: output.timestamp,
|
|
141
|
+
id: output.id,
|
|
136
142
|
response: output.response ?? "",
|
|
137
143
|
};
|
|
138
144
|
}
|
|
@@ -146,8 +152,13 @@ export function transitionCell(
|
|
|
146
152
|
// messageConsole is an output that needs to be appended to the
|
|
147
153
|
// existing console outputs.
|
|
148
154
|
consoleOutputs = Array.isArray(messageConsole)
|
|
149
|
-
? collapseConsoleOutputs(
|
|
150
|
-
|
|
155
|
+
? collapseConsoleOutputs(
|
|
156
|
+
messageConsole.map((output, i) => ({ ...output, id: i + 1 })),
|
|
157
|
+
)
|
|
158
|
+
: collapseConsoleOutputs([
|
|
159
|
+
...consoleOutputs,
|
|
160
|
+
{ ...messageConsole, id: nextConsoleOutputId(consoleOutputs) },
|
|
161
|
+
]);
|
|
151
162
|
}
|
|
152
163
|
nextCell.consoleOutputs = consoleOutputs;
|
|
153
164
|
// Derive outline from output
|
package/src/core/cells/cells.ts
CHANGED
|
@@ -1114,6 +1114,7 @@ const {
|
|
|
1114
1114
|
mimetype: stdinOutput.mimetype,
|
|
1115
1115
|
data: stdinOutput.data,
|
|
1116
1116
|
timestamp: stdinOutput.timestamp,
|
|
1117
|
+
id: stdinOutput.id,
|
|
1117
1118
|
// An empty response resolves the prompt without retaining the secret.
|
|
1118
1119
|
response: stdinOutput.mimetype === "text/password" ? "" : response,
|
|
1119
1120
|
};
|
package/src/core/cells/types.ts
CHANGED
|
@@ -95,7 +95,7 @@ export interface CellRuntimeState {
|
|
|
95
95
|
/** TOC outline */
|
|
96
96
|
outline: Outline | null;
|
|
97
97
|
/** messages encoding the cell's console outputs. */
|
|
98
|
-
consoleOutputs:
|
|
98
|
+
consoleOutputs: ConsoleOutputMessage[];
|
|
99
99
|
/** current status of the cell */
|
|
100
100
|
status: RuntimeState;
|
|
101
101
|
/** whether the cell has stale inputs*/
|
|
@@ -130,3 +130,12 @@ export type WithResponse<T> = T & {
|
|
|
130
130
|
*/
|
|
131
131
|
response?: string;
|
|
132
132
|
};
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* A console output as held by the frontend. The id is assigned when the
|
|
136
|
+
* output arrives and never changes, so it can identify the output while
|
|
137
|
+
* neighboring outputs collapse, truncate, or receive a stdin response.
|
|
138
|
+
*/
|
|
139
|
+
export type ConsoleOutputMessage = WithResponse<OutputMessage> & {
|
|
140
|
+
id?: number;
|
|
141
|
+
};
|
|
@@ -119,6 +119,7 @@ const RefreshComponent = ({ setValue, data }: IPluginProps<Value, Data>) => {
|
|
|
119
119
|
<Labeled label={data.label}>
|
|
120
120
|
<span className="inline-flex items-center text-secondary-foreground rounded shadow-sm-solid">
|
|
121
121
|
<Button
|
|
122
|
+
aria-label="Refresh"
|
|
122
123
|
data-testid="marimo-plugin-refresh-button"
|
|
123
124
|
variant="secondary"
|
|
124
125
|
size="icon"
|
|
@@ -441,6 +441,7 @@ export const Chatbot: React.FC<Props> = (props) => {
|
|
|
441
441
|
>
|
|
442
442
|
<div className="absolute top-0 right-0 flex justify-end z-10 border border-(--slate-6) bg-inherit rounded-bl-lg">
|
|
443
443
|
<Button
|
|
444
|
+
aria-label="Reset chat"
|
|
444
445
|
variant="text"
|
|
445
446
|
size="icon"
|
|
446
447
|
disabled={messages.length === 0}
|
|
@@ -471,7 +472,7 @@ export const Chatbot: React.FC<Props> = (props) => {
|
|
|
471
472
|
|
|
472
473
|
return (
|
|
473
474
|
<div
|
|
474
|
-
key={
|
|
475
|
+
key={message.id}
|
|
475
476
|
className={cn(
|
|
476
477
|
"flex flex-col group gap-2",
|
|
477
478
|
message.role === "user" ? "items-end" : "items-start",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{l as t}from"./useEvent-BDjgaBtz.js";import{t as n}from"./react-DVplv7_D.js";import{D as r,Gi as i,Rt as a,Xi as o,Yi as s,zt as c}from"./cells-yOs72eZm.js";import{t as l}from"./compiler-runtime-BrajqUja.js";import{s as u}from"./config-DpY86_Yq.js";import{t as d}from"./jsx-runtime-B74pBk57.js";import{l as f,p,vt as m}from"./JsonOutput-Csbov8Fx.js";import{t as h}from"./tooltip-CkGm8X7m.js";import{r as g,t as _}from"./button-D8gVKwe-.js";import{t as v}from"./createLucideIcon-DfJ2oMlA.js";import{t as y}from"./useLifecycle-Mq4gc5kS.js";import{t as b}from"./spinner-DyNE-o8o.js";import{t as x}from"./copy-icon-8-a5vovc.js";import{r as S}from"./requests-BIFR-h4M.js";import{r as C}from"./useTheme-BAA27lh7.js";import{t as w}from"./I18nProvider-Cg2I_s1_.js";import{i as T}from"./numbers-CsZVw3Dc.js";var E=v(`square-plus`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M8 12h8`,key:`1wcyev`}],[`path`,{d:`M12 8v8`,key:`napkw2`}]]),D=l(),O=e(n(),1),k=d(),A=e=>{let t=(0,D.c)(53),{table:n,column:r,preview:i,onAddColumnChart:a,sqlTableContext:c}=e,{theme:l}=C(),{previewDatasetColumn:u}=S(),{locale:d}=w(),f;t[0]!==r.name||t[1]!==u||t[2]!==c||t[3]!==n.name||t[4]!==n.source||t[5]!==n.source_type?(f=()=>{u({source:n.source,tableName:n.name,columnName:r.name,sourceType:n.source_type,fullyQualifiedTableName:o(c,n.name)})},t[0]=r.name,t[1]=u,t[2]=c,t[3]=n.name,t[4]=n.source,t[5]=n.source_type,t[6]=f):f=t[6];let m=f,v;if(t[7]!==i||t[8]!==m||t[9]!==n.source_type?(v=()=>{i||n.source_type!==`connection`&&n.source_type!==`catalog`&&m()},t[7]=i,t[8]=m,t[9]=n.source_type,t[10]=v):v=t[10],y(v),n.source_type===`connection`){let e=r.name,i=r.external_type,o;t[11]!==r.name||t[12]!==a||t[13]!==c||t[14]!==n?(o=g.stopPropagation(()=>{a(s({table:n,columnName:r.name,sqlTableContext:c}))}),t[11]=r.name,t[12]=a,t[13]=c,t[14]=n,t[15]=o):o=t[15];let l;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,k.jsx)(E,{className:`h-3 w-3 mr-1`}),t[16]=l):l=t[16];let u;t[17]===o?u=t[18]:(u=(0,k.jsxs)(_,{variant:`outline`,size:`xs`,onClick:o,children:[l,` Add SQL cell`]}),t[17]=o,t[18]=u);let d;return t[19]!==r.external_type||t[20]!==r.name||t[21]!==u?(d=(0,k.jsxs)(`span`,{className:`text-xs text-muted-foreground gap-2 flex items-center justify-between pl-7`,children:[e,` (`,i,`)`,u]}),t[19]=r.external_type,t[20]=r.name,t[21]=u,t[22]=d):d=t[22],d}if(n.source_type===`catalog`){let e;return t[23]!==r.external_type||t[24]!==r.name?(e=(0,k.jsxs)(`span`,{className:`text-xs text-muted-foreground gap-2 flex items-center justify-between pl-7`,children:[r.name,` (`,r.external_type,`)`]}),t[23]=r.external_type,t[24]=r.name,t[25]=e):e=t[25],e}if(!i){let e;return t[26]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,k.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Loading...`}),t[26]=e):e=t[26],e}let b;t[27]!==i.error||t[28]!==i.missing_packages||t[29]!==m?(b=i.error&&j({error:i.error,missingPackages:i.missing_packages,refetchPreview:m}),t[27]=i.error,t[28]=i.missing_packages,t[29]=m,t[30]=b):b=t[30];let x=b,T;t[31]!==r.type||t[32]!==d||t[33]!==i.stats?(T=i.stats&&M({stats:i.stats,dataType:r.type,locale:d}),t[31]=r.type,t[32]=d,t[33]=i.stats,t[34]=T):T=t[34];let O=T,A;t[35]!==i.chart_spec||t[36]!==l?(A=i.chart_spec&&P(i.chart_spec,l),t[35]=i.chart_spec,t[36]=l,t[37]=A):A=t[37];let N=A,I;t[38]!==i.chart_code||t[39]!==n.source_type?(I=i.chart_code&&n.source_type===`local`&&(0,k.jsx)(F,{chartCode:i.chart_code}),t[38]=i.chart_code,t[39]=n.source_type,t[40]=I):I=t[40];let L=I,R;t[41]!==r.name||t[42]!==a||t[43]!==c||t[44]!==n?(R=n.source_type===`duckdb`&&(0,k.jsx)(h,{content:`Add SQL cell`,delayDuration:400,children:(0,k.jsx)(_,{variant:`outline`,size:`icon`,className:`z-10 bg-background absolute right-1 -top-1`,onClick:g.stopPropagation(()=>{a(s({table:n,columnName:r.name,sqlTableContext:c}))}),children:(0,k.jsx)(E,{className:`h-3 w-3`})})}),t[41]=r.name,t[42]=a,t[43]=c,t[44]=n,t[45]=R):R=t[45];let z=R;if(!x&&!O&&!N){let e;return t[46]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,k.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`No data`}),t[46]=e):e=t[46],e}let B;return t[47]!==L||t[48]!==z||t[49]!==N||t[50]!==x||t[51]!==O?(B=(0,k.jsxs)(p,{children:[x,L,z,N,O]}),t[47]=L,t[48]=z,t[49]=N,t[50]=x,t[51]=O,t[52]=B):B=t[52],B};function j({error:e,missingPackages:t,refetchPreview:n}){return(0,k.jsxs)(`div`,{className:`text-xs text-muted-foreground p-2 border border-border rounded flex items-center justify-between`,children:[(0,k.jsx)(`span`,{children:e}),t&&(0,k.jsx)(f,{packages:t,showMaxPackages:1,className:`w-32`,onInstall:n})]})}function M({stats:e,dataType:t,locale:n}){return(0,k.jsx)(`div`,{className:`gap-x-16 gap-y-1 grid grid-cols-2-fit border rounded p-2 empty:hidden`,children:Object.entries(e).map(([e,r])=>r==null?null:(0,k.jsxs)(`div`,{className:`flex items-center gap-1 group`,children:[(0,k.jsx)(`span`,{className:`text-xs min-w-[60px] capitalize`,children:i(e,t)}),(0,k.jsx)(`span`,{className:`text-xs font-bold text-muted-foreground tracking-wide`,children:T(r,n)}),(0,k.jsx)(x,{className:`h-3 w-3 invisible group-hover:visible`,value:String(r)})]},e))})}var N=(0,k.jsx)(`div`,{className:`flex justify-center`,children:(0,k.jsx)(b,{className:`size-4`})});function P(e,t){return(0,k.jsx)(O.Suspense,{fallback:N,children:(0,k.jsx)(m,{"data-container-width":`container`,spec:(e=>({...e,background:`transparent`,config:{...e.config,background:`transparent`}}))(JSON.parse(e)),options:{theme:t===`dark`?`dark`:`vox`,height:100,width:`container`,actions:!1,renderer:`canvas`}})})}var F=e=>{let n=(0,D.c)(10),{chartCode:i}=e,o=t(u),s=a(),{createNewCell:l}=r(),d;n[0]!==o||n[1]!==l||n[2]!==s?(d=e=>{e.includes(`alt`)&&c({autoInstantiate:o,createNewCell:l,fromCellId:s}),l({code:e,before:!1,cellId:s??`__end__`})},n[0]=o,n[1]=l,n[2]=s,n[3]=d):d=n[3];let f=d,p;n[4]!==i||n[5]!==f?(p=g.stopPropagation(()=>f(i)),n[4]=i,n[5]=f,n[6]=p):p=n[6];let m;n[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,k.jsx)(E,{className:`h-3 w-3`}),n[7]=m):m=n[7];let v;return n[8]===p?v=n[9]:(v=(0,k.jsx)(h,{content:`Add chart to notebook`,delayDuration:400,children:(0,k.jsx)(_,{variant:`outline`,size:`icon`,className:`z-10 bg-background absolute right-1 -top-0.5`,onClick:p,children:m})}),n[8]=p,n[9]=v),v};export{M as a,j as i,A as n,E as o,P as r,F as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./feedback-button-eYsTCK-g.js";export{e as FeedbackModal};
|