3 Commits
13 changed files with 174 additions and 39 deletions
+2 -2
View File
@@ -11,8 +11,8 @@
},
"dependencies": {
"@nodedc/page-patterns": "0.1.0",
"@nodedc/ui-core": "0.7.3",
"@nodedc/ui-react": "0.7.8",
"@nodedc/ui-core": "0.7.4",
"@nodedc/ui-react": "0.7.10",
"cesium": "1.147.0",
"react": "^19.1.0",
"react-dom": "^19.1.0"
+8 -1
View File
@@ -65,6 +65,7 @@ import {
TextField,
ToastCard,
ToastStack,
ToastObserver,
Toolbar,
NavigationCube,
UserProfileMenu,
@@ -362,6 +363,7 @@ export function CatalogApp() {
const [applicationSaveState, setApplicationSaveState] = useState<ApplicationDraftSaveState>("idle");
const [applicationError, setApplicationError] = useState("");
const [toasts, setToasts] = useState<ToastItem[]>([]);
const [observedToasts, setObservedToasts] = useState<ToastItem[]>([]);
const toastSequenceRef = useRef(0);
const [sessionProfile, setSessionProfile] = useState<FoundrySessionProfile | null>(null);
const [foundrySettingsOpen, setFoundrySettingsOpen] = useState(false);
@@ -1657,6 +1659,7 @@ export function CatalogApp() {
eyebrow="MAP / SETTINGS"
title="Настройки карты"
description="Theme-aware application panel"
headerActions={<IconButton label="Настройки панели" onClick={() => setInspectorOpen(true)}><Icon name="settings" /></IconButton>}
onClose={() => setSidePanelDemoOpen(false)}
>
<Inspector variant="panel" sections={environmentSections.slice(0, 3).map(section=>({...section,action:{label:`Действие секции ${section.label}`,icon:<Icon name="edit"/>,onAction:()=>setInspectorOpen(true)}}))} defaultOpen={[environmentSections[0]?.id ?? ""]} singleOpen />
@@ -1801,6 +1804,7 @@ export function CatalogApp() {
</div>
</SettingsCard>
<SettingsCard eyebrow="LIVE STATES" title="Проверка стека" description="Кнопки используют тот же bottom-right viewport, что и реальные save/update flows.">
<Description>Последняя передача приложению: {observedToasts.map(item => item.title).join(', ') || 'нет уведомлений'}</Description>
<div className="catalog-inline catalog-inline--wrap">
<Button onClick={() => pushToast("success", "Изменения сохранены", "Статус автоматически исчезнет.")}>Success</Button>
<Button onClick={() => pushToast("info", "Профиль применён", "Application использует выбранную версию.")}>Info</Button>
@@ -2204,6 +2208,7 @@ export function CatalogApp() {
<UserProfileMenu
triggerLabel="Профиль"
triggerIcon="inbox"
headerAction={{label: 'Правая панель', pressed: sidePanelDemoOpen, onSelect: () => setSidePanelDemoOpen(open => !open)}}
displayName={sessionProfile?.user?.displayName || "Профиль"}
subtitle={sessionProfile?.user?.email || "NODE.DC Foundry"}
avatarUrl={sessionProfile?.user?.avatarUrl || undefined}
@@ -2645,7 +2650,9 @@ export function CatalogApp() {
onClose={() => setConfirmOpen(false)}
onConfirm={() => setConfirmOpen(false)}
/>
<ToastStack items={toasts} onDismiss={dismissToast} />
<ToastObserver onPresent={setObservedToasts}>
<ToastStack items={toasts} onDismiss={dismissToast} />
</ToastObserver>
</>
);
}
+11
View File
@@ -296,6 +296,13 @@ setup-команды, сохранение, API и права принадлеж
## SettingsCard и Switch
В `UserProfileMenu` необязательный `headerAction={{label, onSelect}}` отделяет
действие средней иконки от меню профиля. Аватар и текст профиля сохраняют меню.
`ToastObserver onPresent` сообщает приложению новые и изменённые завершённые
уведомления из вложенных `ToastStack`; хранение, даты и история принадлежат
приложению. `ToastStack observe={false}` исключает повторную регистрацию
сообщений, уже записанных сервером. Отображение и таймеры не изменяются.
`SettingsCard` фиксирует нейтральную структуру админской группы: eyebrow/title/description/actions/body. `Switch` покрывает компактное включение/видимость внутри таких групп. Данные секции, сохранение и права остаются в consumer.
Промежуточный loading-контейнер не должен обнулять вертикальный ритм тела
@@ -343,6 +350,8 @@ Reduced motion отключает анимацию. На узком экране
## ApplicationSidePanel
Перед кнопкой закрытия можно разместить действия через `headerActions`. Кнопка `UserProfileMenu.headerAction` принимает `pressed` и `controls` для связи с выдвижной панелью.
`ApplicationSidePanel` — правая application-level пара к `AdminNavigationPanel`.
Она использует ту же ширину `332–352 px`, радиус, theme-aware surface, тень и
круглые действия, но появляется справа налево. `ApplicationShell` размещает её
@@ -626,3 +635,5 @@ window kind alongside `rect/onRectCommit`. See WINDOWS_AND_LAYERS.md.
keeps the shared drag handle and activation threshold. The default stays vertical.
Для ручки поверх фотографии используйте `DragHandle surface="control"` или `SortableList handleSurface="control"`: видимый круг с общим стеклом внутри `nodedc-viewport-controls`. Bare-ручка остаётся вариантом по умолчанию для обычных строк.
Window `headerLayout="adaptive"` keeps contextual actions on one trailing row. The complete title moves below actions before clipping. The measured action width sets the minimum for all resize edges, keyboard resizing and restored layout; only an undersized device viewport allows horizontal action scrolling. `expanded` temporarily opens media at a moderate viewport-fitted size while retaining modal/floating presentation. Users can resize the expanded window; restoration returns the previous geometry without changing the regular rectangle. `expandedRect` / `onExpandedRectCommit` persist the user’s separate expanded position and dimensions; first expansion uses a moderate 960×800 ceiling within 80%/82% of the viewport.
+6 -6
View File
@@ -28,8 +28,8 @@
"version": "0.7.0",
"dependencies": {
"@nodedc/page-patterns": "0.1.0",
"@nodedc/ui-core": "0.7.3",
"@nodedc/ui-react": "0.7.8",
"@nodedc/ui-core": "0.7.4",
"@nodedc/ui-react": "0.7.10",
"cesium": "1.147.0",
"react": "^19.1.0",
"react-dom": "^19.1.0"
@@ -2516,7 +2516,7 @@
},
"packages/ui-core": {
"name": "@nodedc/ui-core",
"version": "0.7.3",
"version": "0.7.4",
"dependencies": {
"@nodedc/tokens": "0.6.0"
}
@@ -2525,17 +2525,17 @@
"name": "@nodedc/ui-dom",
"version": "0.7.0",
"dependencies": {
"@nodedc/ui-core": "0.7.3"
"@nodedc/ui-core": "0.7.4"
}
},
"packages/ui-react": {
"name": "@nodedc/ui-react",
"version": "0.7.8",
"version": "0.7.10",
"dependencies": {
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@nodedc/ui-core": "0.7.3",
"@nodedc/ui-core": "0.7.4",
"lucide-react": "^0.468.0"
},
"devDependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@nodedc/ui-core",
"version": "0.7.3",
"version": "0.7.4",
"type": "module",
"files": [
"dist",
+18 -1
View File
@@ -364,7 +364,8 @@
color: var(--nodedc-text-primary);
}
.nodedc-icon-button[aria-pressed="true"] {
.nodedc-icon-button[aria-pressed="true"],
.nodedc-header__profile .nodedc-icon-button[aria-pressed="true"] {
background: var(--nodedc-glass-control-active);
color: var(--nodedc-glass-control-active-text);
}
@@ -1632,6 +1633,8 @@ textarea.nodedc-field__control {
.nodedc-app-shell__end-panel {
right: var(--nodedc-app-page-pad);
width: var(--nodedc-app-nav-width);
transform: translateX(calc(100% + var(--nodedc-app-page-pad)));
transition: transform var(--nodedc-app-navigation-motion), visibility 0s linear 440ms;
visibility: hidden;
pointer-events: none;
}
@@ -1642,6 +1645,8 @@ textarea.nodedc-field__control {
}
.nodedc-app-shell[data-end-panel-open="true"] .nodedc-app-shell__end-panel {
transform: translateX(0);
transition-delay: 0s;
visibility: visible;
pointer-events: auto;
}
@@ -4902,3 +4907,15 @@ textarea.nodedc-field__control {
-webkit-backdrop-filter:blur(var(--nodedc-scene-glass-blur)) saturate(var(--nodedc-modal-glass-saturation));
}
.nodedc-drag-handle[data-surface="control"]:hover {background:var(--nodedc-glass-control-hover);}
/* An adaptive action row defines the minimum resizable width. */
.nodedc-window[data-header-layout="adaptive"]>.nodedc-window__head>.nodedc-window__actions{flex-wrap:nowrap;width:max-content;max-width:100%;justify-self:end;overflow-x:auto}
.nodedc-window[data-header-stacked="true"]>.nodedc-window__head{grid-template-columns:minmax(0,1fr)}
.nodedc-window[data-header-stacked="true"]>.nodedc-window__head>.nodedc-window__actions{grid-row:1}
.nodedc-window[data-header-stacked="true"]>.nodedc-window__head>.nodedc-window__titles{grid-row:2}
.nodedc-window[data-header-layout="adaptive"]>.nodedc-window__head>.nodedc-window__actions>*{flex-shrink:0}
@media (prefers-reduced-motion: reduce) {
.nodedc-app-shell__end-panel { transition: none; }
}
+1 -1
View File
@@ -20,6 +20,6 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
"@nodedc/ui-core": "0.7.3"
"@nodedc/ui-core": "0.7.4"
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@nodedc/ui-react",
"version": "0.7.8",
"version": "0.7.10",
"type": "module",
"files": [
"dist"
@@ -21,7 +21,7 @@
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@nodedc/ui-core": "0.7.3",
"@nodedc/ui-core": "0.7.4",
"lucide-react": "^0.468.0"
},
"peerDependencies": {
@@ -7,6 +7,7 @@ export interface ApplicationSidePanelProps extends Omit<HTMLAttributes<HTMLEleme
title: ReactNode;
description?: ReactNode;
closeLabel?: string;
headerActions?: ReactNode;
footer?: ReactNode;
onClose: () => void;
children: ReactNode;
@@ -23,6 +24,7 @@ export function ApplicationSidePanel({
title,
description,
closeLabel = "Закрыть панель",
headerActions,
footer,
onClose,
children,
@@ -42,6 +44,7 @@ export function ApplicationSidePanel({
{description ? <span className="nodedc-application-side-panel__description">{description}</span> : null}
</div>
<div className="nodedc-admin-panel__head-actions">
{headerActions}
<button type="button" className="nodedc-admin-panel__close" aria-label={closeLabel} onClick={onClose}>
<Icon name="close" size={16} strokeWidth={1.6} />
</button>
+23 -2
View File
@@ -1,4 +1,4 @@
import { useEffect, useRef, type HTMLAttributes } from "react";
import { createContext, useContext, useEffect, useRef, type HTMLAttributes, type ReactNode } from "react";
import { createPortal } from "react-dom";
import { cn } from "./cn.js";
import { Icon, type IconName } from "./Icon.js";
@@ -13,6 +13,13 @@ export type ToastItem = {
durationMs?: number | null;
};
const ToastObservation = createContext<((items: ToastItem[]) => void) | null>(null);
/** The application owns history/storage; this only reports terminal presentations. */
export function ToastObserver({onPresent, children}: {onPresent: (items: ToastItem[]) => void; children: ReactNode}) {
return <ToastObservation.Provider value={onPresent}>{children}</ToastObservation.Provider>;
}
const toastIcons: Record<ToastTone, IconName> = {
success: "check",
error: "alert",
@@ -69,7 +76,21 @@ function TimedToastCard({ item, onDismiss }: { item: ToastItem; onDismiss: (id:
return <ToastCard item={item} onDismiss={onDismiss} />;
}
export function ToastStack({ items, onDismiss }: { items: ToastItem[]; onDismiss: (id: string) => void }) {
export function ToastStack({ items, onDismiss, observe = true }: { items: ToastItem[]; onDismiss: (id: string) => void; observe?: boolean }) {
const observer = useContext(ToastObservation);
const presented = useRef(new Map<string, string>());
useEffect(() => {
const next = new Map<string, string>();
const fresh: ToastItem[] = [];
for (const item of items) {
if (item.tone === 'loading') continue;
const identity = JSON.stringify([item.tone, item.title, item.description]);
next.set(item.id, identity);
if (presented.current.get(item.id) !== identity) fresh.push(item);
}
presented.current = next;
if (observe && fresh.length) observer?.(fresh);
}, [items, observer, observe]);
if (typeof document === "undefined" || items.length === 0) return null;
return createPortal(
<div className="nodedc-toast-viewport nodedc-ui-root" aria-live="polite" aria-relevant="additions removals">
+12 -5
View File
@@ -24,6 +24,8 @@ export interface UserProfileMenuProps {
triggerLabel?: ReactNode;
/** Optional status glyph between the label and avatar. */
triggerIcon?: IconName;
/** Independent header action; the avatar still opens the profile menu. */
headerAction?: { label: string; pressed?: boolean; controls?: string; onSelect: () => void };
actions: readonly UserProfileMenuAction[];
}
@@ -35,6 +37,7 @@ export function UserProfileMenu({
coverImageUrl,
triggerLabel,
triggerIcon,
headerAction,
actions,
}: UserProfileMenuProps) {
const label = displayName || "NODE.DC";
@@ -51,11 +54,15 @@ export function UserProfileMenu({
</HeaderProfileButton>
<IconButton
ref={setTriggerRef}
label={`Меню пользователя ${label}`}
aria-haspopup="menu"
aria-expanded={open}
aria-controls={surfaceId}
onClick={(event) => { setTriggerRef(event.currentTarget); toggle(); }}
label={headerAction?.label ?? `Меню пользователя ${label}`}
aria-haspopup={headerAction ? undefined : "menu"}
aria-pressed={headerAction?.pressed}
aria-expanded={headerAction ? headerAction.pressed : open}
aria-controls={headerAction ? headerAction.controls : surfaceId}
onClick={(event) => {
if (headerAction) { if (open) toggle(); headerAction.onSelect(); }
else { setTriggerRef(event.currentTarget); toggle(); }
}}
><Icon name={triggerIcon ?? "inbox"} size={20} strokeWidth={1.7} /></IconButton>
<button type="button" className="nodedc-user-profile-menu__trigger" aria-label={`Профиль ${label}`} aria-haspopup="menu" aria-expanded={open} aria-controls={surfaceId}
onClick={(event) => { setTriggerRef(event.currentTarget); toggle(); }}>
+77 -13
View File
@@ -40,6 +40,13 @@ export interface WindowProps extends Omit<HTMLAttributes<HTMLDivElement>, "title
footer?: ReactNode;
/** Context actions beside close, using canonical IconButton controls. */
headerActions?: ReactNode;
/** Keep actions on one line; place title below them when space is limited. */
headerLayout?: "inline" | "adaptive";
/** Temporarily enlarge within the viewport; restoring retains prior geometry and presentation. */
expanded?: boolean;
/** Separate durable layout for expanded media, committed only after a user gesture. */
expandedRect?: WindowRect;
onExpandedRectCommit?: (rect: WindowRect) => void;
/** Keep contextual actions immediately before close when requested. */
headerActionsPlacement?: "before-move" | "before-close";
size?: WindowSize;
@@ -72,6 +79,10 @@ export function Window({
children,
footer,
headerActions,
headerLayout = "inline",
expanded = false,
expandedRect,
onExpandedRectCommit,
headerActionsPlacement = "before-move",
size = "md",
placement = "center",
@@ -99,6 +110,9 @@ export function Window({
const titleId = useId();
const descriptionId = useId();
const dialogRef = useRef<HTMLDivElement>(null);
const minimumRef = useRef({width:320,height:200});
const [headerMinimum,setHeaderMinimum]=useState(320);
const [stackedTitle,setStackedTitle]=useState(false);
const portalHostRef = useRef<Element | null>(null);
const onCloseRef = useRef(onClose);
const dragRef = useRef<{ pointerId: number; offsetX: number; offsetY: number } | null>(null);
@@ -107,13 +121,15 @@ export function Window({
const [floatingRect, setFloatingRect] = useState<WindowRect | null>(null);
const rectRef = useRef<WindowRect | null>(null);
const initialRectRef = useRef<WindowRect | null>(null);
const expansionRestoreRef = useRef<WindowRect | null>(null);
const commitRef = useRef(onRectCommit);
commitRef.current = onRectCommit;
// Temporary media expansion never replaces the application-owned window layout.
commitRef.current = expanded ? onExpandedRectCommit : onRectCommit;
const changeRect = (next: WindowRect | null) => { rectRef.current = next; setFloatingRect(next); };
const gestureChanged = useRef(false);
const resizeRef = useRef<{ pointerId: number; x: number; y: number; rect: WindowRect; edge: ResizeEdge } | null>(null);
const isFloating = (controlledFloating ?? floating) && allowFloating && placement === "center";
const freeGeometry = isFloating || (resizable && placement === "end");
const freeGeometry = expanded || isFloating || (resizable && placement === "end");
const canDrag = draggable || freeGeometry;
const shouldLockBodyScroll = !suspended && !isFloating && (lockBodyScroll ?? placement === "center");
const shouldTrapFocus = !suspended && !isFloating && (trapFocus ?? placement === "center");
@@ -121,6 +137,31 @@ export function Window({
modeRef.current = { shouldTrapFocus, isFloating, suspended };
onCloseRef.current = onClose;
useLayoutEffect(()=>{
if(!open || headerLayout!=="adaptive")return;
const dialog=dialogRef.current,head=dialog?.querySelector<HTMLElement>(".nodedc-window__head"),actions=head?.querySelector<HTMLElement>(".nodedc-window__actions"),heading=head?.querySelector<HTMLElement>(".nodedc-window__title");
if(!dialog||!head||!actions||!heading)return;
const measure=()=>{
const headStyle=window.getComputedStyle(head),input=heading.querySelector<HTMLInputElement>("input"),copyStyle=window.getComputedStyle(input??heading);
const sample=document.createElement("span");
Object.assign(sample.style,{position:"fixed",visibility:"hidden",pointerEvents:"none",whiteSpace:"pre",font:copyStyle.font,letterSpacing:copyStyle.letterSpacing});
sample.textContent=input?.value??heading.textContent??"";head.appendChild(sample);
const titleWidth=sample.getBoundingClientRect().width+(parseFloat(copyStyle.paddingLeft)||0)+(parseFloat(copyStyle.paddingRight)||0);sample.remove();
const padding=(parseFloat(headStyle.paddingLeft)||0)+(parseFloat(headStyle.paddingRight)||0),actionWidth=actions.scrollWidth;
const minimum=Math.max(320,Math.ceil(actionWidth+padding+2));
minimumRef.current={width:minimum,height:200};setHeaderMinimum(minimum);
setStackedTitle(head.clientWidth < padding+actionWidth+titleWidth+(parseFloat(headStyle.columnGap)||0)+2);
if(freeGeometry&&rectRef.current){
const fitted=fitWindow(rectRef.current,{width:window.innerWidth,height:window.innerHeight},minimumRef.current);
if(fitted.left!==rectRef.current.left||fitted.top!==rectRef.current.top||fitted.width!==rectRef.current.width||fitted.height!==rectRef.current.height){changeRect(fitted);if(!resizeRef.current&&!dragRef.current)commitRef.current?.(fitted);}
}
};
measure();
const observer=typeof ResizeObserver!=="undefined"?new ResizeObserver(measure):null;
observer?.observe(head);observer?.observe(actions);window.addEventListener("resize",measure);
return()=>{observer?.disconnect();window.removeEventListener("resize",measure);};
},[open,headerLayout,title,headerActions,freeGeometry]);
useEffect(() => {
if (!open || typeof document === "undefined") return;
const previousActiveElement = document.activeElement instanceof HTMLElement ? document.activeElement : null;
@@ -183,20 +224,39 @@ export function Window({
}, [open, shouldLockBodyScroll]);
useLayoutEffect(() => {
if (open && freeGeometry && !dragRef.current && !resizeRef.current) {
if (!open) return;
const viewport={width:window.innerWidth,height:window.innerHeight};
if(expanded){
if(!expansionRestoreRef.current){
const bounds=dialogRef.current?.getBoundingClientRect();
if(bounds){
expansionRestoreRef.current=rectRef.current??{left:bounds.left,top:bounds.top,width:bounds.width,height:bounds.height};
const width=Math.min(960,viewport.width*0.8),height=Math.min(800,viewport.height*0.82);
const prior=expansionRestoreRef.current;
changeRect(fitWindow(expandedRect??{left:prior.left+(prior.width-width)/2,top:prior.top+(prior.height-height)/2,width,height},viewport,minimumRef.current));
}
}
return;
}
if(expansionRestoreRef.current){
changeRect(fitWindow(expansionRestoreRef.current,viewport,minimumRef.current));
expansionRestoreRef.current=null;
return;
}
if (freeGeometry && !dragRef.current && !resizeRef.current) {
// The modal move toggle already restores its local rectangle. An
// uncontrolled floating window must retain it when toggled twice.
if (placement === "center" && !onRectCommit && !rect && rectRef.current) return;
const bounds=dialogRef.current?.getBoundingClientRect();
if(bounds){
initialRectRef.current ??= initialRect??{left:bounds.left,top:bounds.top,width:bounds.width,height:bounds.height};
changeRect(fitWindow(rect??initialRectRef.current,{width:window.innerWidth,height:window.innerHeight}));
changeRect(fitWindow(rect??initialRectRef.current,{width:window.innerWidth,height:window.innerHeight},minimumRef.current));
}
}
},[open,freeGeometry,rect?.left,rect?.top,rect?.width,rect?.height]);
},[open,expanded,freeGeometry,rect?.left,rect?.top,rect?.width,rect?.height]);
useEffect(() => {
if (!open) { setDragPosition(null); setFloating(false); changeRect(null); initialRectRef.current = null; dragRef.current = null; resizeRef.current = null; }
if (!open) { setDragPosition(null); setFloating(false); changeRect(null); initialRectRef.current = null; expansionRestoreRef.current = null; dragRef.current = null; resizeRef.current = null; }
}, [open]);
useEffect(() => {
@@ -205,7 +265,7 @@ export function Window({
const resizing = resizeRef.current;
if (resizing && event.pointerId === resizing.pointerId) {
gestureChanged.current = true;
changeRect(resizeWindow(resizing.rect, resizing.edge, event.clientX - resizing.x, event.clientY - resizing.y, { width: window.innerWidth, height: window.innerHeight }));
changeRect(resizeWindow(resizing.rect, resizing.edge, event.clientX - resizing.x, event.clientY - resizing.y, { width: window.innerWidth, height: window.innerHeight },minimumRef.current));
return;
}
const drag = dragRef.current;
@@ -214,7 +274,7 @@ export function Window({
const bounds = dialog.getBoundingClientRect();
if (freeGeometry) {
gestureChanged.current = true;
changeRect(fitWindow({ left: event.clientX - drag.offsetX, top: event.clientY - drag.offsetY, width: bounds.width, height: bounds.height }, { width: window.innerWidth, height: window.innerHeight }));
changeRect(fitWindow({ left: event.clientX - drag.offsetX, top: event.clientY - drag.offsetY, width: bounds.width, height: bounds.height }, { width: window.innerWidth, height: window.innerHeight },minimumRef.current));
return;
}
const left = Math.max(8, Math.min(window.innerWidth - bounds.width - 8, event.clientX - drag.offsetX));
@@ -239,10 +299,10 @@ export function Window({
useEffect(() => {
if (!freeGeometry || !open) return;
const fit = () => { if(rectRef.current) changeRect(fitWindow(rect ?? rectRef.current, { width: window.innerWidth, height: window.innerHeight })); };
const fit = () => { if(rectRef.current) changeRect(fitWindow((expanded ? expandedRect : rect) ?? rectRef.current, { width: window.innerWidth, height: window.innerHeight },minimumRef.current)); };
window.addEventListener("resize", fit);
return () => window.removeEventListener("resize", fit);
}, [freeGeometry, open, rect]);
}, [freeGeometry, open, rect, expanded, expandedRect]);
if (!open || typeof document === "undefined") return null;
@@ -258,12 +318,16 @@ export function Window({
if (!portalHostRef.current || !fullscreen || !dialogRef.current?.contains(fullscreen)) {
portalHostRef.current = fullscreen ?? document.body;
}
const baseStyle={...style,...(headerLayout==="adaptive"?{minWidth:Math.min(headerMinimum,Math.max(1,window.innerWidth-16))}:{})};
return createPortal(
<LoadingContext.Provider value={null}><InspectorSelectPolicyContext.Provider value={false}>
<WindowSuspensionContext.Provider value={suspend}><div className="nodedc-overlay nodedc-ui-root" style={suspended ? {display:"none"} : undefined} data-placement={placement} data-floating={isFloating || undefined} onPointerDown={handleBackdropPointerDown}>
<div
ref={dialogRef}
className={cn("nodedc-window nodedc-glass-material nodedc-material-rim", className)}
data-expanded={expanded||undefined}
data-header-layout={headerLayout}
data-header-stacked={stackedTitle||undefined}
data-material="glass-v4"
data-glass-context={isFloating ? "scene" : undefined}
data-size={size === "md" ? undefined : size}
@@ -276,7 +340,7 @@ export function Window({
aria-labelledby={titleId}
aria-describedby={subtitle ? descriptionId : undefined}
tabIndex={-1}
style={freeGeometry && floatingRect ? { ...style, position: "fixed", ...floatingRect, right: "auto", bottom: "auto", maxWidth: "none", maxHeight: "none" } : dragPosition ? { ...style, position: "fixed", left: dragPosition.left, top: dragPosition.top, right: "auto", bottom: "auto" } : style}
style={freeGeometry && floatingRect ? { ...baseStyle, position: "fixed", ...floatingRect, right: "auto", bottom: "auto", maxWidth: "none", maxHeight: "none" } : dragPosition ? { ...baseStyle, position: "fixed", left: dragPosition.left, top: dragPosition.top, right: "auto", bottom: "auto" } : baseStyle}
{...props}
>
<header
@@ -290,7 +354,7 @@ export function Window({
const dx = event.key === "ArrowLeft" ? -10 : event.key === "ArrowRight" ? 10 : 0;
const dy = event.key === "ArrowUp" ? -10 : event.key === "ArrowDown" ? 10 : 0;
const bounds = { width: window.innerWidth, height: window.innerHeight };
const next = event.shiftKey ? resizeWindow(floatingRect, "se", dx, dy, bounds) : fitWindow({ ...floatingRect, left: floatingRect.left + dx, top: floatingRect.top + dy }, bounds);
const next = event.shiftKey ? resizeWindow(floatingRect, "se", dx, dy, bounds,minimumRef.current) : fitWindow({ ...floatingRect, left: floatingRect.left + dx, top: floatingRect.top + dy }, bounds,minimumRef.current);
changeRect(next); commitRef.current?.(next);
}}
onPointerDown={(event) => {
@@ -313,7 +377,7 @@ export function Window({
dragRef.current = null; resizeRef.current = null;
if (!isFloating) {
const rect = dialogRef.current?.getBoundingClientRect();
if (rect) changeRect(fitWindow(rectRef.current ?? { left: rect.left, top: rect.top, width: rect.width, height: rect.height }, { width: window.innerWidth, height: window.innerHeight }));
if (rect) changeRect(fitWindow(rectRef.current ?? { left: rect.left, top: rect.top, width: rect.width, height: rect.height }, { width: window.innerWidth, height: window.innerHeight },minimumRef.current));
}
if (rectRef.current) commitRef.current?.({...rectRef.current});
setFloating(!isFloating);
+10 -5
View File
@@ -473,7 +473,8 @@
"Enforced operational typography: independent md/13px base for UI roots and portals; section/value text md, Description/status/error copy sm/12px, only canonical page/window titles use title/18px. Shared build-time typography contract and catalog example prevent browser-default size regressions.",
"Drag headers never draw perimeter outlines or inherit keyboard-focus fill on pointer grab. Keyboard focus remains visible through the canonical surface; arrows, Shift+arrows and docking shortcuts remain available.",
"Detached center windows automatically use scene Glass V4; fixed confirmations opt out of detachment with allowFloating=false. Unsaved profile confirmation is owned by the application.",
"floating/onFloatingChange and rect/onRectCommit allow durable application-owned presentation by window kind, independent of the currently displayed entity. Reopening restores mode and fitted geometry. Fixed confirmations do not inherit this state."
"floating/onFloatingChange and rect/onRectCommit allow durable application-owned presentation by window kind, independent of the currently displayed entity. Reopening restores mode and fitted geometry. Fixed confirmations do not inherit this state.",
"Adaptive headers keep actions on one row, place the full title below before clipping, and derive the resize minimum from actual actions. Expanded media opens at a moderate size and remains resizable. Separate expandedRect/onExpandedRectCommit preferences restore its user-chosen position and dimensions; returning restores regular geometry."
]
},
{
@@ -707,6 +708,7 @@
"behavior": [
"portal dropdown",
"profile identity card",
"optional pressed state and controlled region on independent header action; its selected circle and glyph use the active IconButton colors, including on hover",
"theme-independent cover",
"action links and callbacks",
"outside pointer and Escape close",
@@ -716,7 +718,8 @@
"The component owns menu geometry and profile presentation; the application owns settings, profile and logout actions.",
"Use the existing Dropdown engine so the menu is never clipped by the fixed application header.",
"Do not embed product permissions or sharing rules in the visual menu.",
"The default header composes HeaderProfileButton, an independent menu IconButton and HeaderAvatar using the existing header geometry. Application settings belong inside this menu; do not add an adjacent settings button or another HeaderProfile wrapper."
"The default header composes HeaderProfileButton, an independent menu IconButton and HeaderAvatar using the existing header geometry. Application settings belong inside this menu; do not add an adjacent settings button or another HeaderProfile wrapper.",
"Optional headerAction separates the middle icon action from the avatar/profile trigger; without it legacy behavior is preserved."
]
},
{
@@ -907,7 +910,7 @@
"nodedc-application-side-panel",
"nodedc-app-shell__end-panel"
],
"summary": "Theme-aware trailing application panel paired with AdminNavigationPanel and hosted in a separate ApplicationShell end column.",
"summary": "Theme-aware trailing application panel with optional header actions before close, hosted in a separate ApplicationShell end column.",
"anatomy": [
"eyebrow and title",
"optional description",
@@ -1012,7 +1015,8 @@
"ToastCard",
"ToastStack",
"ToastItem",
"ToastTone"
"ToastTone",
"ToastObserver"
],
"domContract": [
"nodedc-toast-viewport",
@@ -1040,7 +1044,8 @@
"Errors and status copy use the compact Toast typography; consumers do not substitute browser-default paragraphs or title-sized text.",
"Adding or updating another notification never restarts the lifetime of an existing item; each item owns its timer by stable id.",
"Loading notifications remain until the operation updates or dismisses them.",
"Status notifications never replace a blocking confirmation modal."
"Status notifications never replace a blocking confirmation modal.",
"ToastObserver reports new or changed terminal presentations to the consumer; storage and history belong to the application. Set observe=false for server-originated items already recorded in history."
]
},
{