@marimo-team/islands 0.26.1-dev37 → 0.26.1-dev38
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-jtTaDisw.js → ConnectedDataExplorerComponent-BVMWCBON.js} +9 -9
- package/dist/{ErrorBoundary-CQlGD7tf.js → ErrorBoundary-B54cPfe2.js} +6 -6
- package/dist/{abnfDiagram-VCTEODGH-cUj3Gnnh.js → abnfDiagram-VCTEODGH-BRj77JhY.js} +2 -2
- package/dist/{any-language-editor-BHgkY7jY.js → any-language-editor-BQ9dhxg5.js} +2 -2
- package/dist/{architectureDiagram-5GKGNRK7-CIAZgn9d.js → architectureDiagram-5GKGNRK7-CDnAsvE1.js} +1 -1
- package/dist/{assertNever-BHnIohkX.js → assertNever-DeSqnr83.js} +2 -2
- package/dist/{chat-ui-CWmSnBs8.js → chat-ui-CXyZb62N.js} +12 -12
- package/dist/{check-LtjuWmNn.js → check-COXd6cXw.js} +1 -1
- package/dist/{chunk-IMKFNOWR-CB9N3qYR.js → chunk-IMKFNOWR-BFtu1O6j.js} +1 -1
- package/dist/{chunk-SHT3W25Y-D9njV7TI.js → chunk-SHT3W25Y-B9zWo9Da.js} +1 -1
- package/dist/{chunk-SVP7TREG-CUCE0BFm.js → chunk-SVP7TREG-kKS-I24p.js} +1 -1
- package/dist/{chunk-TICWLB2K-iQB6ttkI.js → chunk-TICWLB2K-EY3w5-eg.js} +1 -1
- package/dist/{classDiagram-ZZMXUADV-BI1VBNIo.js → classDiagram-ZZMXUADV-BR66X7fj.js} +2 -2
- package/dist/{classDiagram-v2-VYDZK3BY-BYL3asWh.js → classDiagram-v2-VYDZK3BY-DPcxw_9g.js} +2 -2
- package/dist/{code-visibility-DUde7zZD.js → code-visibility-DxF4Svad.js} +5 -5
- package/dist/{common-B27TyWFr.js → common-CEFc24f5.js} +19 -19
- package/dist/{config-1ku0tAiU.js → config-DE3A8m65.js} +3 -3
- package/dist/{copy-icon-rYV2znAe.js → copy-icon-gSCLWI50.js} +2 -2
- package/dist/{createReducer-BdiSrxHu.js → createReducer-BFfuVhJG.js} +1 -1
- package/dist/{cynefinDiagram-5FMLGOSQ-DpGtYvnZ.js → cynefinDiagram-5FMLGOSQ-B9kG0Adl.js} +1 -1
- package/dist/{dagre-GXQ25YYZ-B5GDC2kN.js → dagre-GXQ25YYZ-ClnyHQzL.js} +1 -1
- package/dist/{data-grid-overlay-editor-C-DUKkN9.js → data-grid-overlay-editor-DpaN7MT1.js} +1 -1
- package/dist/{diagram-S7CK7UJ4-B2T25t1t.js → diagram-S7CK7UJ4-afCjSSlp.js} +1 -1
- package/dist/{diagram-UQ7AKVKN-Dy3B5L_z.js → diagram-UQ7AKVKN-BCHefG5P.js} +1 -1
- package/dist/{diagram-VX7I27RA-tOptWvNh.js → diagram-VX7I27RA-9jXA0khj.js} +1 -1
- package/dist/{diagram-Z3DM3KII-DsgZAokO.js → diagram-Z3DM3KII-C8tsbK7Q.js} +1 -1
- package/dist/{dialog-vs6x3On9.js → dialog-Dn_UHaEl.js} +2 -2
- package/dist/{dropdown-menu-D65ZUqka.js → dropdown-menu-D0nePAlm.js} +5 -5
- package/dist/{ebnfDiagram-PWID7BFC-CGWECzS1.js → ebnfDiagram-PWID7BFC-It0ZS33j.js} +2 -2
- package/dist/{erDiagram-RLTQ6QDP-CZLi87y3.js → erDiagram-RLTQ6QDP-Z0Qfo02H.js} +1 -1
- package/dist/{error-banner-D-AC7pQx.js → error-banner-DChjSagB.js} +1 -1
- package/dist/{error-entries-DFHEq_SO.js → error-entries-DYoi03MZ.js} +8 -8
- package/dist/{feedback-button-B0vcLQje.js → feedback-button-0vPTkcg1.js} +7 -7
- package/dist/{flowDiagram-HODETNUW-CS86WYbX.js → flowDiagram-HODETNUW-8DeXLUFK.js} +2 -2
- package/dist/{formats-BUFLQJXY.js → formats-6QF5hRsy.js} +1 -1
- package/dist/{glide-data-editor-jZ-x8Gsi.js → glide-data-editor-CGTNgso9.js} +11 -11
- package/dist/{glide-utils-CZ-O-CB_.js → glide-utils-B7gy9Her.js} +2 -2
- package/dist/{globals-DYrbP2hb.js → globals-CgiVptxE.js} +3 -3
- package/dist/{html-to-image-D6Gtk5ik.js → html-to-image-CUFNjxtw.js} +13 -13
- package/dist/{infoDiagram-27XIBGKW-C9JBFfpC.js → infoDiagram-27XIBGKW-B5wmzeRz.js} +1 -1
- package/dist/{ishikawaDiagram-5VMMS53U-Eh3iuw2D.js → ishikawaDiagram-5VMMS53U-BcbPwik7.js} +1 -1
- package/dist/{kanban-definition-UXKFOSKX-DYtuVwYD.js → kanban-definition-UXKFOSKX-AfQmkIoH.js} +1 -1
- package/dist/main.js +30 -30
- package/dist/{mermaid--k1o49nH.js → mermaid-az53hfgW.js} +34 -34
- package/dist/{mindmap-definition-YA3MSWOX-Dn1Cnqys.js → mindmap-definition-YA3MSWOX-B7eBrMap.js} +1 -1
- package/dist/{number-overlay-editor-Q5la-5Pa.js → number-overlay-editor-Do3bbYxg.js} +1 -1
- package/dist/{pegDiagram-XKGWAZYB-DiY7rITR.js → pegDiagram-XKGWAZYB-BwjpXSLR.js} +2 -2
- package/dist/{pencil-AWgwbH4D.js → pencil-pQhLU2Up.js} +1 -1
- package/dist/{pieDiagram-E7YTZNPT-BL6InbDs.js → pieDiagram-E7YTZNPT-D5AyRqAQ.js} +1 -1
- package/dist/{process-output-ZBdibqlG.js → process-output-DMMs8Ywh.js} +4 -4
- package/dist/{railroadDiagram-O6MQD6OU-DterenMu.js → railroadDiagram-O6MQD6OU-Hhrla0Qq.js} +2 -2
- package/dist/{requirementDiagram-BXWQKSXE-Vb5_9LHC.js → requirementDiagram-BXWQKSXE-MgDRuFUM.js} +1 -1
- package/dist/{reveal-component-CeVzy_nk.js → reveal-component-0gSwFNjH.js} +7 -7
- package/dist/{select-CKLRKIzB.js → select-C4rPKgSx.js} +4 -4
- package/dist/{sequenceDiagram-WJ2MYXX4-BWsq8hMt.js → sequenceDiagram-WJ2MYXX4-xZYdOGbe.js} +1 -1
- package/dist/{spec-C4uOz0Em.js → spec-BsiCag5K.js} +4 -4
- package/dist/{stateDiagram-D77RDMKH-nfKKy6aQ.js → stateDiagram-D77RDMKH-DdhE3Yx9.js} +2 -2
- package/dist/{stateDiagram-v2-MP3YSRHH-DMUHA_9A.js → stateDiagram-v2-MP3YSRHH-DENKYVKr.js} +2 -2
- package/dist/{static-state-DZ1nSa6e.js → static-state-CNnjDcOR.js} +1 -1
- package/dist/{swimlanes-42K2YHIH-N4qHIMoc.js → swimlanes-42K2YHIH-Bw7xuGAn.js} +1 -1
- package/dist/{swimlanesDiagram-VR7AAH4N-DQpDDjQb.js → swimlanesDiagram-VR7AAH4N-L91TUeh5.js} +2 -2
- package/dist/{timeline-definition-24CTP7MA-Od8dY9F5.js → timeline-definition-24CTP7MA-BeGrmws1.js} +1 -1
- package/dist/{toast-bhZHUEal.js → toast-qyBwbZJ0.js} +3 -3
- package/dist/{tooltip-DSWC_Td_.js → tooltip-COQxCMLx.js} +1 -1
- package/dist/{use-restore-focus-ocw7t85i.js → use-restore-focus-D5-Hgr1l.js} +44 -57
- package/dist/{useDateFormatter-BiDS8uXQ.js → useDateFormatter-L8edl513.js} +2 -2
- package/dist/{useDeepCompareMemoize-BsaXfZ8C.js → useDeepCompareMemoize-B6yhm6sM.js} +1 -1
- package/dist/{useLifecycle-CCV7yZ-v.js → useLifecycle-Dnxradbp.js} +1 -1
- package/dist/{vega-component-D61CTW1X.js → vega-component-CWKS3tOU.js} +6 -6
- package/dist/{vennDiagram-4TSXK5OY-Di3T2YMb.js → vennDiagram-4TSXK5OY-fknCUyJ2.js} +1 -1
- package/dist/{wardleyDiagram-VM6X3IG4-CKOF5DTi.js → wardleyDiagram-VM6X3IG4-DvoVMCdj.js} +1 -1
- package/dist/{xychartDiagram-S5SC5T6Z-GYLPWSeb.js → xychartDiagram-S5SC5T6Z-0TYtO6UV.js} +1 -1
- package/package.json +1 -1
- package/src/__tests__/render-tracker.ts +15 -0
- package/src/__tests__/setup.ts +3 -0
- package/src/components/editor/__tests__/cell-renders.test.tsx +116 -0
- package/src/components/icons/__tests__/large-spinner.test.tsx +5 -4
- package/src/components/ui/__tests__/fullscreen.test.tsx +60 -0
- package/src/components/ui/fullscreen.tsx +35 -50
- package/src/core/vscode/__tests__/is-in-vscode.test.ts +36 -0
- package/src/core/vscode/is-in-vscode.ts +2 -2
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { act, render, screen } from "@testing-library/react";
|
|
4
4
|
import { Profiler } from "react";
|
|
5
5
|
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
|
|
6
|
+
import { createRenderTracker } from "@/__tests__/render-tracker";
|
|
6
7
|
import { LargeSpinner } from "../large-spinner";
|
|
7
8
|
|
|
8
9
|
describe("LargeSpinner", () => {
|
|
@@ -10,17 +11,17 @@ describe("LargeSpinner", () => {
|
|
|
10
11
|
afterEach(() => vi.useRealTimers());
|
|
11
12
|
|
|
12
13
|
it("fades the old title without a second commit before the timer fires", () => {
|
|
13
|
-
const
|
|
14
|
+
const renders = createRenderTracker();
|
|
14
15
|
const spinner = (title: string) => (
|
|
15
|
-
<Profiler id="spinner" onRender={onRender}>
|
|
16
|
+
<Profiler id="spinner" onRender={renders.onRender}>
|
|
16
17
|
<LargeSpinner title={title} />
|
|
17
18
|
</Profiler>
|
|
18
19
|
);
|
|
19
20
|
const { rerender } = render(spinner("Starting"));
|
|
20
|
-
|
|
21
|
+
renders.reset();
|
|
21
22
|
|
|
22
23
|
rerender(spinner("Loading"));
|
|
23
|
-
expect(
|
|
24
|
+
expect(renders.counts()).toEqual({ spinner: 1 });
|
|
24
25
|
expect(screen.getByText("Starting")).toHaveClass("opacity-0");
|
|
25
26
|
|
|
26
27
|
act(() => vi.advanceTimersByTime(300));
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
useFullScreenElement,
|
|
9
9
|
useIsFullScreen,
|
|
10
10
|
withFullScreenAsRoot,
|
|
11
|
+
withSmartCollisionBoundary,
|
|
11
12
|
} from "../fullscreen";
|
|
12
13
|
|
|
13
14
|
describe("full screen element inside a shadow root", () => {
|
|
@@ -205,3 +206,62 @@ describe("useIsFullScreen", () => {
|
|
|
205
206
|
expect(getByTestId("second")).toHaveTextContent("true");
|
|
206
207
|
});
|
|
207
208
|
});
|
|
209
|
+
|
|
210
|
+
describe("VS Code output container lookup", () => {
|
|
211
|
+
afterEach(() => {
|
|
212
|
+
document.body.removeAttribute("data-vscode-theme-kind");
|
|
213
|
+
vi.restoreAllMocks();
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
it("shares nearest-container behavior across HOCs and resolves again after remount", () => {
|
|
217
|
+
document.body.setAttribute("data-vscode-theme-kind", "vscode-dark");
|
|
218
|
+
const portalContainer = vi.fn();
|
|
219
|
+
const collisionBoundary = vi.fn();
|
|
220
|
+
const Portal = withFullScreenAsRoot(
|
|
221
|
+
({ container }: { container?: Element | DocumentFragment | null }) => {
|
|
222
|
+
portalContainer(container);
|
|
223
|
+
return null;
|
|
224
|
+
},
|
|
225
|
+
);
|
|
226
|
+
const Boundary = withSmartCollisionBoundary(
|
|
227
|
+
({
|
|
228
|
+
collisionBoundary: boundary,
|
|
229
|
+
}: {
|
|
230
|
+
collisionBoundary?: Element | null;
|
|
231
|
+
}) => {
|
|
232
|
+
collisionBoundary(boundary);
|
|
233
|
+
return null;
|
|
234
|
+
},
|
|
235
|
+
);
|
|
236
|
+
const outer = document.createElement("div");
|
|
237
|
+
outer.setAttribute("data-vscode-output-container", "");
|
|
238
|
+
document.body.append(outer);
|
|
239
|
+
try {
|
|
240
|
+
for (let i = 0; i < 2; i++) {
|
|
241
|
+
const inner = document.createElement("div");
|
|
242
|
+
inner.setAttribute("data-vscode-output-container", "");
|
|
243
|
+
const root = document.createElement("div");
|
|
244
|
+
inner.attachShadow({ mode: "open" }).append(root);
|
|
245
|
+
outer.append(inner);
|
|
246
|
+
const closest = vi.spyOn(Element.prototype, "closest");
|
|
247
|
+
const tree = () => (
|
|
248
|
+
<>
|
|
249
|
+
<Portal />
|
|
250
|
+
<Boundary />
|
|
251
|
+
</>
|
|
252
|
+
);
|
|
253
|
+
const { rerender, unmount } = render(tree(), { container: root });
|
|
254
|
+
expect(portalContainer).toHaveBeenLastCalledWith(inner);
|
|
255
|
+
expect(collisionBoundary).toHaveBeenLastCalledWith(inner);
|
|
256
|
+
closest.mockClear();
|
|
257
|
+
rerender(tree());
|
|
258
|
+
expect(closest).not.toHaveBeenCalled();
|
|
259
|
+
unmount();
|
|
260
|
+
closest.mockRestore();
|
|
261
|
+
inner.remove();
|
|
262
|
+
}
|
|
263
|
+
} finally {
|
|
264
|
+
outer.remove();
|
|
265
|
+
}
|
|
266
|
+
});
|
|
267
|
+
});
|
|
@@ -78,6 +78,29 @@ export function useIsFullScreen(ref: RefObject<Element | null>): boolean {
|
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
/** Resolve once per mount; both portal HOCs share the same shadow-DOM lookup. */
|
|
82
|
+
function VscodeOutputContainer({
|
|
83
|
+
children,
|
|
84
|
+
}: {
|
|
85
|
+
children: (container: Element | null) => React.ReactNode;
|
|
86
|
+
}) {
|
|
87
|
+
const [container, setContainer] = React.useState<Element | null>(null);
|
|
88
|
+
const ref = React.useRef<HTMLDivElement>(null);
|
|
89
|
+
useLayoutEffect(() => {
|
|
90
|
+
if (ref.current) {
|
|
91
|
+
setContainer(
|
|
92
|
+
closestThroughShadowDOMs(ref.current, VSCODE_OUTPUT_CONTAINER_SELECTOR),
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}, []);
|
|
96
|
+
return (
|
|
97
|
+
<>
|
|
98
|
+
<div ref={ref} className="contents invisible" />
|
|
99
|
+
{children(container)}
|
|
100
|
+
</>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
81
104
|
/**
|
|
82
105
|
* HOC wrapping a Portal component to use the
|
|
83
106
|
* full screen element as the container if we are in full screen mode
|
|
@@ -87,37 +110,17 @@ export function withFullScreenAsRoot<
|
|
|
87
110
|
container?: Element | DocumentFragment | null;
|
|
88
111
|
},
|
|
89
112
|
>(Component: React.ComponentType<T>) {
|
|
90
|
-
const FindClosestVscodeOutputContainer = (props: T) => {
|
|
91
|
-
const [closest, setClosest] = React.useState<Element | null>(null);
|
|
92
|
-
const el = React.useRef<HTMLDivElement>(null);
|
|
93
|
-
|
|
94
|
-
React.useLayoutEffect(() => {
|
|
95
|
-
if (!el.current) {
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
const found = closestThroughShadowDOMs(
|
|
100
|
-
el.current,
|
|
101
|
-
VSCODE_OUTPUT_CONTAINER_SELECTOR,
|
|
102
|
-
);
|
|
103
|
-
setClosest(found);
|
|
104
|
-
}, []);
|
|
105
|
-
|
|
106
|
-
return (
|
|
107
|
-
<>
|
|
108
|
-
<div ref={el} className="contents invisible" />
|
|
109
|
-
<Component {...props} container={closest} />
|
|
110
|
-
</>
|
|
111
|
-
);
|
|
112
|
-
};
|
|
113
|
-
|
|
114
113
|
const Comp = (props: T) => {
|
|
115
114
|
const fullScreenElement = useFullScreenElement();
|
|
116
115
|
|
|
117
116
|
// If we are in the VSCode extension, we use the VSCode output container
|
|
118
117
|
const vscodeOutputContainer = isInVscodeExtension();
|
|
119
118
|
if (vscodeOutputContainer) {
|
|
120
|
-
return
|
|
119
|
+
return (
|
|
120
|
+
<VscodeOutputContainer>
|
|
121
|
+
{(container) => <Component {...props} container={container} />}
|
|
122
|
+
</VscodeOutputContainer>
|
|
123
|
+
);
|
|
121
124
|
}
|
|
122
125
|
|
|
123
126
|
if (!fullScreenElement) {
|
|
@@ -140,35 +143,17 @@ export function withSmartCollisionBoundary<
|
|
|
140
143
|
collisionBoundary?: PopoverContentProps["collisionBoundary"];
|
|
141
144
|
},
|
|
142
145
|
>(Component: React.ComponentType<T>) {
|
|
143
|
-
const FindClosestVscodeOutputContainer = (props: T) => {
|
|
144
|
-
const [closest, setClosest] = React.useState<Element | null>(null);
|
|
145
|
-
const el = React.useRef<HTMLDivElement>(null);
|
|
146
|
-
|
|
147
|
-
React.useLayoutEffect(() => {
|
|
148
|
-
if (!el.current) {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
const found = closestThroughShadowDOMs(
|
|
153
|
-
el.current,
|
|
154
|
-
VSCODE_OUTPUT_CONTAINER_SELECTOR,
|
|
155
|
-
);
|
|
156
|
-
setClosest(found);
|
|
157
|
-
}, []);
|
|
158
|
-
|
|
159
|
-
return (
|
|
160
|
-
<>
|
|
161
|
-
<div ref={el} className="contents invisible" />
|
|
162
|
-
<Component {...props} collisionBoundary={closest} />
|
|
163
|
-
</>
|
|
164
|
-
);
|
|
165
|
-
};
|
|
166
|
-
|
|
167
146
|
const Comp = (props: T) => {
|
|
168
147
|
// If we are in the VSCode extension, we use the VSCode output container
|
|
169
148
|
const vscodeOutputContainer = isInVscodeExtension();
|
|
170
149
|
if (vscodeOutputContainer) {
|
|
171
|
-
return
|
|
150
|
+
return (
|
|
151
|
+
<VscodeOutputContainer>
|
|
152
|
+
{(container) => (
|
|
153
|
+
<Component {...props} collisionBoundary={container} />
|
|
154
|
+
)}
|
|
155
|
+
</VscodeOutputContainer>
|
|
156
|
+
);
|
|
172
157
|
}
|
|
173
158
|
|
|
174
159
|
return <Component {...props} />;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* Copyright 2026 Marimo. All rights reserved. */
|
|
2
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
3
|
+
import { isInVscodeExtension } from "../is-in-vscode";
|
|
4
|
+
|
|
5
|
+
afterEach(() => {
|
|
6
|
+
document.body.removeAttribute("data-vscode-theme-kind");
|
|
7
|
+
vi.restoreAllMocks();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
describe("isInVscodeExtension", () => {
|
|
11
|
+
it("detects an ordinary browser", () => {
|
|
12
|
+
expect(isInVscodeExtension()).toBe(false);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it.each([
|
|
16
|
+
"vscode-light",
|
|
17
|
+
"vscode-dark",
|
|
18
|
+
"vscode-high-contrast",
|
|
19
|
+
"vscode-high-contrast-light",
|
|
20
|
+
])("detects %s on the first call", (theme) => {
|
|
21
|
+
document.body.setAttribute("data-vscode-theme-kind", theme);
|
|
22
|
+
expect(isInVscodeExtension()).toBe(true);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("observes attribute changes without scanning the document", () => {
|
|
26
|
+
const query = vi.spyOn(document, "querySelector");
|
|
27
|
+
const queryAll = vi.spyOn(document, "querySelectorAll");
|
|
28
|
+
expect(isInVscodeExtension()).toBe(false);
|
|
29
|
+
document.body.setAttribute("data-vscode-theme-kind", "vscode-dark");
|
|
30
|
+
expect(isInVscodeExtension()).toBe(true);
|
|
31
|
+
document.body.removeAttribute("data-vscode-theme-kind");
|
|
32
|
+
expect(isInVscodeExtension()).toBe(false);
|
|
33
|
+
expect(query).not.toHaveBeenCalled();
|
|
34
|
+
expect(queryAll).not.toHaveBeenCalled();
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -4,6 +4,6 @@
|
|
|
4
4
|
* Whether the current environment is in the VSCode extension
|
|
5
5
|
*/
|
|
6
6
|
export function isInVscodeExtension(): boolean {
|
|
7
|
-
//
|
|
8
|
-
return document.
|
|
7
|
+
// VS Code adds this attribute to the body before loading webview scripts.
|
|
8
|
+
return document.body?.hasAttribute("data-vscode-theme-kind") ?? false;
|
|
9
9
|
}
|