Round only exterior corners of docked editor panes

This commit is contained in:
Codex
2026-11-14 22:37:52 +03:00
parent 616ec9160a
commit 9a00d0bb06
7 changed files with 38 additions and 3 deletions
+4
View File
@@ -4542,6 +4542,10 @@ textarea.nodedc-field__control {
.nodedc-editor-dock__tool[hidden] {display:none;}
.nodedc-editor-dock__tool:not([data-floating]) {border-radius:0;box-shadow:none;}
.nodedc-editor-dock__tool::before {display:none;}
.nodedc-editor-dock :is(.nodedc-editor-dock__tool,.nodedc-editor-dock__primary)[data-dock-corners~="top-left"] {border-top-left-radius:var(--nodedc-radius-panel);}
.nodedc-editor-dock :is(.nodedc-editor-dock__tool,.nodedc-editor-dock__primary)[data-dock-corners~="top-right"] {border-top-right-radius:var(--nodedc-radius-panel);}
.nodedc-editor-dock :is(.nodedc-editor-dock__tool,.nodedc-editor-dock__primary)[data-dock-corners~="bottom-right"] {border-bottom-right-radius:var(--nodedc-radius-panel);}
.nodedc-editor-dock :is(.nodedc-editor-dock__tool,.nodedc-editor-dock__primary)[data-dock-corners~="bottom-left"] {border-bottom-left-radius:var(--nodedc-radius-panel);}
.nodedc-editor-dock__tool>.nodedc-window__head {flex:none;cursor:grab;touch-action:none;user-select:none;}
.nodedc-editor-dock__tool>.nodedc-window__head:active {cursor:grabbing;}
.nodedc-editor-dock__tool>.nodedc-window__head:focus-visible {outline:2px solid var(--nodedc-text-primary);outline-offset:-3px;}
+3 -2
View File
@@ -7,6 +7,7 @@ import {InspectorSelectPolicyContext} from './InspectorContext.js';
import {LoadingContext} from './LoadingContext.js';
import {fitWindow,resizeWindow,windowResizeEdges,type ResizeEdge} from './windowGeometry.js';
import {cn} from './cn.js';
import {editorDockCorners} from './editorDockCorners.js';
export interface EditorDockTool {
id:string;title:ReactNode;label:string;open:boolean;onClose:()=>void;content:ReactNode;
@@ -97,11 +98,11 @@ export function EditorDockLayout({value,onChange,primary,primaryId='viewport',pr
return <div ref={viewport} className={cn('nodedc-editor-dock',className)} data-editing={enabled||undefined} data-dragging={!!drag||undefined}>
<div ref={host} className="nodedc-editor-dock__canvas" style={{minWidth:required.width,minHeight:required.height}}>
<EditorSplits tree={constrained} bounds={area} minimums={minimums} onResize={(path,ratio)=>onChange({...value,tree:mergeEditorDockRatios(value.tree,resizeDockSplit(constrained,path,ratio))})}/>
<div className="nodedc-editor-dock__primary" data-editor-primary={primaryId} style={rects[primaryId]}>{primary}</div>
<div className="nodedc-editor-dock__primary" data-editor-primary={primaryId} data-dock-corners={editorDockCorners(rects[primaryId],area)} style={rects[primaryId]}>{primary}</div>
{tools.map(tool=>{
const moving=drag?.id===tool.id,free=!rects[tool.id]||moving;
const rect=moving?drag.current:rects[tool.id]??floatingRect(tool.id);
return <div key={tool.id} className={cn('nodedc-editor-dock__tool nodedc-glass-material nodedc-ui-root',tool.className)} data-editor-tool={tool.id} data-floating={free||undefined} data-active={order.at(-1)===tool.id||undefined}
return <div key={tool.id} className={cn('nodedc-editor-dock__tool nodedc-glass-material nodedc-ui-root',tool.className)} data-editor-tool={tool.id} data-floating={free||undefined} data-dock-corners={free?undefined:editorDockCorners(rect,area)} data-active={order.at(-1)===tool.id||undefined}
role="region" aria-label={tool.label} hidden={!enabled||!tool.open} style={{...rect,zIndex:moving?40:free?10+Math.max(0,order.indexOf(tool.id)):1}}
onPointerDownCapture={()=>activate(tool.id)} onFocusCapture={()=>activate(tool.id)}>
<header className="nodedc-window__head" tabIndex={0} aria-label={`Переместить · ${tool.label}`} aria-roledescription="Перемещаемая панель" onPointerDown={e=>begin(tool.id,e)} onKeyDown={e=>key(tool.id,e)}>
@@ -0,0 +1,8 @@
import type {DockRect} from '@nodedc/ui-core';
/** Only corners on both outer edges are rounded; all internal seams stay square. */
export function editorDockCorners(rect:DockRect,area:DockRect):string {
const same=(a:number,b:number)=>Math.abs(a-b)<.01;
const left=same(rect.left,area.left),top=same(rect.top,area.top);
const right=same(rect.left+rect.width,area.left+area.width),bottom=same(rect.top+rect.height,area.top+area.height);
return [top&&left?'top-left':'',top&&right?'top-right':'',bottom&&right?'bottom-right':'',bottom&&left?'bottom-left':''].filter(Boolean).join(' ');
}