@marimo-team/islands 0.23.6-dev8 → 0.23.6
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-CWU3Az6F.js → ConnectedDataExplorerComponent-PmilQqXR.js} +4 -4
- package/dist/assets/__vite-browser-external-rrUYDKRl.js +1 -0
- package/dist/assets/{worker-D-EdLKct.js → worker-Bfy15ViQ.js} +2 -2
- package/dist/{chat-ui-Dfs7A8dK.js → chat-ui-B-gbqk_F.js} +6 -6
- package/dist/{code-visibility-CHNdpaL9.js → code-visibility-DNiCvIcQ.js} +678 -564
- package/dist/{formats-Dh5M1ZRs.js → formats-CgaK7Gmx.js} +1 -1
- package/dist/{glide-data-editor-DXti2axL.js → glide-data-editor-CvlvtPWJ.js} +2 -2
- package/dist/{html-to-image-DWbpEGa_.js → html-to-image-hMMPiNe_.js} +2136 -2120
- package/dist/{input-Drx1pguW.js → input-BAOe64zx.js} +1 -1
- package/dist/main.js +19 -19
- package/dist/{mermaid-BagLPXm9.js → mermaid-DJ1NyBGw.js} +2 -2
- package/dist/{process-output-CeXMg9XF.js → process-output-Bza_GK7Q.js} +1 -1
- package/dist/{reveal-component-LAgwxVYN.js → reveal-component-BSwl7P64.js} +13 -13
- package/dist/{spec-BKWq0wn2.js → spec-DSIuqd3f.js} +1 -1
- package/dist/toDate-CHtl9vts.js +662 -0
- package/dist/{useAsyncData-CKYzhCis.js → useAsyncData-B6hCGywC.js} +1 -1
- package/dist/{useDeepCompareMemoize-je76AJS_.js → useDeepCompareMemoize-CmwDuYUH.js} +1 -1
- package/dist/{useLifecycle-smVfjLNI.js → useLifecycle-CjMjllqy.js} +1 -1
- package/dist/{useTheme-CX9pPLUH.js → useTheme-CByZUW0p.js} +1 -0
- package/dist/{vega-component-BnCQmtxw.js → vega-component-CC8TqWWV.js} +5 -5
- package/package.json +5 -5
- package/src/components/ai/ai-provider-icon.tsx +1 -0
- package/src/components/ai/ai-utils.ts +1 -0
- package/src/components/app-config/ai-config.tsx +30 -0
- package/src/components/editor/chrome/wrapper/footer-items/pyodide-status.tsx +47 -0
- package/src/components/editor/chrome/wrapper/footer.tsx +2 -0
- package/src/components/editor/renderers/cell-array.tsx +14 -7
- package/src/components/slides/slide-form.tsx +43 -0
- package/src/components/terminal/terminal.tsx +16 -0
- package/src/components/ui/links.tsx +2 -1
- package/src/core/ai/ids/ids.ts +1 -0
- package/src/core/cells/__tests__/apply-transaction.test.ts +193 -27
- package/src/core/cells/__tests__/document-changes.test.ts +14 -0
- package/src/core/cells/document-changes.ts +17 -14
- package/src/core/codemirror/markdown/__tests__/commands.test.ts +36 -0
- package/src/core/codemirror/markdown/commands.ts +4 -1
- package/src/core/config/config-schema.ts +1 -0
- package/src/core/edit-app.tsx +1 -0
- package/src/core/run-app.tsx +9 -2
- package/src/core/runtime/runtime.ts +3 -2
- package/src/core/static/static-state.ts +5 -1
- package/src/core/wasm/PyodideLoader.tsx +54 -16
- package/src/core/wasm/__tests__/PyodideLoader.test.ts +72 -0
- package/src/core/wasm/__tests__/bridge.test.ts +26 -1
- package/src/core/wasm/bridge.ts +24 -6
- package/src/core/wasm/state.ts +3 -0
- package/src/core/wasm/worker/getController.ts +7 -0
- package/src/core/wasm/worker/save-worker.ts +2 -1
- package/src/core/wasm/worker/worker.ts +2 -1
- package/src/plugins/core/RenderHTML.tsx +49 -3
- package/src/plugins/core/__test__/RenderHTML.test.ts +54 -0
- package/src/plugins/impl/common/labeled.tsx +1 -1
- package/dist/assets/__vite-browser-external-C4JkHbyY.js +0 -1
- package/dist/toDate-yqOcZ_tY.js +0 -638
|
@@ -614,6 +614,7 @@ const UserConfigSchema = looseObject({
|
|
|
614
614
|
ollama: AiConfigSchema.optional(),
|
|
615
615
|
openrouter: AiConfigSchema.optional(),
|
|
616
616
|
wandb: AiConfigSchema.optional(),
|
|
617
|
+
opencode_go: AiConfigSchema.optional(),
|
|
617
618
|
open_ai_compatible: AiConfigSchema.optional(),
|
|
618
619
|
azure: AiConfigSchema.optional(),
|
|
619
620
|
bedrock: looseObject({
|
|
@@ -2,23 +2,23 @@ import { s as __toESM } from "./chunk-BNovOVIE.js";
|
|
|
2
2
|
import { _ as Logger, c as Objects, g as cn, h as Events } from "./button-CA5pI2YF.js";
|
|
3
3
|
import { t as require_react } from "./react-DA-nE2FX.js";
|
|
4
4
|
import { t as require_compiler_runtime } from "./compiler-runtime-CEbnTgxf.js";
|
|
5
|
-
import { c as asRemoteURL,
|
|
5
|
+
import { c as asRemoteURL, v as CircleQuestionMark } from "./toDate-CHtl9vts.js";
|
|
6
6
|
import "./react-dom-BWRJ_g_k.js";
|
|
7
7
|
import { t as require_jsx_runtime } from "./jsx-runtime-COBk7ree.js";
|
|
8
8
|
import "./zod-BxdsqRPd.js";
|
|
9
9
|
import { n as ErrorBanner } from "./error-banner-DnBPzEWg.js";
|
|
10
10
|
import { t as Tooltip } from "./tooltip-B0mtKTXm.js";
|
|
11
11
|
import { i as debounce_default } from "./constants-D0gkYoE2.js";
|
|
12
|
-
import { n as useTheme, w as useEvent_default } from "./useTheme-
|
|
12
|
+
import { n as useTheme, w as useEvent_default } from "./useTheme-CByZUW0p.js";
|
|
13
13
|
import { s as uniq } from "./arrays-CldYf7p7.js";
|
|
14
|
-
import { a as isValid, i as AlertTitle, n as Alert, t as arrow } from "./formats-
|
|
14
|
+
import { a as isValid, i as AlertTitle, n as Alert, t as arrow } from "./formats-CgaK7Gmx.js";
|
|
15
15
|
import { n as formats } from "./vega-loader.browser-3_z8GoFC.js";
|
|
16
16
|
import { a as getContainerWidth, n as vegaLoadData, s as tooltipHandler } from "./loader-BvW0-YWZ.js";
|
|
17
|
-
import { t as useAsyncData } from "./useAsyncData-
|
|
17
|
+
import { t as useAsyncData } from "./useAsyncData-B6hCGywC.js";
|
|
18
18
|
import { t as j } from "./react-vega-k9ODWPlI.js";
|
|
19
19
|
import "./defaultLocale-BpsHxBd7.js";
|
|
20
20
|
import "./defaultLocale-DoeErsX2.js";
|
|
21
|
-
import { t as useDeepCompareMemoize } from "./useDeepCompareMemoize-
|
|
21
|
+
import { t as useDeepCompareMemoize } from "./useDeepCompareMemoize-CmwDuYUH.js";
|
|
22
22
|
var import_compiler_runtime = require_compiler_runtime(), import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
23
23
|
function fixRelativeUrl(e) {
|
|
24
24
|
return e.data && "url" in e.data && (e.data.url = asRemoteURL(e.data.url).href), e;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marimo-team/islands",
|
|
3
|
-
"version": "0.23.6
|
|
3
|
+
"version": "0.23.6",
|
|
4
4
|
"main": "dist/main.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -195,9 +195,9 @@
|
|
|
195
195
|
"@codecov/vite-plugin": "^1.9.1",
|
|
196
196
|
"@csstools/postcss-light-dark-function": "^2.0.11",
|
|
197
197
|
"@playwright/test": "^1.59.1",
|
|
198
|
-
"@storybook/addon-docs": "^10.
|
|
199
|
-
"@storybook/addon-links": "^10.
|
|
200
|
-
"@storybook/react-vite": "^10.
|
|
198
|
+
"@storybook/addon-docs": "^10.3.5",
|
|
199
|
+
"@storybook/addon-links": "^10.3.5",
|
|
200
|
+
"@storybook/react-vite": "^10.3.5",
|
|
201
201
|
"@swc-jotai/react-refresh": "^0.5.0",
|
|
202
202
|
"@testing-library/jest-dom": "^6.9.1",
|
|
203
203
|
"@testing-library/react": "^16.3.2",
|
|
@@ -223,7 +223,7 @@
|
|
|
223
223
|
"react": "^19.2.4",
|
|
224
224
|
"react-compiler-runtime": "19.1.0-rc.3",
|
|
225
225
|
"react-dom": "^19.2.4",
|
|
226
|
-
"storybook": "^10.
|
|
226
|
+
"storybook": "^10.3.5",
|
|
227
227
|
"stylelint": "^16.26.1",
|
|
228
228
|
"stylelint-config-standard": "^36.0.1",
|
|
229
229
|
"tailwindcss": "^4.2.2",
|
|
@@ -21,6 +21,7 @@ const CREDENTIAL_CHECKERS: Record<KnownProviderId, CredentialChecker> = {
|
|
|
21
21
|
openrouter: (ai) => Boolean(ai?.openrouter?.api_key),
|
|
22
22
|
azure: (ai) => Boolean(ai?.azure?.api_key && ai?.azure?.base_url),
|
|
23
23
|
wandb: (ai) => Boolean(ai?.wandb?.api_key),
|
|
24
|
+
"opencode-go": (ai) => Boolean(ai?.opencode_go?.api_key),
|
|
24
25
|
bedrock: (ai) => Boolean(ai?.bedrock?.region_name),
|
|
25
26
|
ollama: (ai) => Boolean(ai?.ollama?.base_url),
|
|
26
27
|
// These providers don't have user-configurable credentials in the UI
|
|
@@ -1058,6 +1058,36 @@ export const AiProvidersConfig: React.FC<AiConfigProps> = ({
|
|
|
1058
1058
|
/>
|
|
1059
1059
|
</AccordionFormItem>
|
|
1060
1060
|
|
|
1061
|
+
<AccordionFormItem
|
|
1062
|
+
title="OpenCode Go"
|
|
1063
|
+
provider="opencode-go"
|
|
1064
|
+
isConfigured={hasValue("ai.opencode_go.api_key")}
|
|
1065
|
+
>
|
|
1066
|
+
<ApiKey
|
|
1067
|
+
form={form}
|
|
1068
|
+
config={config}
|
|
1069
|
+
name="ai.opencode_go.api_key"
|
|
1070
|
+
placeholder="your-opencode-api-key"
|
|
1071
|
+
testId="ai-opencode-go-api-key-input"
|
|
1072
|
+
description={
|
|
1073
|
+
<>
|
|
1074
|
+
Your OpenCode API key from{" "}
|
|
1075
|
+
<ExternalLink href="https://opencode.ai/auth">
|
|
1076
|
+
opencode.ai
|
|
1077
|
+
</ExternalLink>
|
|
1078
|
+
. OpenCode Go is a low-cost subscription for open coding models.
|
|
1079
|
+
</>
|
|
1080
|
+
}
|
|
1081
|
+
/>
|
|
1082
|
+
<BaseUrl
|
|
1083
|
+
form={form}
|
|
1084
|
+
config={config}
|
|
1085
|
+
name="ai.opencode_go.base_url"
|
|
1086
|
+
placeholder="https://opencode.ai/zen/go/v1/"
|
|
1087
|
+
testId="ai-opencode-go-base-url-input"
|
|
1088
|
+
/>
|
|
1089
|
+
</AccordionFormItem>
|
|
1090
|
+
|
|
1061
1091
|
<AccordionFormItem
|
|
1062
1092
|
title="Azure"
|
|
1063
1093
|
provider="azure"
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
|
|
3
|
+
import { useAtomValue } from "jotai";
|
|
4
|
+
import { AlertCircleIcon } from "lucide-react";
|
|
5
|
+
import type React from "react";
|
|
6
|
+
import { Spinner } from "@/components/icons/spinner";
|
|
7
|
+
import { Tooltip } from "@/components/ui/tooltip";
|
|
8
|
+
import { wasmInitializationAtom, wasmInitStatusAtom } from "@/core/wasm/state";
|
|
9
|
+
import { isWasm } from "@/core/wasm/utils";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Footer indicator that surfaces Pyodide initialization progress. Mirrors
|
|
13
|
+
* the "Kernel" indicator but tracks the WASM runtime instead of the server
|
|
14
|
+
* connection. Hides itself once Pyodide is ready.
|
|
15
|
+
*/
|
|
16
|
+
export const PyodideStatus: React.FC = () => {
|
|
17
|
+
const status = useAtomValue(wasmInitStatusAtom);
|
|
18
|
+
const message = useAtomValue(wasmInitializationAtom);
|
|
19
|
+
|
|
20
|
+
if (!isWasm() || status === "ready") {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const icon =
|
|
25
|
+
status === "error" ? (
|
|
26
|
+
<AlertCircleIcon className="w-4 h-4 text-destructive" />
|
|
27
|
+
) : (
|
|
28
|
+
<Spinner size="small" />
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const tooltip = status === "error" ? "Pyodide failed to initialize" : message;
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<Tooltip
|
|
35
|
+
content={<div className="text-sm whitespace-pre-line">{tooltip}</div>}
|
|
36
|
+
data-testid="footer-pyodide-status"
|
|
37
|
+
>
|
|
38
|
+
<div
|
|
39
|
+
className="p-1 hover:bg-accent rounded flex items-center gap-1.5 text-xs text-muted-foreground"
|
|
40
|
+
data-testid="pyodide-status"
|
|
41
|
+
>
|
|
42
|
+
{icon}
|
|
43
|
+
<span>Pyodide</span>
|
|
44
|
+
</div>
|
|
45
|
+
</Tooltip>
|
|
46
|
+
);
|
|
47
|
+
};
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
} from "./footer-items/backend-status";
|
|
19
19
|
import { CopilotStatusIcon } from "./footer-items/copilot-status";
|
|
20
20
|
import { MachineStats } from "./footer-items/machine-stats";
|
|
21
|
+
import { PyodideStatus } from "./footer-items/pyodide-status";
|
|
21
22
|
import { RTCStatus } from "./footer-items/rtc-status";
|
|
22
23
|
import { RuntimeSettings } from "./footer-items/runtime-settings";
|
|
23
24
|
import { useSetDependencyPanelTab } from "./useDependencyPanelTab";
|
|
@@ -85,6 +86,7 @@ export const Footer: React.FC = () => {
|
|
|
85
86
|
|
|
86
87
|
<div className="mx-auto" />
|
|
87
88
|
|
|
89
|
+
<PyodideStatus />
|
|
88
90
|
<ConnectingKernelIndicatorItem />
|
|
89
91
|
|
|
90
92
|
<ShowInKioskMode>
|
|
@@ -59,6 +59,7 @@ interface CellArrayProps {
|
|
|
59
59
|
mode: AppMode;
|
|
60
60
|
userConfig: UserConfig;
|
|
61
61
|
appConfig: AppConfig;
|
|
62
|
+
hideControls?: boolean;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
export const CellArray: React.FC<CellArrayProps> = (props) => {
|
|
@@ -82,6 +83,7 @@ const CellArrayInternal: React.FC<CellArrayProps> = ({
|
|
|
82
83
|
mode,
|
|
83
84
|
userConfig,
|
|
84
85
|
appConfig,
|
|
86
|
+
hideControls = false,
|
|
85
87
|
}) => {
|
|
86
88
|
const actions = useCellActions();
|
|
87
89
|
const { theme } = useTheme();
|
|
@@ -147,6 +149,7 @@ const CellArrayInternal: React.FC<CellArrayProps> = ({
|
|
|
147
149
|
mode={mode}
|
|
148
150
|
userConfig={userConfig}
|
|
149
151
|
theme={theme}
|
|
152
|
+
hideControls={hideControls}
|
|
150
153
|
/>
|
|
151
154
|
))}
|
|
152
155
|
</div>
|
|
@@ -166,6 +169,7 @@ const CellColumn: React.FC<{
|
|
|
166
169
|
mode: AppMode;
|
|
167
170
|
userConfig: UserConfig;
|
|
168
171
|
theme: Theme;
|
|
172
|
+
hideControls: boolean;
|
|
169
173
|
}> = ({
|
|
170
174
|
columnId,
|
|
171
175
|
index,
|
|
@@ -174,6 +178,7 @@ const CellColumn: React.FC<{
|
|
|
174
178
|
mode,
|
|
175
179
|
userConfig,
|
|
176
180
|
theme,
|
|
181
|
+
hideControls,
|
|
177
182
|
}) => {
|
|
178
183
|
const cellIds = useCellIds();
|
|
179
184
|
const column = cellIds.get(columnId);
|
|
@@ -191,13 +196,15 @@ const CellColumn: React.FC<{
|
|
|
191
196
|
width={appConfig.width}
|
|
192
197
|
canDelete={columnsLength > 1}
|
|
193
198
|
footer={
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
"
|
|
199
|
-
|
|
200
|
-
|
|
199
|
+
hideControls ? null : (
|
|
200
|
+
<AddCellButtons
|
|
201
|
+
columnId={columnId}
|
|
202
|
+
className={cn(
|
|
203
|
+
appConfig.width === "columns" &&
|
|
204
|
+
"opacity-0 group-hover/column:opacity-100",
|
|
205
|
+
)}
|
|
206
|
+
/>
|
|
207
|
+
)
|
|
201
208
|
}
|
|
202
209
|
>
|
|
203
210
|
<SortableContext
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
CookieIcon,
|
|
9
9
|
PanelRightCloseIcon,
|
|
10
10
|
PanelRightOpenIcon,
|
|
11
|
+
KeyboardIcon,
|
|
11
12
|
} from "lucide-react";
|
|
12
13
|
import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group";
|
|
13
14
|
import {
|
|
@@ -28,6 +29,7 @@ import type {
|
|
|
28
29
|
import { useState } from "react";
|
|
29
30
|
import { Tooltip } from "../ui/tooltip";
|
|
30
31
|
import { Button } from "../ui/button";
|
|
32
|
+
import { Kbd } from "../ui/kbd";
|
|
31
33
|
import type { RuntimeCell } from "@/core/cells/types";
|
|
32
34
|
|
|
33
35
|
export const DEFAULT_SLIDE_TYPE: SlideType = "slide";
|
|
@@ -132,10 +134,51 @@ const SlidesForm = ({
|
|
|
132
134
|
<TabsContent value="deck" className="mt-0 flex-1">
|
|
133
135
|
<DeckConfigForm layout={layout} setLayout={setLayout} />
|
|
134
136
|
</TabsContent>
|
|
137
|
+
<hr />
|
|
138
|
+
<KeyboardTips />
|
|
135
139
|
</Tabs>
|
|
136
140
|
);
|
|
137
141
|
};
|
|
138
142
|
|
|
143
|
+
const KEYBOARD_TIPS: { keys: string[]; description: string }[] = [
|
|
144
|
+
{ keys: ["F"], description: "Enter fullscreen" },
|
|
145
|
+
{ keys: ["C"], description: "Toggle code editor" },
|
|
146
|
+
];
|
|
147
|
+
|
|
148
|
+
const KEYBOARD_SHORTCUTS_URL =
|
|
149
|
+
"https://vlaaad.github.io/reveal/keyboard-shortcuts";
|
|
150
|
+
|
|
151
|
+
const KeyboardTips = () => {
|
|
152
|
+
return (
|
|
153
|
+
<div className="flex flex-col gap-2 text-xs text-muted-foreground">
|
|
154
|
+
<div className="flex items-center gap-1.5 font-medium text-foreground/80">
|
|
155
|
+
<KeyboardIcon className="h-3.5 w-3.5" />
|
|
156
|
+
<span>Shortcuts</span>
|
|
157
|
+
</div>
|
|
158
|
+
<ul className="flex flex-col gap-1.5">
|
|
159
|
+
{KEYBOARD_TIPS.map(({ keys, description }) => (
|
|
160
|
+
<li key={description} className="flex items-center justify-between">
|
|
161
|
+
<span>{description}</span>
|
|
162
|
+
<span className="flex gap-1">
|
|
163
|
+
{keys.map((key) => (
|
|
164
|
+
<Kbd key={key}>{key}</Kbd>
|
|
165
|
+
))}
|
|
166
|
+
</span>
|
|
167
|
+
</li>
|
|
168
|
+
))}
|
|
169
|
+
</ul>
|
|
170
|
+
<a
|
|
171
|
+
href={KEYBOARD_SHORTCUTS_URL}
|
|
172
|
+
target="_blank"
|
|
173
|
+
rel="noopener noreferrer"
|
|
174
|
+
className="text-link hover:underline"
|
|
175
|
+
>
|
|
176
|
+
See all shortcuts
|
|
177
|
+
</a>
|
|
178
|
+
</div>
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
|
|
139
182
|
const SlideConfigForm = ({
|
|
140
183
|
layout,
|
|
141
184
|
setLayout,
|
|
@@ -270,6 +270,22 @@ const TerminalComponent: React.FC<TerminalComponentProps> = ({
|
|
|
270
270
|
|
|
271
271
|
const handleOpen = () => {
|
|
272
272
|
updateReadyState();
|
|
273
|
+
// Send initial dimensions: the mount-time fit() may have fired
|
|
274
|
+
// before the WS was OPEN, dropping the resize message and leaving
|
|
275
|
+
// the PTY at its default 0x0 winsize.
|
|
276
|
+
fitAddon.fit();
|
|
277
|
+
if (terminal.cols > 0 && terminal.rows > 0) {
|
|
278
|
+
socket.send(
|
|
279
|
+
JSON.stringify({
|
|
280
|
+
type: "resize",
|
|
281
|
+
cols: terminal.cols,
|
|
282
|
+
rows: terminal.rows,
|
|
283
|
+
}),
|
|
284
|
+
);
|
|
285
|
+
// The fit() above may have triggered onResize → scheduled a
|
|
286
|
+
// debounced send. Cancel it; we just sent the same dims.
|
|
287
|
+
handleBackendResizeDebounced.cancel();
|
|
288
|
+
}
|
|
273
289
|
};
|
|
274
290
|
|
|
275
291
|
const handleDisconnect = () => {
|
|
@@ -15,7 +15,8 @@ export const ExternalLink = ({
|
|
|
15
15
|
| `https://marimo.io/${string}`
|
|
16
16
|
| `https://links.marimo.app/${string}`
|
|
17
17
|
| `https://wandb.ai/${string}`
|
|
18
|
-
| `https://portal.azure.com/${string}
|
|
18
|
+
| `https://portal.azure.com/${string}`
|
|
19
|
+
| `https://opencode.ai/${string}`;
|
|
19
20
|
children: React.ReactNode;
|
|
20
21
|
}) => {
|
|
21
22
|
return (
|
package/src/core/ai/ids/ids.ts
CHANGED
|
@@ -469,10 +469,34 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
469
469
|
const [a, b, c, d] = state.cellIds.inOrderIds;
|
|
470
470
|
apply([
|
|
471
471
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
472
|
-
{
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
472
|
+
{
|
|
473
|
+
type: "set-config",
|
|
474
|
+
cellId: a,
|
|
475
|
+
column: 0,
|
|
476
|
+
disabled: false,
|
|
477
|
+
hideCode: false,
|
|
478
|
+
},
|
|
479
|
+
{
|
|
480
|
+
type: "set-config",
|
|
481
|
+
cellId: b,
|
|
482
|
+
column: 1,
|
|
483
|
+
disabled: false,
|
|
484
|
+
hideCode: false,
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
type: "set-config",
|
|
488
|
+
cellId: c,
|
|
489
|
+
column: 0,
|
|
490
|
+
disabled: false,
|
|
491
|
+
hideCode: false,
|
|
492
|
+
},
|
|
493
|
+
{
|
|
494
|
+
type: "set-config",
|
|
495
|
+
cellId: d,
|
|
496
|
+
column: 1,
|
|
497
|
+
disabled: false,
|
|
498
|
+
hideCode: false,
|
|
499
|
+
},
|
|
476
500
|
]);
|
|
477
501
|
// a and c in col0; b and d in col1. Order within each column follows
|
|
478
502
|
// the reorder-cells order.
|
|
@@ -487,7 +511,15 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
487
511
|
it("set-config without reorder-cells moves the cell to the new column", () => {
|
|
488
512
|
setup("a", "b", "c");
|
|
489
513
|
const [, b] = state.cellIds.inOrderIds;
|
|
490
|
-
apply([
|
|
514
|
+
apply([
|
|
515
|
+
{
|
|
516
|
+
type: "set-config",
|
|
517
|
+
cellId: b,
|
|
518
|
+
column: 1,
|
|
519
|
+
disabled: false,
|
|
520
|
+
hideCode: false,
|
|
521
|
+
},
|
|
522
|
+
]);
|
|
491
523
|
// Without reorder-cells, the flat order comes from the current tree.
|
|
492
524
|
// b gets explicit col=1; a and c stay with default null → follow the
|
|
493
525
|
// previous cell's column (a → col0 because prev=0; c → col1 because
|
|
@@ -503,7 +535,15 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
503
535
|
it("no column change: set-config only touching other fields does not repartition", () => {
|
|
504
536
|
setup("a", "b", "c");
|
|
505
537
|
const [, b] = state.cellIds.inOrderIds;
|
|
506
|
-
apply([
|
|
538
|
+
apply([
|
|
539
|
+
{
|
|
540
|
+
type: "set-config",
|
|
541
|
+
cellId: b,
|
|
542
|
+
column: null,
|
|
543
|
+
disabled: false,
|
|
544
|
+
hideCode: true,
|
|
545
|
+
},
|
|
546
|
+
]);
|
|
507
547
|
// All three cells remain in a single column. No rebuild triggered.
|
|
508
548
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
509
549
|
"
|
|
@@ -525,8 +565,20 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
525
565
|
const [a, b] = state.cellIds.inOrderIds;
|
|
526
566
|
apply([
|
|
527
567
|
{ type: "reorder-cells", cellIds: [a, b] },
|
|
528
|
-
{
|
|
529
|
-
|
|
568
|
+
{
|
|
569
|
+
type: "set-config",
|
|
570
|
+
cellId: a,
|
|
571
|
+
column: 0,
|
|
572
|
+
disabled: false,
|
|
573
|
+
hideCode: false,
|
|
574
|
+
},
|
|
575
|
+
{
|
|
576
|
+
type: "set-config",
|
|
577
|
+
cellId: b,
|
|
578
|
+
column: 1,
|
|
579
|
+
disabled: false,
|
|
580
|
+
hideCode: false,
|
|
581
|
+
},
|
|
530
582
|
]);
|
|
531
583
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
532
584
|
"
|
|
@@ -550,8 +602,20 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
550
602
|
const [a, b, c, d] = state.cellIds.inOrderIds;
|
|
551
603
|
apply([
|
|
552
604
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
553
|
-
{
|
|
554
|
-
|
|
605
|
+
{
|
|
606
|
+
type: "set-config",
|
|
607
|
+
cellId: a,
|
|
608
|
+
column: 0,
|
|
609
|
+
disabled: false,
|
|
610
|
+
hideCode: false,
|
|
611
|
+
},
|
|
612
|
+
{
|
|
613
|
+
type: "set-config",
|
|
614
|
+
cellId: c,
|
|
615
|
+
column: 1,
|
|
616
|
+
disabled: false,
|
|
617
|
+
hideCode: false,
|
|
618
|
+
},
|
|
555
619
|
]);
|
|
556
620
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
557
621
|
"
|
|
@@ -562,8 +626,20 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
562
626
|
// Now merge everything back to col 0.
|
|
563
627
|
apply([
|
|
564
628
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
565
|
-
{
|
|
566
|
-
|
|
629
|
+
{
|
|
630
|
+
type: "set-config",
|
|
631
|
+
cellId: c,
|
|
632
|
+
column: 0,
|
|
633
|
+
disabled: false,
|
|
634
|
+
hideCode: false,
|
|
635
|
+
},
|
|
636
|
+
{
|
|
637
|
+
type: "set-config",
|
|
638
|
+
cellId: d,
|
|
639
|
+
column: 0,
|
|
640
|
+
disabled: false,
|
|
641
|
+
hideCode: false,
|
|
642
|
+
},
|
|
567
643
|
]);
|
|
568
644
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
569
645
|
"
|
|
@@ -609,8 +685,20 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
609
685
|
{ type: "reorder-cells", cellIds: [a, b, c] },
|
|
610
686
|
{ type: "set-code", cellId: a, code: "x = 1" },
|
|
611
687
|
{ type: "set-name", cellId: b, name: "middle" },
|
|
612
|
-
{
|
|
613
|
-
|
|
688
|
+
{
|
|
689
|
+
type: "set-config",
|
|
690
|
+
cellId: a,
|
|
691
|
+
column: 0,
|
|
692
|
+
disabled: false,
|
|
693
|
+
hideCode: false,
|
|
694
|
+
},
|
|
695
|
+
{
|
|
696
|
+
type: "set-config",
|
|
697
|
+
cellId: b,
|
|
698
|
+
column: 1,
|
|
699
|
+
disabled: false,
|
|
700
|
+
hideCode: false,
|
|
701
|
+
},
|
|
614
702
|
]);
|
|
615
703
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
616
704
|
"
|
|
@@ -658,8 +746,20 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
658
746
|
// Split into two columns. Only a and c are anchors.
|
|
659
747
|
apply([
|
|
660
748
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
661
|
-
{
|
|
662
|
-
|
|
749
|
+
{
|
|
750
|
+
type: "set-config",
|
|
751
|
+
cellId: a,
|
|
752
|
+
column: 0,
|
|
753
|
+
disabled: false,
|
|
754
|
+
hideCode: false,
|
|
755
|
+
},
|
|
756
|
+
{
|
|
757
|
+
type: "set-config",
|
|
758
|
+
cellId: c,
|
|
759
|
+
column: 1,
|
|
760
|
+
disabled: false,
|
|
761
|
+
hideCode: false,
|
|
762
|
+
},
|
|
663
763
|
]);
|
|
664
764
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
665
765
|
"
|
|
@@ -670,7 +770,13 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
670
770
|
// Move the c anchor to col 0. d has no explicit column so it follows c.
|
|
671
771
|
apply([
|
|
672
772
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
673
|
-
{
|
|
773
|
+
{
|
|
774
|
+
type: "set-config",
|
|
775
|
+
cellId: c,
|
|
776
|
+
column: 0,
|
|
777
|
+
disabled: false,
|
|
778
|
+
hideCode: false,
|
|
779
|
+
},
|
|
674
780
|
]);
|
|
675
781
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
676
782
|
"
|
|
@@ -686,9 +792,27 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
686
792
|
const [a, b, c, d] = state.cellIds.inOrderIds;
|
|
687
793
|
apply([
|
|
688
794
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
689
|
-
{
|
|
690
|
-
|
|
691
|
-
|
|
795
|
+
{
|
|
796
|
+
type: "set-config",
|
|
797
|
+
cellId: a,
|
|
798
|
+
column: 0,
|
|
799
|
+
disabled: false,
|
|
800
|
+
hideCode: false,
|
|
801
|
+
},
|
|
802
|
+
{
|
|
803
|
+
type: "set-config",
|
|
804
|
+
cellId: c,
|
|
805
|
+
column: 1,
|
|
806
|
+
disabled: false,
|
|
807
|
+
hideCode: false,
|
|
808
|
+
},
|
|
809
|
+
{
|
|
810
|
+
type: "set-config",
|
|
811
|
+
cellId: d,
|
|
812
|
+
column: 1,
|
|
813
|
+
disabled: false,
|
|
814
|
+
hideCode: false,
|
|
815
|
+
},
|
|
692
816
|
]);
|
|
693
817
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
694
818
|
"
|
|
@@ -700,7 +824,13 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
700
824
|
// does NOT follow c.
|
|
701
825
|
apply([
|
|
702
826
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
703
|
-
{
|
|
827
|
+
{
|
|
828
|
+
type: "set-config",
|
|
829
|
+
cellId: c,
|
|
830
|
+
column: 0,
|
|
831
|
+
disabled: false,
|
|
832
|
+
hideCode: false,
|
|
833
|
+
},
|
|
704
834
|
]);
|
|
705
835
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
706
836
|
"
|
|
@@ -719,8 +849,20 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
719
849
|
const [a, b, c, d] = state.cellIds.inOrderIds;
|
|
720
850
|
apply([
|
|
721
851
|
// set-config appears FIRST in the transaction.
|
|
722
|
-
{
|
|
723
|
-
|
|
852
|
+
{
|
|
853
|
+
type: "set-config",
|
|
854
|
+
cellId: a,
|
|
855
|
+
column: 0,
|
|
856
|
+
disabled: false,
|
|
857
|
+
hideCode: false,
|
|
858
|
+
},
|
|
859
|
+
{
|
|
860
|
+
type: "set-config",
|
|
861
|
+
cellId: c,
|
|
862
|
+
column: 1,
|
|
863
|
+
disabled: false,
|
|
864
|
+
hideCode: false,
|
|
865
|
+
},
|
|
724
866
|
// reorder-cells comes afterwards.
|
|
725
867
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
726
868
|
]);
|
|
@@ -741,9 +883,21 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
741
883
|
setup("a", "b", "c", "d");
|
|
742
884
|
const [a, b, c, d] = state.cellIds.inOrderIds;
|
|
743
885
|
apply([
|
|
744
|
-
{
|
|
886
|
+
{
|
|
887
|
+
type: "set-config",
|
|
888
|
+
cellId: a,
|
|
889
|
+
column: 0,
|
|
890
|
+
disabled: false,
|
|
891
|
+
hideCode: false,
|
|
892
|
+
},
|
|
745
893
|
{ type: "set-code", cellId: a, code: "x = 1" },
|
|
746
|
-
{
|
|
894
|
+
{
|
|
895
|
+
type: "set-config",
|
|
896
|
+
cellId: c,
|
|
897
|
+
column: 1,
|
|
898
|
+
disabled: false,
|
|
899
|
+
hideCode: false,
|
|
900
|
+
},
|
|
747
901
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
748
902
|
{ type: "set-name", cellId: d, name: "last" },
|
|
749
903
|
]);
|
|
@@ -769,8 +923,20 @@ describe("applyTransactionChanges column rebuild", () => {
|
|
|
769
923
|
const [a, b, c, d] = state.cellIds.inOrderIds;
|
|
770
924
|
apply([
|
|
771
925
|
{ type: "reorder-cells", cellIds: [a, b, c, d] },
|
|
772
|
-
{
|
|
773
|
-
|
|
926
|
+
{
|
|
927
|
+
type: "set-config",
|
|
928
|
+
cellId: a,
|
|
929
|
+
column: 0,
|
|
930
|
+
disabled: false,
|
|
931
|
+
hideCode: false,
|
|
932
|
+
},
|
|
933
|
+
{
|
|
934
|
+
type: "set-config",
|
|
935
|
+
cellId: c,
|
|
936
|
+
column: 1,
|
|
937
|
+
disabled: false,
|
|
938
|
+
hideCode: false,
|
|
939
|
+
},
|
|
774
940
|
]);
|
|
775
941
|
expect(prettyColumns(state)).toMatchInlineSnapshot(`
|
|
776
942
|
"
|