@marimo-team/frontend 0.23.1-dev7 → 0.23.1-dev9
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-1vKptZLk.js → CellStatus-zTcdYfqx.js} +1 -1
- package/dist/assets/{JsonOutput-BsAmBgmA.js → JsonOutput-BY31ccA7.js} +1 -1
- package/dist/assets/{MarimoErrorOutput-BrEeS6om.js → MarimoErrorOutput--Yd2Aw0J.js} +1 -1
- package/dist/assets/{RenderHTML-DvfCr2Ox.js → RenderHTML-CbuarQqA.js} +1 -1
- package/dist/assets/{add-cell-with-ai-Dt7oHdbm.js → add-cell-with-ai-_Y6SqxBB.js} +1 -1
- package/dist/assets/{add-connection-dialog-CspEHMf4.js → add-connection-dialog-CjvNOKgb.js} +1 -1
- package/dist/assets/{agent-panel-BnU7gQWx.js → agent-panel-C24uwabG.js} +1 -1
- package/dist/assets/{ai-model-dropdown-Xik-y-L5.js → ai-model-dropdown-Dyxi3_nW.js} +1 -1
- package/dist/assets/{app-config-button-CHBHFhjc.js → app-config-button-BT2Do4RJ.js} +1 -1
- package/dist/assets/{cell-editor-D_3l2zTD.js → cell-editor-zW0u82sK.js} +1 -1
- package/dist/assets/{cell-link-DJVe6_Zu.js → cell-link-CRkrHl-y.js} +1 -1
- package/dist/assets/{cells-S7rO4svP.js → cells-BqYYXi6G.js} +69 -69
- package/dist/assets/{chat-display-CfEsEqVW.js → chat-display-DsHMZa9F.js} +1 -1
- package/dist/assets/{chat-panel-qK2fGD8c.js → chat-panel-o9D3upnX.js} +1 -1
- package/dist/assets/{chat-ui-D0Zk2tGi.js → chat-ui-BYS03y86.js} +1 -1
- package/dist/assets/{column-preview-BZ6dVJcf.js → column-preview-Dwv5a_zE.js} +1 -1
- package/dist/assets/{command-palette-1FgTXBti.js → command-palette-BYbKGSF3.js} +1 -1
- package/dist/assets/{common-BmgcLq5w.js → common-DeoGL9rK.js} +1 -1
- package/dist/assets/{components-B_dPGsbP.js → components-CDgxb-5o.js} +1 -1
- package/dist/assets/{components-D2yZZbqm.js → components-DKHyHZBv.js} +1 -1
- package/dist/assets/{datasource-t6MwjjVj.js → datasource-COFRe84u.js} +1 -1
- package/dist/assets/{dependency-graph-panel-BadtKupA.js → dependency-graph-panel-BXSe6z1R.js} +1 -1
- package/dist/assets/{documentation-panel-BsLlmX7w.js → documentation-panel-CA2pWMgB.js} +1 -1
- package/dist/assets/{download-Do1WPYs4.js → download-5XbM3TL_.js} +1 -1
- package/dist/assets/edit-page-CMUN3ESy.js +9 -0
- package/dist/assets/{error-panel-CBVjdcTs.js → error-panel-CbqfK1HJ.js} +1 -1
- package/dist/assets/{file-explorer-panel-DYR37L0M.js → file-explorer-panel-CbS8z-JR.js} +1 -1
- package/dist/assets/{file-icons-Ce885dch.js → file-icons-Bj5YoM7H.js} +1 -1
- package/dist/assets/{floating-outline-x0sdO8LG.js → floating-outline-XObNWtN8.js} +1 -1
- package/dist/assets/{focus-DTtb8f52.js → focus-DzMo6UAI.js} +1 -1
- package/dist/assets/{form-D_Nha4Lp.js → form-DLyXacSF.js} +1 -1
- package/dist/assets/{home-page-CoJ_ZMWR.js → home-page-BUdd5uTz.js} +1 -1
- package/dist/assets/{hooks-Cx6iKOXA.js → hooks-kZJc1iBf.js} +1 -1
- package/dist/assets/{html-to-image-B2vXpMPW.js → html-to-image-DGqJ93hW.js} +1 -1
- package/dist/assets/{index-B_D5e64b.js → index-Bm25ctN7.js} +22 -22
- package/dist/assets/index-CKRn_SiB.css +2 -0
- package/dist/assets/{kiosk-mode-FcVQMZAH.js → kiosk-mode-DYHoqMaZ.js} +1 -1
- package/dist/assets/layout-tmN-U1zs.js +9 -0
- package/dist/assets/{logs-panel-Dsopo0A4.js → logs-panel-CRW4c2IL.js} +1 -1
- package/dist/assets/{markdown-renderer-Ds5PRrQP.js → markdown-renderer-DNANigO8.js} +1 -1
- package/dist/assets/{name-cell-input-CYTm4rHn.js → name-cell-input-3iKP6YTw.js} +1 -1
- package/dist/assets/{outline-panel-C6Gebwlt.js → outline-panel-VIqWcHj6.js} +1 -1
- package/dist/assets/{packages-panel-Cx5Im5-h.js → packages-panel-D_z4ylBE.js} +1 -1
- package/dist/assets/panels-CLfdzLPR.js +1 -0
- package/dist/assets/{process-output-DxNLeVL1.js → process-output-Q6wVr7a-.js} +1 -1
- package/dist/assets/{readonly-python-code-CB7U_Wc5.js → readonly-python-code-CI_b818F.js} +1 -1
- package/dist/assets/{run-page-CGoGL9nm.js → run-page-DPuH6QY4.js} +1 -1
- package/dist/assets/{scratchpad-panel-DR4mmtqX.js → scratchpad-panel-BsMm0GQP.js} +1 -1
- package/dist/assets/{session-panel-DGqZrbYK.js → session-panel-CTDzGShO.js} +1 -1
- package/dist/assets/{slides-component-BIXn0Nqk.js → slides-component-ncUJNz7U.js} +1 -1
- package/dist/assets/{snippets-panel-CU_AkTo5.js → snippets-panel-CWof0wHk.js} +1 -1
- package/dist/assets/{state-Di6_R3-d.js → state-BvnlMKdT.js} +1 -1
- package/dist/assets/{state-iGDxMYGl.js → state-DPomuurt.js} +1 -1
- package/dist/assets/{textarea-cV4DzEoq.js → textarea-CS2o3y4W.js} +1 -1
- package/dist/assets/{tracing-6MHdsIto.js → tracing-CPDDwzIA.js} +1 -1
- package/dist/assets/{tracing-panel-Cwuf0kYN.js → tracing-panel-Ku1LapXJ.js} +2 -2
- package/dist/assets/{useAddCell-DDDgUZhC.js → useAddCell-B6yUY_RG.js} +1 -1
- package/dist/assets/{useCellActionButton-BceYv-6H.js → useCellActionButton-SxeK4dmW.js} +1 -1
- package/dist/assets/{useDeleteCell-CwBNr3-p.js → useDeleteCell-DHUjJQJx.js} +1 -1
- package/dist/assets/{useDependencyPanelTab-Bjv6Z79M.js → useDependencyPanelTab-CflgayoH.js} +1 -1
- package/dist/assets/{useNotebookActions-0DS32qpY.js → useNotebookActions-DHBEqrc_.js} +1 -1
- package/dist/assets/{useRunCells-Bf82xWy5.js → useRunCells-DFYAOTWd.js} +1 -1
- package/dist/assets/{useSplitCell-WZ71D3bV.js → useSplitCell-Bh-NZsBl.js} +1 -1
- package/dist/index.html +23 -23
- package/package.json +1 -1
- package/src/components/editor/renderers/slides-layout/slides-layout.tsx +50 -44
- package/src/components/slides/__tests__/minimap.test.ts +402 -0
- package/src/components/slides/minimap.tsx +534 -0
- package/src/components/slides/slide.tsx +29 -0
- package/src/components/slides/slides-component.tsx +16 -1
- package/src/core/cells/__tests__/cells.test.ts +105 -1
- package/src/core/cells/cells.ts +43 -0
- package/src/core/cells/document-changes.ts +2 -1
- package/src/plugins/impl/matplotlib/matplotlib-renderer.ts +38 -14
- package/dist/assets/edit-page-CSyxrzTp.js +0 -13
- package/dist/assets/index-qO0a4zuT.css +0 -2
- package/dist/assets/layout-DW9T7Upe.js +0 -5
- package/dist/assets/panels-CDCHQBRn.js +0 -1
|
@@ -22,7 +22,11 @@ import { foldAllBulk, unfoldAllBulk } from "@/core/codemirror/editing/commands";
|
|
|
22
22
|
import { adaptiveLanguageConfiguration } from "@/core/codemirror/language/extension";
|
|
23
23
|
import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
|
|
24
24
|
import type { OutputMessage } from "@/core/kernel/messages";
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
type CollapsibleTree,
|
|
27
|
+
MultiColumn,
|
|
28
|
+
type CellColumnId,
|
|
29
|
+
} from "@/utils/id-tree";
|
|
26
30
|
import type { Seconds } from "@/utils/time";
|
|
27
31
|
import {
|
|
28
32
|
exportedForTesting,
|
|
@@ -495,6 +499,106 @@ describe("cell reducer", () => {
|
|
|
495
499
|
`);
|
|
496
500
|
});
|
|
497
501
|
|
|
502
|
+
it("can move a cell to an exact index within a column", () => {
|
|
503
|
+
actions.createNewCell({
|
|
504
|
+
cellId: firstCellId,
|
|
505
|
+
before: false,
|
|
506
|
+
});
|
|
507
|
+
actions.createNewCell({
|
|
508
|
+
cellId: cellId("1"),
|
|
509
|
+
before: false,
|
|
510
|
+
});
|
|
511
|
+
|
|
512
|
+
const columnId = state.cellIds.atOrThrow(0).id;
|
|
513
|
+
actions.moveCellToIndex({
|
|
514
|
+
cellId: firstCellId,
|
|
515
|
+
columnId,
|
|
516
|
+
index: 3,
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
expect(formatCells(state)).toMatchInlineSnapshot(`
|
|
520
|
+
"
|
|
521
|
+
[1] ''
|
|
522
|
+
|
|
523
|
+
[2] ''
|
|
524
|
+
|
|
525
|
+
[0] ''
|
|
526
|
+
"
|
|
527
|
+
`);
|
|
528
|
+
});
|
|
529
|
+
|
|
530
|
+
it("can move a cell to an exact index across columns", () => {
|
|
531
|
+
actions.createNewCell({
|
|
532
|
+
cellId: firstCellId,
|
|
533
|
+
before: false,
|
|
534
|
+
});
|
|
535
|
+
actions.createNewCell({
|
|
536
|
+
cellId: cellId("1"),
|
|
537
|
+
before: false,
|
|
538
|
+
});
|
|
539
|
+
actions.addColumnBreakpoint({ cellId: cellId("1") });
|
|
540
|
+
|
|
541
|
+
const secondColumnId = state.cellIds.atOrThrow(1).id;
|
|
542
|
+
actions.moveCellToIndex({
|
|
543
|
+
cellId: firstCellId,
|
|
544
|
+
columnId: secondColumnId,
|
|
545
|
+
index: 1,
|
|
546
|
+
});
|
|
547
|
+
|
|
548
|
+
expect(formatCells(state)).toMatchInlineSnapshot(`
|
|
549
|
+
"
|
|
550
|
+
> col 0
|
|
551
|
+
|
|
552
|
+
|
|
553
|
+
> col 1
|
|
554
|
+
[1] ''
|
|
555
|
+
|
|
556
|
+
[0] ''
|
|
557
|
+
|
|
558
|
+
[2] ''
|
|
559
|
+
"
|
|
560
|
+
`);
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
it("moveCellToIndex is a no-op when moving to the same position", () => {
|
|
564
|
+
actions.createNewCell({
|
|
565
|
+
cellId: firstCellId,
|
|
566
|
+
before: false,
|
|
567
|
+
});
|
|
568
|
+
actions.createNewCell({
|
|
569
|
+
cellId: cellId("1"),
|
|
570
|
+
before: false,
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
const columnId = state.cellIds.atOrThrow(0).id;
|
|
574
|
+
const before = formatCells(state);
|
|
575
|
+
|
|
576
|
+
actions.moveCellToIndex({
|
|
577
|
+
cellId: firstCellId,
|
|
578
|
+
columnId,
|
|
579
|
+
index: 0,
|
|
580
|
+
});
|
|
581
|
+
|
|
582
|
+
expect(formatCells(state)).toBe(before);
|
|
583
|
+
});
|
|
584
|
+
|
|
585
|
+
it("moveCellToIndex is a no-op for an invalid columnId", () => {
|
|
586
|
+
actions.createNewCell({
|
|
587
|
+
cellId: firstCellId,
|
|
588
|
+
before: false,
|
|
589
|
+
});
|
|
590
|
+
|
|
591
|
+
const before = formatCells(state);
|
|
592
|
+
|
|
593
|
+
actions.moveCellToIndex({
|
|
594
|
+
cellId: firstCellId,
|
|
595
|
+
columnId: "nonexistent-column" as CellColumnId,
|
|
596
|
+
index: 0,
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
expect(formatCells(state)).toBe(before);
|
|
600
|
+
});
|
|
601
|
+
|
|
498
602
|
it("can run cell and receive cell messages", () => {
|
|
499
603
|
// HAPPY PATH
|
|
500
604
|
/////////////////
|
package/src/core/cells/cells.ts
CHANGED
|
@@ -338,6 +338,49 @@ const {
|
|
|
338
338
|
scrollKey: cellId,
|
|
339
339
|
};
|
|
340
340
|
},
|
|
341
|
+
moveCellToIndex: (
|
|
342
|
+
state,
|
|
343
|
+
action: {
|
|
344
|
+
cellId: CellId;
|
|
345
|
+
columnId: CellColumnId;
|
|
346
|
+
index: number;
|
|
347
|
+
},
|
|
348
|
+
) => {
|
|
349
|
+
const { cellId, columnId, index } = action;
|
|
350
|
+
const fromColumn = state.cellIds.findWithId(cellId);
|
|
351
|
+
const fromIndex = fromColumn.indexOfOrThrow(cellId);
|
|
352
|
+
|
|
353
|
+
const destinationColumn = state.cellIds.get(columnId);
|
|
354
|
+
if (!destinationColumn) {
|
|
355
|
+
return state;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
const clampedIndex = Math.max(0, Math.min(index, destinationColumn.length));
|
|
359
|
+
const adjustedIndex =
|
|
360
|
+
fromColumn.id === columnId && fromIndex < clampedIndex
|
|
361
|
+
? clampedIndex - 1
|
|
362
|
+
: clampedIndex;
|
|
363
|
+
|
|
364
|
+
if (fromColumn.id === columnId && fromIndex === adjustedIndex) {
|
|
365
|
+
return state;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
const withoutCell = state.cellIds.deleteById(cellId);
|
|
369
|
+
const updatedColumn = withoutCell.get(columnId);
|
|
370
|
+
if (!updatedColumn) {
|
|
371
|
+
return state;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return {
|
|
375
|
+
...state,
|
|
376
|
+
cellIds: withoutCell.insertId(
|
|
377
|
+
cellId,
|
|
378
|
+
columnId,
|
|
379
|
+
Math.max(0, Math.min(adjustedIndex, updatedColumn.length)),
|
|
380
|
+
),
|
|
381
|
+
scrollKey: null,
|
|
382
|
+
};
|
|
383
|
+
},
|
|
341
384
|
dropCellOverCell: (state, action: { cellId: CellId; overCellId: CellId }) => {
|
|
342
385
|
const { cellId, overCellId } = action;
|
|
343
386
|
|
|
@@ -215,12 +215,13 @@ export function toDocumentChanges(
|
|
|
215
215
|
];
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
// dropCellOverCell/dropCellOverColumn → set-config + reorder-cells
|
|
218
|
+
// dropCellOverCell/dropCellOverColumn/moveCellToIndex → set-config + reorder-cells
|
|
219
219
|
// Drag-and-drop reorders can move cells within or across columns.
|
|
220
220
|
// We emit config changes for cells whose column changed, then
|
|
221
221
|
// the full ordering.
|
|
222
222
|
case "dropCellOverCell":
|
|
223
223
|
case "dropCellOverColumn":
|
|
224
|
+
case "moveCellToIndex":
|
|
224
225
|
return columnChanges(prevState, newState);
|
|
225
226
|
|
|
226
227
|
// updateCellCode → set-code
|
|
@@ -297,13 +297,7 @@ export class MatplotlibRenderer {
|
|
|
297
297
|
// Create canvas
|
|
298
298
|
const canvas = document.createElement("canvas");
|
|
299
299
|
canvas.className = "block cursor-crosshair";
|
|
300
|
-
|
|
301
|
-
canvas.width = this.#state.width * dpr;
|
|
302
|
-
canvas.height = this.#state.height * dpr;
|
|
303
|
-
canvas.style.width = `${this.#state.width}px`;
|
|
304
|
-
canvas.style.maxWidth = "100%";
|
|
305
|
-
canvas.style.height = "auto";
|
|
306
|
-
canvas.style.aspectRatio = `${this.#state.width} / ${this.#state.height}`;
|
|
300
|
+
this.#syncCanvasSize(canvas);
|
|
307
301
|
canvas.style.touchAction = "none";
|
|
308
302
|
container.append(canvas);
|
|
309
303
|
this.#canvas = canvas;
|
|
@@ -322,6 +316,10 @@ export class MatplotlibRenderer {
|
|
|
322
316
|
signal: options.signal,
|
|
323
317
|
});
|
|
324
318
|
|
|
319
|
+
// Watch for devicePixelRatio changes (e.g. browser zoom, moving between
|
|
320
|
+
// displays). matchMedia fires exactly once per DPR transition.
|
|
321
|
+
this.#watchDevicePixelRatio(options.signal);
|
|
322
|
+
|
|
325
323
|
// Clean up on abort
|
|
326
324
|
options.signal.addEventListener("abort", () => {
|
|
327
325
|
cancelAnimationFrame(this.#rafId);
|
|
@@ -333,6 +331,38 @@ export class MatplotlibRenderer {
|
|
|
333
331
|
this.#restoreSelection(this.#state.value);
|
|
334
332
|
}
|
|
335
333
|
|
|
334
|
+
/** Set the canvas buffer + CSS size to match current logical size and DPR. */
|
|
335
|
+
#syncCanvasSize(canvas: HTMLCanvasElement = this.#canvas): void {
|
|
336
|
+
const dpr = globalThis.devicePixelRatio ?? 1;
|
|
337
|
+
const { width, height } = this.#state;
|
|
338
|
+
canvas.width = width * dpr;
|
|
339
|
+
canvas.height = height * dpr;
|
|
340
|
+
canvas.style.width = `${width}px`;
|
|
341
|
+
canvas.style.maxWidth = "100%";
|
|
342
|
+
canvas.style.height = "auto";
|
|
343
|
+
canvas.style.aspectRatio = `${width} / ${height}`;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
/**
|
|
347
|
+
* Observe devicePixelRatio changes via matchMedia. Each listener fires once
|
|
348
|
+
* per transition, so we re-register after every change.
|
|
349
|
+
*/
|
|
350
|
+
#watchDevicePixelRatio(signal: AbortSignal): void {
|
|
351
|
+
if (signal.aborted) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
const mq = matchMedia(
|
|
355
|
+
`(resolution: ${globalThis.devicePixelRatio ?? 1}dppx)`,
|
|
356
|
+
);
|
|
357
|
+
const onChange = () => {
|
|
358
|
+
this.#syncCanvasSize();
|
|
359
|
+
this.#drawCanvas();
|
|
360
|
+
// Re-register for the next DPR transition
|
|
361
|
+
this.#watchDevicePixelRatio(signal);
|
|
362
|
+
};
|
|
363
|
+
mq.addEventListener("change", onChange, { once: true, signal });
|
|
364
|
+
}
|
|
365
|
+
|
|
336
366
|
update(state: MatplotlibState): void {
|
|
337
367
|
const prev = this.#state;
|
|
338
368
|
this.#state = state;
|
|
@@ -341,13 +371,7 @@ export class MatplotlibRenderer {
|
|
|
341
371
|
|
|
342
372
|
// Update canvas dimensions if changed
|
|
343
373
|
if (state.width !== prev.width || state.height !== prev.height) {
|
|
344
|
-
|
|
345
|
-
this.#canvas.width = state.width * dpr;
|
|
346
|
-
this.#canvas.height = state.height * dpr;
|
|
347
|
-
this.#canvas.style.width = `${state.width}px`;
|
|
348
|
-
this.#canvas.style.maxWidth = "100%";
|
|
349
|
-
this.#canvas.style.height = "auto";
|
|
350
|
-
this.#canvas.style.aspectRatio = `${state.width} / ${state.height}`;
|
|
374
|
+
this.#syncCanvasSize();
|
|
351
375
|
needsRedraw = true;
|
|
352
376
|
}
|
|
353
377
|
|