Файли
openidea/src/ui/Dialog.tsx
T
l0ng-ai 75c57e2691 feat(branding): use the gradient OpenIDEA logo (#7618)
Replace the OpenIDEA mark with the gradient ring artwork on the startup, welcome, About, clone and project-opening screens, in the OS icon bundle and in the documentation branding. The in-app logo is a bundled asset so it resolves under a Web IDE subpath. Dogfood keeps a greyscale version of the same artwork, and the Rust build tracks the embedded icon inputs so icon-only changes rebuild the development Dock icon.

Closes #3948
2026-12-03 21:59:06 +08:00

638 рядки
25 KiB
TypeScript

import { useContext, useEffect, useLayoutEffect, useRef, useState, type PointerEvent, type ReactNode } from "react";
import { createPortal } from "react-dom";
import clsx from "clsx";
import { usePlatform } from "@/platform/platformInfo";
import { Button, IconButton } from "./Button";
import { FOCUSABLE, dismissPopups, onWindowDeactivate, openLayer, trapTab, type LayerHandle } from "./popupState";
import { PopupAncestry } from "./Popup";
import { tx, useGivenTx } from "@/platform/i18n";
import { selectableText } from "./selectableText";
import logo from "@/assets/openidea-logo.png";
import styles from "./Dialog.module.css";
import { isImeKey } from "@/platform/ime";
import { lockDragCursor, type DragCursor } from "./dragCursor";
import { suspendKeyboardDispatch } from "@/platform/keymap";
/**
* `default`: filled accent button, triggered by Enter. `cancel`: Esc / close
* button do the same. `extra`: any other action.
*/
export type DialogButtonRole = "default" | "cancel" | "extra";
export interface DialogButton {
label: string;
/** Defaults to the dialog's `onClose` for `cancel`. */
onClick?: () => void;
role?: DialogButtonRole;
disabled?: boolean;
/** Initial focus instead of the first field of the content. */
autoFocus?: boolean;
/** Tooltip (e.g. why the button is disabled). */
title?: string;
}
export type DialogPlatform = "mac" | "other";
/** macOS chrome and button order everywhere except Windows / Linux. */
export function dialogPlatformOf(os: string): DialogPlatform {
return os === "windows" || os === "linux" ? "other" : "mac";
}
export function useDialogPlatform(override?: DialogPlatform): DialogPlatform {
const os = usePlatform((s) => s.os);
return override ?? dialogPlatformOf(os);
}
const MAC_CLOSE_BUTTONS: readonly DialogButton[] = [{ label: "Close", role: "cancel" }];
const MAC_ORDER: Record<DialogButtonRole, number> = { cancel: -10, extra: 0, default: 100 };
/**
* IntelliJ's DialogWrapper order. macOS (`sortActionsOnMac`): Cancel first, the
* default action last, others in between. Elsewhere: declaration order with the
* default action first, e.g. OK · Cancel · Apply.
*/
export function orderDialogButtons<T extends { role?: DialogButtonRole }>(
buttons: readonly T[],
platform: DialogPlatform,
): T[] {
const role = (b: T) => b.role ?? "extra";
if (platform === "mac") {
return buttons
.map((b, i) => ({ b, i }))
.sort((x, y) => MAC_ORDER[role(x.b)] - MAC_ORDER[role(y.b)] || x.i - y.i)
.map((x) => x.b);
}
return [...buttons.filter((b) => role(b) === "default"), ...buttons.filter((b) => role(b) !== "default")];
}
/** The right-aligned button row of a dialog, ordered for the platform. */
export function DialogButtons({
buttons,
onCancel,
platform: override,
}: {
buttons: readonly DialogButton[];
/** Click handler of `cancel` buttons without their own. */
onCancel?: () => void;
platform?: DialogPlatform;
}) {
const platform = useDialogPlatform(override);
const given = useGivenTx();
return (
<div className={styles.buttons}>
{orderDialogButtons(buttons, platform).map((b) => (
<Button
key={b.label}
variant={b.role === "default" ? "primary" : "secondary"}
disabled={b.disabled}
title={given(b.title)}
data-autofocus={b.autoFocus ? "" : undefined}
data-dialog-default={b.role === "default" ? "" : undefined}
onClick={b.onClick ?? (b.role === "cancel" ? onCancel : undefined)}
>
{given(b.label)}
</Button>
))}
</div>
);
}
export interface DialogProps {
open: boolean;
/** Cancel: Escape, the close button / light, and `cancel` buttons without a handler. */
onClose: () => void;
/** Keep workbench shortcuts out of blocking prompts; dialog-local keys still work. */
blockWorkbenchShortcuts?: boolean;
title?: ReactNode;
children: ReactNode;
/** Footer buttons; ordered per platform (see `orderDialogButtons`). */
buttons?: readonly DialogButton[];
/** Left side of the footer: checkboxes ("Don't ask again"), status, left-side actions. */
footerStart?: ReactNode;
/** Shows the round "?" help button at the bottom left. */
onHelp?: () => void;
/** Free-form footer for the rare dialog whose footer is not a button row. */
footer?: ReactNode;
width?: number | string;
/**
* `both` enables resizing the window or popup from all edges and corners, with
* a visible bottom-right corner grip. The content lays out again against the
* new size; a numeric `width` is also the minimum width unless `minWidth` says
* otherwise.
*/
resizable?: "both";
minWidth?: number;
minHeight?: number;
/** Height cap while content-sized; a manual resize lifts it. */
maxHeight?: number;
/** Size to open at, such as one remembered from `onResized`; kept inside the window. */
initialSize?: { w: number; h: number } | null;
/** The size a resize ended at. */
onResized?: (size: { w: number; h: number }) => void;
/**
* `top` places a lightweight modal popup (choosers, Search Everywhere) near
* the top. Popups (also any dialog without a title) get no window title bar
* and drag only by a `[data-dialog-drag]` element, such as their title.
*/
position?: "center" | "top";
/** Use lightweight popup chrome even when the dialog is centered. */
popup?: boolean;
className?: string;
"aria-label"?: string;
/** Close when clicking outside (default: only for `top` popups). */
dismissOnBackdrop?: boolean;
/** Close when the app window loses focus (default: popups only; never modal dialogs). */
closeOnDeactivate?: boolean;
/**
* Asked on close: give focus back to what had it before the dialog (default: always). False
* when what the dialog opens takes focus itself.
*/
restoreFocus?: () => boolean;
/**
* False for a dialog that opens over work the user is typing into: it leaves the focus and the
* popups where they are and answers no key typed outside it until the user clicks into it,
* then behaves as any modal dialog (default: true). Read once at mount: remount the dialog
* (e.g. with a new `key`) to change it.
*/
takesFocus?: boolean;
/** @deprecated Dialogs never dim the window behind them; kept for call sites. */
transparentBackdrop?: boolean;
/** @deprecated Every centred dialog has window chrome; kept for call sites. */
chrome?: "default" | "window";
/** Test hook: force macOS or Windows/Linux chrome and button order. */
platform?: DialogPlatform;
/**
* A Messages alert (IDEA `MessageDialogBuilder`): no title bar, this icon on the
* left, the title in bold above the content, `footerStart` under the text.
*/
icon?: MessageIconKind | "app";
}
export type MessageIconKind = "question" | "info" | "warning" | "error";
const MESSAGE_GLYPH: Record<MessageIconKind, ReactNode> = {
question: (
<path
d="M12.6 12.6a3.4 3.4 0 1 1 5 3c-1 .6-1.6 1.2-1.6 2.4v.6M16 22.2v.4"
fill="none"
strokeWidth="2.6"
strokeLinecap="round"
strokeLinejoin="round"
/>
),
info: <path d="M16 15v7M16 10.2v.4" fill="none" strokeWidth="2.6" strokeLinecap="round" />,
warning: <path d="M16 11v6.5M16 21.6v.4" fill="none" strokeWidth="2.6" strokeLinecap="round" />,
error: <path d="M12 12l8 8M20 12l-8 8" fill="none" strokeWidth="2.6" strokeLinecap="round" />,
};
function MessageIcon({ kind }: { kind: MessageIconKind }) {
return (
<svg
className={clsx(styles.messageIcon, styles[kind])}
width={32}
height={32}
viewBox="0 0 32 32"
aria-hidden="true"
>
{kind === "warning" ? (
<path
className={styles.messageShape}
d="M13.4 4.6a3 3 0 0 1 5.2 0l11 19.4A3 3 0 0 1 27 28.5H5A3 3 0 0 1 2.4 24z"
/>
) : (
<circle className={styles.messageShape} cx="16" cy="16" r="14" />
)}
<g className={styles.messageGlyph}>{MESSAGE_GLYPH[kind]}</g>
</svg>
);
}
/**
* Modal dialog after IntelliJ's DialogWrapper: a window with the platform's
* title bar (macOS traffic lights / title + close), draggable by it; Enter runs
* the default button, Escape cancels; focus is trapped and restored.
*/
export function Dialog(props: DialogProps) {
if (!props.open) return null;
return <DialogInner {...props} />;
}
const ENTER_OWNERS =
'textarea, button, a[href], select, form, [contenteditable=""], [contenteditable="true"], [role="listbox"], [role="tree"], [role="grid"], [role="menu"], [role="combobox"][aria-expanded="true"]';
function DialogInner({
onClose,
blockWorkbenchShortcuts = false,
title,
children,
buttons: givenButtons,
footerStart,
onHelp,
footer,
width = 480,
resizable,
minWidth,
minHeight,
maxHeight,
initialSize,
onResized,
position = "center",
popup: asPopup = false,
className,
dismissOnBackdrop,
closeOnDeactivate,
restoreFocus,
takesFocus = true,
platform: platformOverride,
icon,
...aria
}: DialogProps) {
const ref = useRef<HTMLDivElement>(null);
const platform = useDialogPlatform(platformOverride);
const overlayTitleBar = usePlatform((s) => s.overlayTitleBar);
const given = useGivenTx();
if (typeof title === "string") title = given(title);
const popup = asPopup || position === "top" || (title == null && !icon);
// A macOS sheet has no close button of its own: one without footer buttons gets a Close button
// so it can still be closed with the mouse.
const buttons =
platform === "mac" && !popup && !icon && !givenButtons?.length && !footer ? MAC_CLOSE_BUTTONS : givenButtons;
const onCloseRef = useRef(onClose);
const buttonsRef = useRef(buttons);
const restoreFocusRef = useRef(restoreFocus);
useLayoutEffect(() => {
onCloseRef.current = onClose;
buttonsRef.current = buttons;
restoreFocusRef.current = restoreFocus;
});
const [offset, setOffset] = useState({ x: 0, y: 0 });
const [active, setActive] = useState(() => typeof document === "undefined" || document.hasFocus());
const [size, setSize] = useState<{ w: number; h: number } | null>(() =>
resizable && initialSize && typeof window !== "undefined"
? { w: Math.min(initialSize.w, window.innerWidth - 24), h: Math.min(initialSize.h, window.innerHeight - 24) }
: null,
);
const fittedInitialRef = useRef(false);
useLayoutEffect(() => {
if (fittedInitialRef.current) return;
fittedInitialRef.current = true;
if (!popup || !resizable || !initialSize) return;
const el = ref.current;
if (!el) return;
const rect = el.getBoundingClientRect();
if (rect.height <= 0 || rect.bottom <= window.innerHeight - 12) return;
const minTop = Math.max(
12,
overlayTitleBar && el.parentElement ? parseFloat(getComputedStyle(el.parentElement).paddingTop) : 12,
);
const dy = Math.max(minTop - rect.top, window.innerHeight - 12 - rect.bottom);
if (dy < 0) setOffset((o) => ({ x: o.x, y: o.y + dy }));
}, [popup, resizable, initialSize, overlayTitleBar]);
useEffect(() => {
const onFocus = () => setActive(true);
const onBlur = () => setActive(false);
window.addEventListener("focus", onFocus);
window.addEventListener("blur", onBlur);
return () => {
window.removeEventListener("focus", onFocus);
window.removeEventListener("blur", onBlur);
};
}, []);
useEffect(() => {
if (!popup || !resizable) return;
const fitPopup = () => {
const rect = ref.current?.getBoundingClientRect();
if (!rect) return;
const left = Math.max(0, Math.min(rect.left, window.innerWidth - rect.width));
const top = Math.max(0, Math.min(rect.top, window.innerHeight - rect.height));
if (left !== rect.left || top !== rect.top) {
setOffset({ x: offset.x + left - rect.left, y: offset.y + top - rect.top });
}
};
window.addEventListener("resize", fitPopup);
return () => window.removeEventListener("resize", fitPopup);
}, [popup, resizable, offset]);
const cancelOnDeactivate = closeOnDeactivate ?? popup;
useEffect(() => {
if (!cancelOnDeactivate) return;
return onWindowDeactivate(() => onCloseRef.current());
}, [cancelOnDeactivate]);
useEffect(() => (blockWorkbenchShortcuts ? suspendKeyboardDispatch() : undefined), [blockWorkbenchShortcuts]);
const ancestry = useRef(useContext(PopupAncestry));
const takesFocusRef = useRef(takesFocus);
useEffect(() => {
// Opened by `engage`: on mount, or for a dialog that takes no focus, once focus enters it.
let layer: LayerHandle | null = null;
const engage = () => {
dismissPopups(new Set(ancestry.current.flatMap((r) => (r.current === null ? [] : [r.current]))));
layer = openLayer(() => ref.current);
};
let previous = document.activeElement as HTMLElement | null;
const el = ref.current;
// Content first (an alert's checkbox is not content), then the default button; never the title bar's close button.
const target =
el?.querySelector<HTMLElement>("[data-autofocus]") ??
(el?.hasAttribute("data-alert")
? null
: el?.querySelector<HTMLElement>(`[data-dialog-body] :is(${FOCUSABLE})`)) ??
el?.querySelector<HTMLElement>("[data-dialog-footer] [data-dialog-default]:not([disabled])") ??
el?.querySelector<HTMLElement>(`[data-dialog-footer] :is(${FOCUSABLE})`) ??
el;
let lastFocused = target;
const onFocusIn = (e: FocusEvent) => {
const focused = e.target;
if (!(focused instanceof HTMLElement)) return;
if (el?.contains(focused)) {
if (!layer) engage();
lastFocused = focused;
} else if (!layer) previous = focused;
else if (!layer.containsFromHere(focused) && layer.isTop()) {
// A newly mounted portal can focus before its layer's effect registers it.
const overlay = focused.closest('[data-popup], [role="dialog"]');
if (overlay && el && el.compareDocumentPosition(overlay) & Node.DOCUMENT_POSITION_FOLLOWING) return;
// An editor opened behind this dialog may finish mounting on a later frame.
previous = focused;
(lastFocused?.isConnected ? lastFocused : target)?.focus({ preventScroll: true });
if (el && !el.contains(document.activeElement)) el.focus({ preventScroll: true });
}
};
document.addEventListener("focusin", onFocusIn);
if (takesFocusRef.current) {
engage();
target?.focus({ preventScroll: true });
}
const onKey = (e: KeyboardEvent) => {
if (!layer?.isTop() || !ref.current) return;
// A page frozen with `inert` (a window waiting to close) still sends keys aimed at the body here.
if (ref.current.closest("[inert]")) return;
if (!takesFocusRef.current && !(e.target instanceof Node && ref.current.contains(e.target))) return;
if (e.key === "Escape") {
e.preventDefault();
e.stopImmediatePropagation();
onCloseRef.current();
} else if (e.key === "Tab") {
trapTab(e, ref.current);
} else if (e.key === "Enter" && !e.defaultPrevented && !isImeKey(e) && !e.shiftKey && !e.altKey) {
const t = e.target instanceof Element ? e.target : null;
const mod = e.metaKey || e.ctrlKey;
if (t && t !== document.body && !ref.current.contains(t)) return;
if (!mod && t?.closest(ENTER_OWNERS)) return;
const def = buttonsRef.current?.find((b) => b.role === "default");
if (!def || def.disabled || !def.onClick) return;
e.preventDefault();
e.stopImmediatePropagation();
def.onClick();
}
};
document.addEventListener("keydown", onKey);
return () => {
document.removeEventListener("keydown", onKey);
document.removeEventListener("focusin", onFocusIn);
if (!layer) return;
layer.release();
if (previous?.isConnected && restoreFocusRef.current?.() !== false) previous.focus({ preventScroll: true });
};
}, []);
const drag = (e: PointerEvent<HTMLDivElement>) => {
if (
e.button !== 0 ||
!(e.target as Element).closest("[data-dialog-drag]") ||
(e.target as Element).closest(`button, input, label, a, select, textarea, .${selectableText}`)
)
return;
const el = ref.current;
if (!el) return;
e.preventDefault();
const start = { x: e.clientX - offset.x, y: e.clientY - offset.y };
const rect = el.getBoundingClientRect();
const base = { left: rect.left - offset.x, top: rect.top - offset.y };
const minTop = overlayTitleBar && el.parentElement ? parseFloat(getComputedStyle(el.parentElement).paddingTop) : 0;
const move = (ev: globalThis.PointerEvent) => {
if (!(ev.buttons & 1)) return up();
// Keep the title bar reachable.
const x = Math.min(
Math.max(ev.clientX - start.x, -base.left - rect.width + 80),
window.innerWidth - base.left - 80,
);
const y = Math.min(Math.max(ev.clientY - start.y, minTop - base.top), window.innerHeight - base.top - 28);
setOffset({ x, y });
};
const up = () => {
window.removeEventListener("pointermove", move);
window.removeEventListener("pointerup", up);
};
window.addEventListener("pointermove", move);
window.addEventListener("pointerup", up);
};
const label = aria["aria-label"] ?? (typeof title === "string" ? title : undefined);
const hasFooter = !!(buttons?.length || footerStart || onHelp || footer);
const canResize = resizable === "both";
const startResize =
(dxSign: -1 | 0 | 1, dySign: -1 | 0 | 1, cursor: DragCursor) => (e: PointerEvent<HTMLDivElement>) => {
if (e.button !== 0) return;
const el = ref.current;
if (!el) return;
e.preventDefault();
e.stopPropagation();
const releaseCursor = lockDragCursor(cursor);
const start = { x: e.clientX, y: e.clientY };
const rect = el.getBoundingClientRect();
const minW = minWidth ?? (typeof width === "number" ? width : 320);
const chrome = el.querySelector<HTMLElement>("[data-dialog-titlebar]")?.offsetHeight ?? 0;
const minH = minHeight ?? chrome + 120;
const minTop = Math.max(
12,
overlayTitleBar && el.parentElement ? parseFloat(getComputedStyle(el.parentElement).paddingTop) : 12,
);
const origin = offset;
let last: { w: number; h: number } | null = null;
const move = (ev: globalThis.PointerEvent) => {
if (!(ev.buttons & 1)) return up();
let w: number;
let nextX: number;
if (dxSign !== 0) {
const maxW =
rect.width > 0
? Math.max(
minW,
Math.min(window.innerWidth - 24, dxSign > 0 ? window.innerWidth - rect.left - 12 : rect.right - 12),
)
: window.innerWidth - 24;
w = Math.min(Math.max(rect.width + dxSign * (ev.clientX - start.x), minW), maxW);
nextX = origin.x + (dxSign * (w - rect.width)) / 2;
} else {
w = size?.w ?? (rect.width > 0 ? Math.max(rect.width, minW) : typeof width === "number" ? width : minW);
nextX = origin.x;
}
let h: number;
let nextY: number;
if (dySign === 1) {
const maxH =
position === "top"
? window.innerHeight - rect.top - 12
: rect.height > 0
? Math.max(minH, Math.min(window.innerHeight - 24, window.innerHeight - rect.top - 12))
: window.innerHeight - 24;
h = Math.min(Math.max(rect.height + (ev.clientY - start.y), minH), maxH);
nextY = position === "top" ? origin.y : origin.y + (h - rect.height) / 2;
} else if (dySign === -1) {
const maxH =
rect.height > 0
? Math.max(minH, Math.min(window.innerHeight - 24, rect.bottom - minTop))
: window.innerHeight - 24;
h = Math.min(Math.max(rect.height - (ev.clientY - start.y), minH), maxH);
nextY = position === "top" ? origin.y - (h - rect.height) : origin.y - (h - rect.height) / 2;
} else {
h = size?.h ?? (rect.height > 0 ? Math.max(rect.height, minH) : minH);
nextY = origin.y;
}
last = { w, h };
setSize(last);
setOffset({ x: nextX, y: nextY });
};
const up = () => {
window.removeEventListener("pointermove", move);
window.removeEventListener("pointerup", up);
releaseCursor();
if (last) onResized?.(last);
};
window.addEventListener("pointermove", move);
window.addEventListener("pointerup", up);
};
const resizeHandles: ReadonlyArray<{
dir: string;
className: string | undefined;
dx: -1 | 0 | 1;
dy: -1 | 0 | 1;
cursor: DragCursor;
}> = [
{ dir: "n", className: styles.resizeN, dx: 0, dy: -1, cursor: "ns-resize" },
{ dir: "s", className: styles.resizeS, dx: 0, dy: 1, cursor: "ns-resize" },
{ dir: "w", className: styles.resizeW, dx: -1, dy: 0, cursor: "ew-resize" },
{ dir: "e", className: styles.resizeE, dx: 1, dy: 0, cursor: "ew-resize" },
{ dir: "nw", className: styles.resizeNW, dx: -1, dy: -1, cursor: "nwse-resize" },
{ dir: "ne", className: styles.resizeNE, dx: 1, dy: -1, cursor: "nesw-resize" },
{ dir: "sw", className: styles.resizeSW, dx: -1, dy: 1, cursor: "nesw-resize" },
];
return createPortal(
<div
className={clsx(styles.backdrop, position === "top" && styles.top, overlayTitleBar && styles.belowTitleBar)}
onPointerDown={(e) => {
if ((dismissOnBackdrop ?? popup) && e.target === e.currentTarget) onClose();
}}
>
<div
ref={ref}
role="dialog"
aria-modal="true"
aria-label={label}
tabIndex={-1}
data-platform={platform}
data-alert={icon ? "" : undefined}
data-inactive={active ? undefined : ""}
data-resized={size ? "" : undefined}
className={clsx(styles.dialog, popup ? styles.popup : styles.window, className)}
onPointerDown={drag}
style={{
width: size ? size.w : width,
height: size?.h,
maxHeight: !size && maxHeight ? `min(${maxHeight}px, 100%)` : undefined,
translate: offset.x || offset.y ? `${offset.x}px ${offset.y}px` : undefined,
}}
>
{icon ? null : popup ? (
title != null && (
<div className={styles.popupHeader} data-dialog-drag="">
<span className={styles.title}>{title}</span>
</div>
)
) : platform === "mac" ? (
// A sheet over the window, as the dialog windows look: the title heads the content, no
// window buttons of its own (Esc and Cancel or Close close it).
<div className={clsx(styles.titleBar, styles.macTitleBar)} data-dialog-drag="" data-dialog-titlebar="">
<span className={styles.title}>{title}</span>
</div>
) : (
<div className={styles.titleBar} data-dialog-drag="" data-dialog-titlebar="">
<span className={styles.title}>{title}</span>
<IconButton icon="close" title="Close" size="small" tabIndex={-1} onClick={onClose} />
</div>
)}
{icon ? (
<div className={styles.message} data-dialog-body="" data-dialog-drag="">
{icon === "app" ? (
<img className={styles.messageAppIcon} src={logo} alt="" draggable={false} />
) : (
<MessageIcon kind={icon} />
)}
<div className={styles.messageText}>
{title != null && <div className={clsx(styles.messageTitle, selectableText)}>{title}</div>}
<div className={clsx(styles.messageBody, selectableText)}>
{typeof children === "string" ? given(children) : children}
</div>
{footerStart && <div className={styles.messageExtra}>{footerStart}</div>}
</div>
</div>
) : (
<div className={styles.body} data-dialog-body="">
{children}
</div>
)}
{icon
? !!buttons?.length && (
<div className={clsx(styles.footer, styles.messageFooter)} data-dialog-footer="" data-dialog-drag="">
<DialogButtons buttons={buttons} onCancel={onClose} platform={platform} />
</div>
)
: hasFooter && (
<div className={styles.footer} data-dialog-footer="">
{onHelp && (
<button type="button" className={styles.help} aria-label={tx("Help")} onClick={onHelp}>
?
</button>
)}
{footerStart && <div className={styles.footerStart}>{footerStart}</div>}
{footer}
{!!buttons?.length && <DialogButtons buttons={buttons} onCancel={onClose} platform={platform} />}
</div>
)}
{canResize && (
<>
{resizeHandles.map((h) => (
<div
key={h.dir}
aria-hidden="true"
data-resize={h.dir}
className={clsx(styles.resizeEdge, h.className)}
onPointerDown={startResize(h.dx, h.dy, h.cursor)}
/>
))}
<div
className={styles.resizeGrip}
data-resize="se"
role="separator"
aria-orientation="vertical"
aria-label={tx("Resize")}
onPointerDown={startResize(1, 1, "nwse-resize")}
/>
</>
)}
</div>
</div>,
document.body,
);
}