@marimo-team/frontend 0.22.6-dev8 → 0.23.0
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/{add-cell-with-ai-DGlOf8Z8.js → add-cell-with-ai-3_AIzd22.js} +2 -2
- package/dist/assets/{agent-panel-DTnTi0AC.js → agent-panel-CdOqi3vb.js} +1 -1
- package/dist/assets/{ai-model-dropdown-CRtaHcCu.js → ai-model-dropdown-DWOGmhDj.js} +4 -4
- package/dist/assets/{app-config-button-CnX21edo.js → app-config-button-BxCSZCVS.js} +1 -1
- package/dist/assets/cell-editor-CuHdpTsy.js +22 -0
- package/dist/assets/{chat-display-DL75zaqJ.js → chat-display-DFUo2Riv.js} +1 -1
- package/dist/assets/{chat-panel-Dhp31YSq.js → chat-panel-Dl4jq1Dp.js} +2 -2
- package/dist/assets/{chat-ui-mZR0uCpP.js → chat-ui-CysJeVE6.js} +1 -1
- package/dist/assets/{command-palette-DX6TSAQd.js → command-palette-DaEVrXkC.js} +1 -1
- package/dist/assets/{edit-page-CoQU9h7s.js → edit-page-DOK2VJe6.js} +6 -6
- package/dist/assets/{home-page-BntiR5eS.js → home-page-CruHjoHv.js} +1 -1
- package/dist/assets/{index-BlbvNWcW.js → index-DW6VcSzY.js} +11 -11
- package/dist/assets/{packages-panel-5axf3DuF.js → packages-panel-DxS7zji3.js} +1 -1
- package/dist/assets/{scratchpad-panel-DX5u2q0x.js → scratchpad-panel-C8dGg-F9.js} +1 -1
- package/dist/assets/{useNotebookActions-bWbtL8Qj.js → useNotebookActions-aodoqUGd.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/components/app-config/user-config-form.tsx +25 -0
- package/src/components/editor/cell/code/cell-editor.tsx +4 -0
- package/src/core/codemirror/cm.ts +3 -1
- package/src/core/codemirror/completion/__tests__/keymap.test.ts +40 -1
- package/src/core/codemirror/completion/accept-on-enter-atom.ts +10 -0
- package/src/core/codemirror/completion/keymap.ts +16 -9
- package/src/plugins/impl/plotly/PlotlyPlugin.tsx +4 -2
- package/src/plugins/impl/plotly/__tests__/PlotlyPlugin.test.tsx +50 -0
- package/src/plugins/impl/plotly/__tests__/selection.test.ts +73 -0
- package/src/plugins/impl/plotly/selection.ts +35 -3
- package/dist/assets/cell-editor-b5nzU-br.js +0 -22
|
@@ -5,6 +5,7 @@ import { describe, expect, it, vi } from "vitest";
|
|
|
5
5
|
import {
|
|
6
6
|
extractIndices,
|
|
7
7
|
extractPoints,
|
|
8
|
+
hasAreaTrace,
|
|
8
9
|
hasPureLineTrace,
|
|
9
10
|
lineSelectionButtons,
|
|
10
11
|
type ModeBarButton,
|
|
@@ -101,6 +102,14 @@ describe("shouldHandleClickSelection", () => {
|
|
|
101
102
|
expect(shouldHandleClickSelection([heatmapPoint])).toBe(true);
|
|
102
103
|
});
|
|
103
104
|
|
|
105
|
+
it("accepts violin clicks", () => {
|
|
106
|
+
const violinPoint = createPlotDatum({
|
|
107
|
+
data: { type: "violin" },
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
expect(shouldHandleClickSelection([violinPoint])).toBe(true);
|
|
111
|
+
});
|
|
112
|
+
|
|
104
113
|
it("accepts histogram clicks", () => {
|
|
105
114
|
const histogramPoint = createPlotDatum({
|
|
106
115
|
data: { type: "histogram" },
|
|
@@ -219,3 +228,67 @@ describe("extractPoints", () => {
|
|
|
219
228
|
]);
|
|
220
229
|
});
|
|
221
230
|
});
|
|
231
|
+
|
|
232
|
+
describe("hasAreaTrace", () => {
|
|
233
|
+
it("detects scatter trace with tozeroy fill", () => {
|
|
234
|
+
expect(
|
|
235
|
+
hasAreaTrace([createTrace({ type: "scatter", fill: "tozeroy" })]),
|
|
236
|
+
).toBe(true);
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
it("detects scatter trace with tonexty fill", () => {
|
|
240
|
+
expect(
|
|
241
|
+
hasAreaTrace([createTrace({ type: "scatter", fill: "tonexty" })]),
|
|
242
|
+
).toBe(true);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it("detects scatter trace with stackgroup (px.area pattern)", () => {
|
|
246
|
+
expect(
|
|
247
|
+
hasAreaTrace([
|
|
248
|
+
createTrace({ type: "scatter", mode: "lines", stackgroup: "one" }),
|
|
249
|
+
]),
|
|
250
|
+
).toBe(true);
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it("detects area traces with mode=none (fill-only, no visible line)", () => {
|
|
254
|
+
expect(
|
|
255
|
+
hasAreaTrace([
|
|
256
|
+
createTrace({ type: "scatter", fill: "tozeroy", mode: "none" }),
|
|
257
|
+
]),
|
|
258
|
+
).toBe(true);
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
it("ignores scatter traces with no fill and no stackgroup", () => {
|
|
262
|
+
expect(
|
|
263
|
+
hasAreaTrace([
|
|
264
|
+
createTrace({ type: "scatter", mode: "lines" }),
|
|
265
|
+
createTrace({ type: "scatter", mode: "markers" }),
|
|
266
|
+
]),
|
|
267
|
+
).toBe(false);
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it("ignores scatter traces with fill=none", () => {
|
|
271
|
+
expect(hasAreaTrace([createTrace({ type: "scatter", fill: "none" })])).toBe(
|
|
272
|
+
false,
|
|
273
|
+
);
|
|
274
|
+
});
|
|
275
|
+
|
|
276
|
+
it("ignores scatter traces with fill=empty string", () => {
|
|
277
|
+
expect(
|
|
278
|
+
hasAreaTrace([createTrace({ type: "scatter", fill: "" as "none" })]),
|
|
279
|
+
).toBe(false);
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
it("ignores non-scatter traces", () => {
|
|
283
|
+
expect(
|
|
284
|
+
hasAreaTrace([
|
|
285
|
+
createTrace({ type: "bar" }),
|
|
286
|
+
createTrace({ type: "heatmap" }),
|
|
287
|
+
]),
|
|
288
|
+
).toBe(false);
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
it("returns false for undefined data", () => {
|
|
292
|
+
expect(hasAreaTrace(undefined)).toBe(false);
|
|
293
|
+
});
|
|
294
|
+
});
|
|
@@ -141,13 +141,44 @@ export function hasPureLineTrace(
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
return data.some((trace) => {
|
|
144
|
-
const
|
|
144
|
+
const t = trace as Record<string, unknown>;
|
|
145
145
|
const isScatterLike =
|
|
146
|
-
|
|
146
|
+
t.type === undefined || LINE_CLICK_TRACE_TYPES.has(String(t.type));
|
|
147
147
|
if (!isScatterLike) {
|
|
148
148
|
return false;
|
|
149
149
|
}
|
|
150
|
-
return isPureLineMode(
|
|
150
|
+
return isPureLineMode(t.mode);
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Return true when any scatter/scattergl trace has a non-empty fill or a
|
|
156
|
+
* stackgroup, i.e. it is an area chart.
|
|
157
|
+
*
|
|
158
|
+
* Area traces built with `mode="none"` have no visible line or markers, so
|
|
159
|
+
* `hasPureLineTrace` returns false for them even though they need select/lasso
|
|
160
|
+
* buttons just as much as `mode="lines"` area charts. This function covers
|
|
161
|
+
* that gap and is OR-ed with `hasPureLineTrace` in the config builder.
|
|
162
|
+
*/
|
|
163
|
+
export function hasAreaTrace(
|
|
164
|
+
data: readonly Plotly.Data[] | undefined,
|
|
165
|
+
): boolean {
|
|
166
|
+
if (!data) {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return data.some((trace) => {
|
|
171
|
+
const t = trace as Record<string, unknown>;
|
|
172
|
+
// Only scatter/scattergl can be area traces.
|
|
173
|
+
if (t.type !== undefined && !LINE_CLICK_TRACE_TYPES.has(String(t.type))) {
|
|
174
|
+
return false;
|
|
175
|
+
}
|
|
176
|
+
// A trace is an area trace when fill is a non-empty string other than
|
|
177
|
+
// "none", OR it belongs to a stackgroup (px.area always sets stackgroup).
|
|
178
|
+
return (
|
|
179
|
+
(typeof t.fill === "string" && t.fill !== "" && t.fill !== "none") ||
|
|
180
|
+
t.stackgroup != null
|
|
181
|
+
);
|
|
151
182
|
});
|
|
152
183
|
}
|
|
153
184
|
|
|
@@ -228,6 +259,7 @@ export function shouldHandleClickSelection(
|
|
|
228
259
|
type === "heatmap" ||
|
|
229
260
|
type === "histogram" ||
|
|
230
261
|
type === "waterfall" ||
|
|
262
|
+
type === "violin" ||
|
|
231
263
|
isLinePoint(point)
|
|
232
264
|
);
|
|
233
265
|
});
|