@marimo-team/islands 0.26.1-dev105 → 0.26.1-dev112
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-C6dY5fiI.js → ConnectedDataExplorerComponent-DQaiOY7w.js} +15 -15
- package/dist/{ErrorBoundary-Bn664FZa.js → ErrorBoundary-pNKOBKXw.js} +19 -19
- package/dist/{abnfDiagram-VCTEODGH-Ba0MYVW8.js → abnfDiagram-VCTEODGH-Df80tEYq.js} +2 -2
- package/dist/{any-language-editor-BNe8do3C.js → any-language-editor-BW-gNmbk.js} +2 -2
- package/dist/{architectureDiagram-5GKGNRK7-7MqAehef.js → architectureDiagram-5GKGNRK7-DNNMvKkY.js} +1 -1
- package/dist/{assertNever-5vhHGKOK.js → assertNever-B9_7z-dW.js} +13 -13
- package/dist/{chat-ui-zGgiq5zN.js → chat-ui-C9NZA-bk.js} +49 -49
- package/dist/{check-DUIc04aK.js → check-BqF09bSG.js} +1 -1
- package/dist/{chunk-IMKFNOWR-CAWA0HGB.js → chunk-IMKFNOWR-pXqnQ_fj.js} +1 -1
- package/dist/{chunk-SHT3W25Y-BIwVQjG5.js → chunk-SHT3W25Y-BWrxB3I2.js} +1 -1
- package/dist/{chunk-SVP7TREG-Cux251TB.js → chunk-SVP7TREG-CPdQP8_U.js} +1 -1
- package/dist/{chunk-TICWLB2K-DJVQ6khO.js → chunk-TICWLB2K-C5MYCwBz.js} +1 -1
- package/dist/{circle-question-mark-evCnVIut.js → circle-question-mark-YmLYXyvS.js} +1 -1
- package/dist/{classDiagram-ZZMXUADV-Cwve77ev.js → classDiagram-ZZMXUADV-Ba0SRm01.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-BAeHKXmD.js → classDiagram-v2-VYDZK3BY-DSSzL_Dk.js} +2 -2
- package/dist/{code-visibility-CMgSFUs7.js → code-visibility-B9s3Hl8z.js} +18 -18
- package/dist/{common-DWnR77Qk.js → common-Bn3jx0X6.js} +170 -168
- package/dist/{copy-icon-CmNLxT5_.js → copy-icon-zP4__HPI.js} +2 -2
- package/dist/{createReducer-m7yAXmDu.js → createReducer-CArOwUaJ.js} +1 -1
- package/dist/{cynefinDiagram-5FMLGOSQ-t4eEkPJh.js → cynefinDiagram-5FMLGOSQ-BOtNvA04.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-IuZuI28B.js → dagre-GXQ25YYZ-FpCEOTxX.js} +1 -1
- package/dist/{data-grid-overlay-editor-zS1h3iMI.js → data-grid-overlay-editor-mxwwRaQy.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-D8R5Q_ok.js → diagram-S7CK7UJ4-Cm1HaBuu.js} +1 -1
- package/dist/{diagram-UQ7AKVKN-BGuMPsr-.js → diagram-UQ7AKVKN-D1lA7Ggu.js} +1 -1
- package/dist/{diagram-VX7I27RA-BkTtpO8P.js → diagram-VX7I27RA-BX3e-Rue.js} +1 -1
- package/dist/{diagram-Z3DM3KII-C0__Mxfm.js → diagram-Z3DM3KII-Dgoj7bPf.js} +1 -1
- package/dist/{dialog-BvjfalZ9.js → dialog-DfKgafXJ.js} +30 -30
- package/dist/{dropdown-menu-D0DeN-aL.js → dropdown-menu-Dge_SmqE.js} +168 -168
- package/dist/{ebnfDiagram-PWID7BFC-CSESPZoz.js → ebnfDiagram-PWID7BFC-B0xWiXrz.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-DsDTtabH.js → erDiagram-RLTQ6QDP-Cm-GO31-.js} +1 -1
- package/dist/{error-banner-CXLjTW24.js → error-banner-CfYrJaIb.js} +91 -91
- package/dist/{error-entries-DVclFjaE.js → error-entries-1DC4BiYB.js} +661 -656
- package/dist/{export-context-CkgZeARR.js → export-context-B1jdxzHF.js} +21 -21
- package/dist/{feedback-button-BMGqp8Ff.js → feedback-button-BrzbnRTT.js} +72 -72
- package/dist/{flowDiagram-HODETNUW-qxDPYbfV.js → flowDiagram-HODETNUW-CH6xMlW_.js} +2 -2
- package/dist/{formats-CcQrzFo8.js → formats-Y52bg800.js} +1 -1
- package/dist/{glide-data-editor-Bra6h4KB.js → glide-data-editor-Cnsv3NcI.js} +11 -11
- package/dist/{glide-utils-CD8BaFTm.js → glide-utils-BRcuSTCx.js} +2 -2
- package/dist/{globals-_bXqC0R8.js → globals-BGqfFPx8.js} +3 -3
- package/dist/{html-to-image-Cst4BlIm.js → html-to-image-CsvAOgd3.js} +5073 -5076
- package/dist/{infoDiagram-27XIBGKW-B5hq8RM_.js → infoDiagram-27XIBGKW-DbUO63CX.js} +1 -1
- package/dist/{ishikawaDiagram-5VMMS53U-DkHc_9ET.js → ishikawaDiagram-5VMMS53U-CfQrrELH.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-CqkTFXmU.js → kanban-definition-UXKFOSKX-C5SJcu1W.js} +1 -1
- package/dist/{loader-CGrYn73j.js → loader-C9-qRO3m.js} +2 -2
- package/dist/main.js +6696 -6602
- package/dist/{mermaid-pmVHDUQA.js → mermaid-C2alqcd8.js} +34 -34
- package/dist/{mindmap-definition-YA3MSWOX-D6cNa__z.js → mindmap-definition-YA3MSWOX-ByVHE0Ax.js} +1 -1
- package/dist/{number-overlay-editor-XLUhOVa7.js → number-overlay-editor-DuSCOMTK.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-CmWJX_s1.js → pegDiagram-XKGWAZYB-DF5FBKZi.js} +2 -2
- package/dist/{pencil-CxMgOe04.js → pencil-D7jyZPnP.js} +1 -1
- package/dist/{pieDiagram-E7YTZNPT-CAQAxHah.js → pieDiagram-E7YTZNPT-B5n9nBQN.js} +1 -1
- package/dist/{process-output-DizFa5IE.js → process-output-CtfJ_Gbp.js} +4 -4
- package/dist/{railroadDiagram-O6MQD6OU-jlSsiQg3.js → railroadDiagram-O6MQD6OU-r5t7OYNE.js} +2 -2
- package/dist/{requirementDiagram-BXWQKSXE-DkDjfPhn.js → requirementDiagram-BXWQKSXE-D4QtEyZQ.js} +1 -1
- package/dist/{reveal-component-llpC324_.js → reveal-component-DzmiQyN9.js} +1008 -1008
- package/dist/{select-CEnB18uc.js → select-Buk3aXi1.js} +341 -341
- package/dist/{sequenceDiagram-WJ2MYXX4-DLywsGCW.js → sequenceDiagram-WJ2MYXX4-CK3Atn-z.js} +1 -1
- package/dist/{spec-Dz-Avv1m.js → spec-BEp9O9dy.js} +4 -4
- package/dist/{stateDiagram-D77RDMKH-DUmlKwYU.js → stateDiagram-D77RDMKH-C1SxRI8V.js} +2 -2
- package/dist/{stateDiagram-v2-MP3YSRHH-D646KiXs.js → stateDiagram-v2-MP3YSRHH-DK5X6bsr.js} +2 -2
- package/dist/{static-state-iw0PrHK4.js → static-state-D-aT9dOr.js} +9 -9
- package/dist/style.css +1 -1
- package/dist/{swimlanes-42K2YHIH-L7B1GphF.js → swimlanes-42K2YHIH-DdH5TZdu.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-DEu2wxtC.js → swimlanesDiagram-VR7AAH4N-CWBIvzgR.js} +2 -2
- package/dist/{timeline-definition-24CTP7MA-DDPyx1yG.js → timeline-definition-24CTP7MA-DE7-o2zU.js} +1 -1
- package/dist/{toast-BTjH6fIf.js → toast-b3k4YxaT.js} +54 -54
- package/dist/{tooltip-DyLdBIM4.js → tooltip-D-9pDheN.js} +62 -62
- package/dist/{use-restore-focus-DJ_-uSn_.js → use-restore-focus-CCfk-ey2.js} +1 -1
- package/dist/{useDateFormatter-HpKD0jEC.js → useDateFormatter-DH0uFwfL.js} +2 -2
- package/dist/{useDeepCompareMemoize-CHx-NxMl.js → useDeepCompareMemoize-Dn-ZJVTd.js} +1 -1
- package/dist/{useLifecycle-tPpAt-OE.js → useLifecycle-yjK7JsRL.js} +1 -1
- package/dist/{vega-component-BzNDFvQf.js → vega-component-BIq0qzhQ.js} +8 -8
- package/dist/{vennDiagram-4TSXK5OY-CRwWeb7g.js → vennDiagram-4TSXK5OY-D7yfNz0d.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-DVlG9eoq.js → wardleyDiagram-VM6X3IG4-m5Jcz26Z.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-CM32AISp.js → xychartDiagram-S5SC5T6Z-CA3zV3RW.js} +1 -1
- package/package.json +1 -1
- package/src/__mocks__/intersection-observer.ts +13 -12
- package/src/components/editor/Output.tsx +1 -1
- package/src/components/editor/__tests__/cell-renders.test.tsx +344 -2
- package/src/components/editor/ai/__tests__/completion-utils.test.ts +12 -20
- package/src/components/editor/ai/ai-completion-editor.tsx +391 -289
- package/src/components/editor/ai/completion-utils.ts +9 -7
- package/src/components/editor/cell/CellDeleteShoulder.tsx +82 -0
- package/src/components/editor/cell/DeleteButton.tsx +11 -2
- package/src/components/editor/cell/__tests__/CellDeleteShoulder.test.tsx +181 -0
- package/src/components/editor/cell/code/cell-editor.tsx +15 -25
- package/src/components/editor/chrome/panels/__tests__/logs-panel.test.tsx +26 -2
- package/src/components/editor/chrome/panels/logs-panel.tsx +27 -11
- package/src/components/editor/chrome/panels/outline/__tests__/outline-keyboard.test.tsx +517 -68
- package/src/components/editor/chrome/panels/outline/__tests__/useActiveOutline.test.ts +17 -5
- package/src/components/editor/chrome/panels/outline/floating-outline.tsx +29 -59
- package/src/components/editor/chrome/panels/outline/useActiveOutline.tsx +333 -133
- package/src/components/editor/chrome/panels/outline-panel.tsx +5 -19
- package/src/components/editor/notebook-cell.tsx +250 -274
- package/src/core/ai/state.ts +6 -0
- package/src/core/cells/__tests__/cells.test.ts +34 -20
- package/src/core/cells/__tests__/layout.test.ts +1 -1
- package/src/core/cells/__tests__/notebook-outline.test.ts +31 -3
- package/src/core/cells/cell-log-chunks.ts +31 -0
- package/src/core/cells/cells.ts +31 -20
- package/src/core/cells/outline.ts +8 -8
- package/src/core/codemirror/language/extension.ts +6 -3
- package/src/core/codemirror/language/panel/panel.test.tsx +144 -0
- package/src/core/codemirror/language/panel/panel.tsx +9 -6
- package/src/core/codemirror/lsp/__tests__/log-messages.test.ts +1 -1
- package/src/core/codemirror/lsp/__tests__/transports.test.ts +1 -1
- package/src/core/codemirror/react-dom/createPanel.tsx +15 -15
- package/src/core/dom/__tests__/outline.test.ts +29 -170
- package/src/core/dom/outline.ts +21 -61
- package/src/core/executions/atoms.ts +12 -4
- package/src/core/islands/__tests__/bridge.test.ts +2 -5
- package/src/core/islands/components/output-wrapper.tsx +7 -2
- package/src/core/session/__tests__/useNotebookSession.hook.test.tsx +10 -1
- package/src/css/common.css +11 -0
- package/src/hooks/useFinePointer.ts +30 -0
- package/src/plugins/layout/OutlinePlugin.tsx +5 -17
- package/src/stories/log-viewer.stories.tsx +48 -44
package/src/core/ai/state.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { FileUIPart } from "ai";
|
|
|
5
5
|
import { atom } from "jotai";
|
|
6
6
|
import { atomWithStorage } from "jotai/utils";
|
|
7
7
|
import { toast } from "@/components/ui/use-toast";
|
|
8
|
+
import { createKeyedSelectorHook } from "@/core/state/create-keyed-selector-hook";
|
|
8
9
|
import { uniqueBy } from "@/utils/arrays";
|
|
9
10
|
import { Logger } from "@/utils/Logger";
|
|
10
11
|
import { adaptForLocalStorage, jotaiJsonStorage } from "@/utils/storage/jotai";
|
|
@@ -24,6 +25,11 @@ export interface AiCompletionCell {
|
|
|
24
25
|
|
|
25
26
|
export const aiCompletionCellAtom = atom<AiCompletionCell | null>(null);
|
|
26
27
|
|
|
28
|
+
export const useAiCompletionCell = createKeyedSelectorHook(
|
|
29
|
+
aiCompletionCellAtom,
|
|
30
|
+
(target, cellId: CellId) => (target?.cellId === cellId ? target : null),
|
|
31
|
+
);
|
|
32
|
+
|
|
27
33
|
/**
|
|
28
34
|
* A prompt queued to be delivered to the AI assistant panel.
|
|
29
35
|
* The active panel consumes this on mount/when ready, then clears it.
|
|
@@ -21,6 +21,8 @@ import { MockExecutions } from "@/__mocks__/executions";
|
|
|
21
21
|
import { MockNotebook } from "@/__mocks__/notebook";
|
|
22
22
|
import { cellId } from "@/__tests__/branded";
|
|
23
23
|
import type { CellHandle } from "@/components/editor/notebook-cell";
|
|
24
|
+
import { LOG_CHUNK_SIZE } from "../cell-log-chunks";
|
|
25
|
+
import type { CellLog } from "../logs";
|
|
24
26
|
import { CellId, SCRATCH_CELL_ID } from "@/core/cells/ids";
|
|
25
27
|
import { foldAllBulk, unfoldAllBulk } from "@/core/codemirror/editing/commands";
|
|
26
28
|
import { adaptiveLanguageConfiguration } from "@/core/codemirror/language/extension";
|
|
@@ -235,23 +237,33 @@ describe("cell reducer", () => {
|
|
|
235
237
|
expect(unfoldAllBulk).toHaveBeenCalled();
|
|
236
238
|
});
|
|
237
239
|
|
|
238
|
-
it("
|
|
239
|
-
|
|
240
|
-
{
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
240
|
+
it("retains ordered log batches across appends and runtime resets until cleared", () => {
|
|
241
|
+
const logs = Array.from(
|
|
242
|
+
{ length: 3 * LOG_CHUNK_SIZE + 2 },
|
|
243
|
+
(_, i): CellLog => ({
|
|
244
|
+
level: i % 2 === 0 ? "stdout" : "stderr",
|
|
245
|
+
message: String(i),
|
|
246
|
+
timestamp: i,
|
|
244
247
|
source: { type: "cell", cellId: firstCellId },
|
|
245
|
-
},
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
248
|
+
}),
|
|
249
|
+
);
|
|
250
|
+
actions.addLogs({ logs: logs.slice(0, LOG_CHUNK_SIZE + 1) });
|
|
251
|
+
const previous = state;
|
|
252
|
+
actions.addLogs({ logs: [] });
|
|
253
|
+
expect(state).toBe(previous);
|
|
254
|
+
actions.addLogs({ logs: logs.slice(LOG_CHUNK_SIZE + 1, -1) });
|
|
255
|
+
actions.addLogs({ logs: logs.slice(-1) });
|
|
256
|
+
const appended = state.cellLogs;
|
|
257
|
+
expect(appended[0]).toBe(previous.cellLogs[0]);
|
|
258
|
+
expect(previous.cellLogs.flat()).toEqual(logs.slice(0, LOG_CHUNK_SIZE + 1));
|
|
259
|
+
expect(appended.flat()).toEqual(logs);
|
|
260
|
+
actions.resetCellRuntimes(false);
|
|
261
|
+
expect(state.cellLogs).toBe(appended);
|
|
253
262
|
actions.clearLogs();
|
|
254
263
|
expect(state.cellLogs).toEqual([]);
|
|
264
|
+
actions.addLogs({ logs: logs.slice(-1) });
|
|
265
|
+
expect(state.cellLogs.flat()).toEqual(logs.slice(-1));
|
|
266
|
+
expect(appended.flat()).toEqual(logs);
|
|
255
267
|
});
|
|
256
268
|
|
|
257
269
|
describe("releaseCellAtoms", () => {
|
|
@@ -289,12 +301,14 @@ it("keeps layout cells stable when only a notebook log changes", () => {
|
|
|
289
301
|
store.set(notebookAtom, {
|
|
290
302
|
...notebook,
|
|
291
303
|
cellLogs: [
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
304
|
+
[
|
|
305
|
+
{
|
|
306
|
+
level: "stderr",
|
|
307
|
+
message: "log",
|
|
308
|
+
timestamp: 0,
|
|
309
|
+
source: { type: "cell", cellId: id },
|
|
310
|
+
},
|
|
311
|
+
],
|
|
298
312
|
],
|
|
299
313
|
});
|
|
300
314
|
expect(store.get(renderedNotebookCellsAtom)).toBe(cells);
|
|
@@ -27,7 +27,7 @@ const [h1, a, h2, b, c, h1b, d] = ["h1", "a", "h2", "b", "c", "h1b", "d"].map(
|
|
|
27
27
|
const ids = [h1, a, h2, b, c, h1b, d];
|
|
28
28
|
|
|
29
29
|
function heading(level: number): Outline {
|
|
30
|
-
return { items: [{ name: `H${level}`, level,
|
|
30
|
+
return { items: [{ name: `H${level}`, level, id: `h${level}` }] };
|
|
31
31
|
}
|
|
32
32
|
const outlines = new Map<CellId, Outline>([
|
|
33
33
|
[h1, heading(1)],
|
|
@@ -7,6 +7,7 @@ import { MockNotebook } from "@/__mocks__/notebook";
|
|
|
7
7
|
import { cellId } from "@/__tests__/branded";
|
|
8
8
|
import { CONFIG } from "@/core/notebook/document/__tests__/fixtures";
|
|
9
9
|
import {
|
|
10
|
+
cellOutlinesAtom,
|
|
10
11
|
createNotebookActions,
|
|
11
12
|
notebookAtom,
|
|
12
13
|
notebookOutline,
|
|
@@ -21,8 +22,8 @@ function showed(id: string, html: string) {
|
|
|
21
22
|
return MockExecutions.shown(id, { mimetype: "text/html", data: html });
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
const firstItem = { name: "First", level: 1,
|
|
25
|
-
const secondItem = { name: "Second", level: 2,
|
|
25
|
+
const firstItem = { name: "First", level: 1, id: "first", cellId: first };
|
|
26
|
+
const secondItem = { name: "Second", level: 2, id: "second", cellId: second };
|
|
26
27
|
|
|
27
28
|
function setup() {
|
|
28
29
|
const store = createStore();
|
|
@@ -56,6 +57,33 @@ describe("notebookOutline", () => {
|
|
|
56
57
|
});
|
|
57
58
|
});
|
|
58
59
|
|
|
60
|
+
it("keeps each store's outline identities independent", () => {
|
|
61
|
+
const firstNotebook = setup();
|
|
62
|
+
const secondNotebook = setup();
|
|
63
|
+
const outlines = firstNotebook.store.get(cellOutlinesAtom);
|
|
64
|
+
const outline = firstNotebook.store.get(notebookOutline);
|
|
65
|
+
expect(secondNotebook.store.get(cellOutlinesAtom)).toEqual(outlines);
|
|
66
|
+
expect(secondNotebook.store.get(cellOutlinesAtom)).not.toBe(outlines);
|
|
67
|
+
|
|
68
|
+
secondNotebook.report([showed(first, "<h1>Different heading</h1>")]);
|
|
69
|
+
|
|
70
|
+
expect(firstNotebook.store.get(cellOutlinesAtom)).toBe(outlines);
|
|
71
|
+
expect(firstNotebook.store.get(notebookOutline)).toBe(outline);
|
|
72
|
+
expect(
|
|
73
|
+
secondNotebook.store.get(notebookOutline).items.map(({ name }) => name),
|
|
74
|
+
).toEqual(["Different heading"]);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("returns an empty outline in a runtime without DOMParser", () => {
|
|
78
|
+
vi.stubGlobal("DOMParser", undefined);
|
|
79
|
+
try {
|
|
80
|
+
const { store } = setup();
|
|
81
|
+
expect(store.get(notebookOutline)).toEqual({ items: [] });
|
|
82
|
+
} finally {
|
|
83
|
+
vi.unstubAllGlobals();
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
59
87
|
it("does not notify outline subscribers when cell code changes", () => {
|
|
60
88
|
const { store } = setup();
|
|
61
89
|
const initial = store.get(notebookOutline);
|
|
@@ -83,7 +111,7 @@ describe("notebookOutline", () => {
|
|
|
83
111
|
showed(second, '<h2 id="second">Second</h2>'),
|
|
84
112
|
]);
|
|
85
113
|
expect(store.get(notebookOutline)).toEqual({
|
|
86
|
-
items: [{ name: "Updated",
|
|
114
|
+
items: [{ ...firstItem, name: "Updated", id: "updated" }, secondItem],
|
|
87
115
|
});
|
|
88
116
|
|
|
89
117
|
report([showed(second, '<h2 id="second">Second</h2>')]);
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import type { CellLog } from "./logs";
|
|
4
|
+
|
|
5
|
+
export type CellLogChunks = readonly (readonly CellLog[])[];
|
|
6
|
+
export const LOG_CHUNK_SIZE = 128;
|
|
7
|
+
|
|
8
|
+
/** Full chunks stay shared with previous notebook snapshots. */
|
|
9
|
+
export function appendCellLogs(
|
|
10
|
+
chunks: CellLogChunks,
|
|
11
|
+
logs: readonly CellLog[],
|
|
12
|
+
): CellLogChunks {
|
|
13
|
+
if (logs.length === 0) {
|
|
14
|
+
return chunks;
|
|
15
|
+
}
|
|
16
|
+
const next = [...chunks];
|
|
17
|
+
const last = next.at(-1);
|
|
18
|
+
let offset = 0;
|
|
19
|
+
if (last && last.length < LOG_CHUNK_SIZE) {
|
|
20
|
+
const tail = [...last];
|
|
21
|
+
while (offset < logs.length && tail.length < LOG_CHUNK_SIZE) {
|
|
22
|
+
tail.push(logs[offset]);
|
|
23
|
+
offset++;
|
|
24
|
+
}
|
|
25
|
+
next[next.length - 1] = tail;
|
|
26
|
+
}
|
|
27
|
+
for (; offset < logs.length; offset += LOG_CHUNK_SIZE) {
|
|
28
|
+
next.push(logs.slice(offset, offset + LOG_CHUNK_SIZE));
|
|
29
|
+
}
|
|
30
|
+
return next;
|
|
31
|
+
}
|
package/src/core/cells/cells.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import type { EditorView } from "@codemirror/view";
|
|
4
4
|
import type * as Protocol from "@marimo-team/client/protocol";
|
|
5
|
+
import { dequal } from "dequal";
|
|
5
6
|
import { type Atom, atom, useAtom, useAtomValue } from "jotai";
|
|
6
7
|
import { atomFamily, selectAtom, splitAtom } from "jotai/utils";
|
|
7
8
|
import { createRef, type ReducerWithoutAction } from "react";
|
|
@@ -17,6 +18,7 @@ import {
|
|
|
17
18
|
releaseCellOutputAtoms,
|
|
18
19
|
} from "@/core/executions";
|
|
19
20
|
import type { CellColumnId } from "./layout";
|
|
21
|
+
import { Functions } from "@/utils/functions";
|
|
20
22
|
import { invariant } from "@/utils/invariant";
|
|
21
23
|
import { Logger } from "@/utils/Logger";
|
|
22
24
|
import { Objects } from "@/utils/objects";
|
|
@@ -25,7 +27,6 @@ import { createReducerAndAtoms } from "../../utils/createReducer";
|
|
|
25
27
|
import { foldAllBulk, unfoldAllBulk } from "../codemirror/editing/commands";
|
|
26
28
|
import { editorMountScheduler } from "../codemirror/editor-mount-scheduler";
|
|
27
29
|
import type { SerializedEditorState } from "../codemirror/types";
|
|
28
|
-
import { mergeOutlines } from "../dom/outline";
|
|
29
30
|
import { activeNotebookFrameAtom } from "../session/active-notebook";
|
|
30
31
|
import { isErrorMime } from "../mime";
|
|
31
32
|
import { createDeepEqualAtom, store } from "../state/jotai";
|
|
@@ -39,8 +40,9 @@ import { consoleExecution, consoleView } from "./execution-console";
|
|
|
39
40
|
import { applyDocument } from "./document";
|
|
40
41
|
import { isCodeHidden, shownHiddenCodeAtom } from "./editor";
|
|
41
42
|
import { type CellId, SCRATCH_CELL_ID } from "./ids";
|
|
43
|
+
import { appendCellLogs, type CellLogChunks } from "./cell-log-chunks";
|
|
42
44
|
import { type CellLog, getCellLogsForMessage } from "./logs";
|
|
43
|
-
import type { Outline } from "./outline";
|
|
45
|
+
import type { NotebookOutlineItem, Outline } from "./outline";
|
|
44
46
|
import { focusAndScrollCellIntoView } from "./scrollCellIntoView";
|
|
45
47
|
import {
|
|
46
48
|
type CellData,
|
|
@@ -119,7 +121,7 @@ export interface NotebookState {
|
|
|
119
121
|
/**
|
|
120
122
|
* Logs of all cell messages
|
|
121
123
|
*/
|
|
122
|
-
cellLogs:
|
|
124
|
+
cellLogs: CellLogChunks;
|
|
123
125
|
}
|
|
124
126
|
|
|
125
127
|
function withScratchCell(notebookState: NotebookState): NotebookState {
|
|
@@ -202,10 +204,10 @@ const {
|
|
|
202
204
|
? next
|
|
203
205
|
: {
|
|
204
206
|
...next,
|
|
205
|
-
cellLogs:
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
207
|
+
cellLogs: appendCellLogs(
|
|
208
|
+
next.cellLogs,
|
|
209
|
+
getCellLogsForMessage({ cell_id, console: entries }),
|
|
210
|
+
),
|
|
209
211
|
};
|
|
210
212
|
},
|
|
211
213
|
hideConsoleInputs: (
|
|
@@ -249,9 +251,12 @@ const {
|
|
|
249
251
|
return { ...state, cellRuntime };
|
|
250
252
|
},
|
|
251
253
|
addLogs: (state, action: { logs: CellLog[] }) => {
|
|
254
|
+
if (action.logs.length === 0) {
|
|
255
|
+
return state;
|
|
256
|
+
}
|
|
252
257
|
return {
|
|
253
258
|
...state,
|
|
254
|
-
cellLogs:
|
|
259
|
+
cellLogs: appendCellLogs(state.cellLogs, action.logs),
|
|
255
260
|
};
|
|
256
261
|
},
|
|
257
262
|
/** Follow the host document's cells and order. */
|
|
@@ -475,28 +480,34 @@ export const cellErrorsAtom = atom((get) => {
|
|
|
475
480
|
return errors;
|
|
476
481
|
});
|
|
477
482
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
* readers are left alone by the runs that change no heading.
|
|
481
|
-
*/
|
|
482
|
-
export const cellOutlinesAtom = createDeepEqualAtom(
|
|
483
|
+
// Layout needs lookup by cell ID. Navigation needs the same headings in document order.
|
|
484
|
+
const orderedCellOutlines = selectAtom(
|
|
483
485
|
atom((get) => {
|
|
484
|
-
const
|
|
486
|
+
const entries: [CellId, Outline][] = [];
|
|
485
487
|
for (const cellId of get(cellIdsAtom)) {
|
|
486
488
|
const outline = get(cellOutlineAtom(cellId));
|
|
487
|
-
if (outline
|
|
488
|
-
|
|
489
|
+
if (outline && outline.items.length > 0) {
|
|
490
|
+
entries.push([cellId, outline]);
|
|
489
491
|
}
|
|
490
492
|
}
|
|
491
|
-
return
|
|
493
|
+
return entries;
|
|
492
494
|
}),
|
|
495
|
+
Functions.identity,
|
|
496
|
+
dequal,
|
|
493
497
|
);
|
|
494
498
|
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
499
|
+
export const cellOutlinesAtom = selectAtom(
|
|
500
|
+
orderedCellOutlines,
|
|
501
|
+
(entries): Partial<Record<CellId, Outline>> => Object.fromEntries(entries),
|
|
502
|
+
dequal,
|
|
498
503
|
);
|
|
499
504
|
|
|
505
|
+
export const notebookOutline = selectAtom(orderedCellOutlines, (entries) => ({
|
|
506
|
+
items: entries.flatMap<NotebookOutlineItem>(([cellId, outline]) =>
|
|
507
|
+
outline.items.map((item) => ({ ...item, cellId })),
|
|
508
|
+
),
|
|
509
|
+
}));
|
|
510
|
+
|
|
500
511
|
export const cellErrorCount = atom((get) => get(cellErrorsAtom).length);
|
|
501
512
|
|
|
502
513
|
export const cellIdToNamesMap = createDeepEqualAtom(
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
|
+
import type { CellId } from "./ids";
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* Table of contents outline.
|
|
5
7
|
*/
|
|
@@ -14,14 +16,8 @@ export interface OutlineItem {
|
|
|
14
16
|
* render this instead of the plain-text `name`.
|
|
15
17
|
*/
|
|
16
18
|
html?: string;
|
|
17
|
-
/**
|
|
18
|
-
|
|
19
|
-
*
|
|
20
|
-
* If `id` is provided, the item is located by #id.
|
|
21
|
-
*
|
|
22
|
-
* If `path` is provided, the item is located by xpath.
|
|
23
|
-
*/
|
|
24
|
-
by: { id: string } | { path: string };
|
|
19
|
+
/** The heading's ID, if present. Otherwise, match by name and level. */
|
|
20
|
+
id?: string;
|
|
25
21
|
/**
|
|
26
22
|
* The level of the item.
|
|
27
23
|
* h1 -> 1
|
|
@@ -34,3 +30,7 @@ export interface OutlineItem {
|
|
|
34
30
|
export interface Outline {
|
|
35
31
|
items: OutlineItem[];
|
|
36
32
|
}
|
|
33
|
+
|
|
34
|
+
export interface NotebookOutlineItem extends OutlineItem {
|
|
35
|
+
cellId: CellId;
|
|
36
|
+
}
|
|
@@ -33,7 +33,10 @@ import { getLanguageAdapters, LanguageAdapters } from "./LanguageAdapters";
|
|
|
33
33
|
import { sqlDialectEffect } from "./languages/sql/sql";
|
|
34
34
|
import type { LanguageMetadata } from "./metadata";
|
|
35
35
|
import { languageMetadataField, setLanguageMetadata } from "./metadata";
|
|
36
|
-
import {
|
|
36
|
+
import {
|
|
37
|
+
LanguagePanelComponent,
|
|
38
|
+
languagePanelInputsChanged,
|
|
39
|
+
} from "./panel/panel";
|
|
37
40
|
import type { LanguageAdapter } from "./types";
|
|
38
41
|
import { getEditorCodeAsPython } from "./utils";
|
|
39
42
|
|
|
@@ -89,13 +92,13 @@ export const languageAdapterState = StateField.define<LanguageAdapter>({
|
|
|
89
92
|
}
|
|
90
93
|
return value;
|
|
91
94
|
},
|
|
92
|
-
// Only show the panel if the language is not python
|
|
93
95
|
provide: (field) =>
|
|
94
96
|
showPanel.from(field, (value) => {
|
|
95
97
|
if (value.type === "python") {
|
|
96
98
|
return null;
|
|
97
99
|
}
|
|
98
|
-
return (view) =>
|
|
100
|
+
return (view) =>
|
|
101
|
+
createPanel(view, LanguagePanelComponent, languagePanelInputsChanged);
|
|
99
102
|
}),
|
|
100
103
|
});
|
|
101
104
|
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { Compartment } from "@codemirror/state";
|
|
4
|
+
import { EditorView } from "@codemirror/view";
|
|
5
|
+
import { act, fireEvent, within } from "@testing-library/react";
|
|
6
|
+
import type { createRoot, Root } from "react-dom/client";
|
|
7
|
+
import { describe, expect, it, onTestFinished, vi } from "vitest";
|
|
8
|
+
import { DATA_FOR_CELL_ID } from "@/components/data-table/cell-utils";
|
|
9
|
+
import { CellId } from "@/core/cells/ids";
|
|
10
|
+
import { cellIdState } from "@/core/codemirror/cells/state";
|
|
11
|
+
import { cellConfigExtension } from "@/core/codemirror/config/extension";
|
|
12
|
+
import { defaultUserConfig } from "@/core/config/config-schema";
|
|
13
|
+
import { OverridingHotkeyProvider } from "@/core/hotkeys/hotkeys";
|
|
14
|
+
import { adaptiveLanguageConfiguration, switchLanguage } from "../extension";
|
|
15
|
+
import { languageMetadataField, updateLanguageMetadata } from "../metadata";
|
|
16
|
+
|
|
17
|
+
const trackRoot = vi.hoisted(() => vi.fn<(root: Root) => void>());
|
|
18
|
+
|
|
19
|
+
vi.mock("react-dom/client", async (importOriginal) => {
|
|
20
|
+
const original = await importOriginal<typeof import("react-dom/client")>();
|
|
21
|
+
return {
|
|
22
|
+
...original,
|
|
23
|
+
createRoot: (...args: Parameters<typeof createRoot>) => {
|
|
24
|
+
const root = original.createRoot(...args);
|
|
25
|
+
vi.spyOn(root, "render");
|
|
26
|
+
vi.spyOn(root, "unmount");
|
|
27
|
+
trackRoot(root);
|
|
28
|
+
return root;
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
vi.mock("@/components/editor/connections/components", () => ({
|
|
34
|
+
useAddDetectedDataSource: () => vi.fn(),
|
|
35
|
+
}));
|
|
36
|
+
|
|
37
|
+
const config = defaultUserConfig();
|
|
38
|
+
const options = {
|
|
39
|
+
cellId: CellId.create(),
|
|
40
|
+
completionConfig: config.completion,
|
|
41
|
+
lspConfig: config.language_servers,
|
|
42
|
+
diagnosticsConfig: config.diagnostics,
|
|
43
|
+
hotkeys: new OverridingHotkeyProvider({}),
|
|
44
|
+
placeholderType: "marimo-import" as const,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const cellId = new Compartment();
|
|
48
|
+
|
|
49
|
+
async function mountPanel(language: "markdown" | "sql") {
|
|
50
|
+
const view = new EditorView({
|
|
51
|
+
parent: document.body,
|
|
52
|
+
doc:
|
|
53
|
+
language === "markdown" ? 'mo.md(r"hello")' : 'df = mo.sql("select 1")',
|
|
54
|
+
extensions: [
|
|
55
|
+
cellConfigExtension(options),
|
|
56
|
+
cellId.of(cellIdState.of(options.cellId)),
|
|
57
|
+
adaptiveLanguageConfiguration(options),
|
|
58
|
+
],
|
|
59
|
+
});
|
|
60
|
+
onTestFinished(() => act(() => view.destroy()));
|
|
61
|
+
await act(() => switchLanguage(view, { language }));
|
|
62
|
+
const [root] = trackRoot.mock.calls[0];
|
|
63
|
+
return { view, root, panel: within(view.dom) };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
describe("language panel renders", () => {
|
|
67
|
+
it.each(["markdown", "sql"] as const)(
|
|
68
|
+
"renders %s once across selection and document edits",
|
|
69
|
+
async (language) => {
|
|
70
|
+
const { view, root } = await mountPanel(language);
|
|
71
|
+
expect(root.render).toHaveBeenCalledTimes(1);
|
|
72
|
+
|
|
73
|
+
await act(() => {
|
|
74
|
+
view.dispatch({ selection: { anchor: 1 } });
|
|
75
|
+
view.dispatch({ changes: { from: 0, insert: "x" } });
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
expect(trackRoot).toHaveBeenCalledTimes(1);
|
|
79
|
+
expect(root.render).toHaveBeenCalledTimes(1);
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
it("updates the Markdown prefix when the checkbox changes", async () => {
|
|
84
|
+
const { view, panel } = await mountPanel("markdown");
|
|
85
|
+
const checkbox = panel.getByRole("checkbox", { name: "Toggle f-string" });
|
|
86
|
+
expect(checkbox).not.toBeChecked();
|
|
87
|
+
fireEvent.click(checkbox);
|
|
88
|
+
expect(view.state.field(languageMetadataField).quotePrefix).toContain("f");
|
|
89
|
+
expect(checkbox).toBeChecked();
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it("defaults a missing Markdown prefix to raw", async () => {
|
|
93
|
+
const { view, panel } = await mountPanel("markdown");
|
|
94
|
+
await act(() =>
|
|
95
|
+
view.dispatch({
|
|
96
|
+
effects: updateLanguageMetadata.of({ quotePrefix: undefined }),
|
|
97
|
+
}),
|
|
98
|
+
);
|
|
99
|
+
expect(view.state.field(languageMetadataField).quotePrefix).toBe("r");
|
|
100
|
+
expect(
|
|
101
|
+
panel.getByRole("checkbox", { name: "Toggle raw string" }),
|
|
102
|
+
).toBeChecked();
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
it("updates the SQL hide-output control when metadata changes", async () => {
|
|
106
|
+
const { view, panel } = await mountPanel("sql");
|
|
107
|
+
const output = panel.getByRole("checkbox", { name: "Hide output" });
|
|
108
|
+
expect(output).not.toBeChecked();
|
|
109
|
+
await act(() =>
|
|
110
|
+
view.dispatch({
|
|
111
|
+
effects: updateLanguageMetadata.of({ showOutput: false }),
|
|
112
|
+
}),
|
|
113
|
+
);
|
|
114
|
+
expect(output).toBeChecked();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it("updates the SQL engine selector when only the cell ID changes", async () => {
|
|
118
|
+
const { view, panel } = await mountPanel("sql");
|
|
119
|
+
const selector = panel.getByRole("combobox");
|
|
120
|
+
expect(selector).toHaveAttribute(DATA_FOR_CELL_ID, options.cellId);
|
|
121
|
+
const nextId = CellId.create();
|
|
122
|
+
await act(() =>
|
|
123
|
+
view.dispatch({
|
|
124
|
+
effects: cellId.reconfigure(cellIdState.of(nextId)),
|
|
125
|
+
}),
|
|
126
|
+
);
|
|
127
|
+
expect(selector).toHaveAttribute(DATA_FOR_CELL_ID, nextId);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("replaces the SQL panel for Markdown and removes it for Python", async () => {
|
|
131
|
+
const { view, root, panel } = await mountPanel("sql");
|
|
132
|
+
await act(() => switchLanguage(view, { language: "markdown" }));
|
|
133
|
+
expect(root.unmount).toHaveBeenCalledTimes(1);
|
|
134
|
+
expect(trackRoot).toHaveBeenCalledTimes(2);
|
|
135
|
+
expect(
|
|
136
|
+
panel.getByRole("checkbox", { name: "Toggle f-string" }),
|
|
137
|
+
).toBeInTheDocument();
|
|
138
|
+
|
|
139
|
+
const [markdownRoot] = trackRoot.mock.calls[1];
|
|
140
|
+
await act(() => switchLanguage(view, { language: "python" }));
|
|
141
|
+
expect(markdownRoot.unmount).toHaveBeenCalledTimes(1);
|
|
142
|
+
expect(view.dom.querySelector(".cm-panel")).toBeNull();
|
|
143
|
+
});
|
|
144
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
-
import type { EditorView } from "@codemirror/view";
|
|
2
|
+
import type { EditorView, ViewUpdate } from "@codemirror/view";
|
|
3
3
|
import type { QuotePrefixKind } from "@marimo-team/smart-cells";
|
|
4
4
|
import { InfoIcon, PaintRollerIcon } from "lucide-react";
|
|
5
5
|
import { Button } from "@/components/ui/button";
|
|
@@ -25,6 +25,14 @@ import type { LanguageMetadataOf } from "../types";
|
|
|
25
25
|
import { getQuotePrefix, MarkdownQuotePrefixTooltip } from "./markdown";
|
|
26
26
|
import { SQLEngineSelect, SQLModeSelect } from "./sql";
|
|
27
27
|
|
|
28
|
+
export function languagePanelInputsChanged(update: ViewUpdate): boolean {
|
|
29
|
+
return (
|
|
30
|
+
update.startState.field(languageMetadataField) !==
|
|
31
|
+
update.state.field(languageMetadataField) ||
|
|
32
|
+
update.startState.facet(cellIdState) !== update.state.facet(cellIdState)
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
28
36
|
const Divider = () => <div className="h-4 border-r border-border" />;
|
|
29
37
|
|
|
30
38
|
export const LanguagePanelComponent: React.FC<{
|
|
@@ -58,7 +66,6 @@ export const LanguagePanelComponent: React.FC<{
|
|
|
58
66
|
const sanitizeAndTriggerUpdate = (
|
|
59
67
|
e: React.SyntheticEvent<HTMLInputElement>,
|
|
60
68
|
) => {
|
|
61
|
-
// Normalize the name to a valid variable name
|
|
62
69
|
const name = normalizeName(e.currentTarget.value, false);
|
|
63
70
|
e.currentTarget.value = name;
|
|
64
71
|
|
|
@@ -79,9 +86,6 @@ export const LanguagePanelComponent: React.FC<{
|
|
|
79
86
|
<input
|
|
80
87
|
{...inputProps}
|
|
81
88
|
defaultValue={metadata.dataframeName}
|
|
82
|
-
onChange={(e) => {
|
|
83
|
-
inputProps.onChange?.(e);
|
|
84
|
-
}}
|
|
85
89
|
onBlur={sanitizeAndTriggerUpdate}
|
|
86
90
|
onKeyDown={(e) => {
|
|
87
91
|
if (e.key === "Enter" && e.shiftKey) {
|
|
@@ -136,7 +140,6 @@ export const LanguagePanelComponent: React.FC<{
|
|
|
136
140
|
const metadata = view.state.field(languageMetadataField) as Metadata2;
|
|
137
141
|
let { quotePrefix } = metadata;
|
|
138
142
|
|
|
139
|
-
// Handle the case where the quote prefix is not set
|
|
140
143
|
if (quotePrefix === undefined) {
|
|
141
144
|
quotePrefix = "r";
|
|
142
145
|
triggerUpdate<Metadata2>({ quotePrefix });
|
|
@@ -24,7 +24,7 @@ describe("handleLogMessage", () => {
|
|
|
24
24
|
handleLogMessage("pylsp", logMessage(2, "plugin not installed"));
|
|
25
25
|
handleLogMessage("pylsp", logMessage(3, "indexing"));
|
|
26
26
|
|
|
27
|
-
expect(store.get(notebookAtom).cellLogs).toMatchObject([
|
|
27
|
+
expect(store.get(notebookAtom).cellLogs.flat()).toMatchObject([
|
|
28
28
|
{ level: "stderr", message: "failed to start" },
|
|
29
29
|
{ level: "stderr", message: "plugin not installed" },
|
|
30
30
|
{
|
|
@@ -96,7 +96,7 @@ describe("createTransport", () => {
|
|
|
96
96
|
params: { uri: "file:///a", diagnostics: [] },
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
-
expect(store.get(notebookAtom).cellLogs).toMatchObject([
|
|
99
|
+
expect(store.get(notebookAtom).cellLogs.flat()).toMatchObject([
|
|
100
100
|
{
|
|
101
101
|
level: "stderr",
|
|
102
102
|
message: "pylsp failed to start",
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
2
|
|
|
3
|
-
import type { EditorView, Panel } from "@codemirror/view";
|
|
3
|
+
import type { EditorView, Panel, ViewUpdate } from "@codemirror/view";
|
|
4
4
|
import { Provider } from "jotai";
|
|
5
5
|
import { createRoot, type Root } from "react-dom/client";
|
|
6
6
|
import { store } from "@/core/state/jotai";
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Bridge between Codemirror panels and React
|
|
10
|
-
*/
|
|
11
8
|
export function createPanel(
|
|
12
9
|
view: EditorView,
|
|
13
10
|
Component: React.ComponentType<{ view: EditorView }>,
|
|
11
|
+
shouldRender: (update: ViewUpdate) => boolean = () => true,
|
|
14
12
|
): Panel {
|
|
15
13
|
const dom = document.createElement("div");
|
|
16
14
|
let root: Root | undefined;
|
|
17
15
|
|
|
16
|
+
const render = () => {
|
|
17
|
+
root?.render(
|
|
18
|
+
<Provider store={store}>
|
|
19
|
+
<Component view={view} />
|
|
20
|
+
</Provider>,
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
18
24
|
return {
|
|
19
25
|
dom,
|
|
20
26
|
mount() {
|
|
21
27
|
root = createRoot(dom);
|
|
22
|
-
|
|
23
|
-
<Provider store={store}>
|
|
24
|
-
<Component view={view} />
|
|
25
|
-
</Provider>,
|
|
26
|
-
);
|
|
28
|
+
render();
|
|
27
29
|
},
|
|
28
|
-
update() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
</Provider>,
|
|
33
|
-
);
|
|
30
|
+
update(update) {
|
|
31
|
+
if (shouldRender(update)) {
|
|
32
|
+
render();
|
|
33
|
+
}
|
|
34
34
|
},
|
|
35
35
|
destroy() {
|
|
36
36
|
root?.unmount();
|