diff --git a/apps/catalog/package.json b/apps/catalog/package.json index bcbd885..9e4f7dc 100644 --- a/apps/catalog/package.json +++ b/apps/catalog/package.json @@ -12,7 +12,7 @@ "dependencies": { "@nodedc/page-patterns": "0.1.0", "@nodedc/ui-core": "0.7.4", - "@nodedc/ui-react": "0.7.9", + "@nodedc/ui-react": "0.7.10", "cesium": "1.147.0", "react": "^19.1.0", "react-dom": "^19.1.0" diff --git a/docs/COMPONENTS.md b/docs/COMPONENTS.md index 65da06c..96f8b0c 100644 --- a/docs/COMPONENTS.md +++ b/docs/COMPONENTS.md @@ -627,4 +627,4 @@ keeps the shared drag handle and activation threshold. The default stays vertica Для ручки поверх фотографии используйте `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 fits the window to the available viewport while retaining modal/floating presentation. Users can resize the expanded window; restoration returns the previous geometry without persisting the temporary rectangle. +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. diff --git a/package-lock.json b/package-lock.json index 7cb378f..e2ff398 100644 --- a/package-lock.json +++ b/package-lock.json @@ -29,7 +29,7 @@ "dependencies": { "@nodedc/page-patterns": "0.1.0", "@nodedc/ui-core": "0.7.4", - "@nodedc/ui-react": "0.7.9", + "@nodedc/ui-react": "0.7.10", "cesium": "1.147.0", "react": "^19.1.0", "react-dom": "^19.1.0" @@ -2530,7 +2530,7 @@ }, "packages/ui-react": { "name": "@nodedc/ui-react", - "version": "0.7.9", + "version": "0.7.10", "dependencies": { "@dnd-kit/core": "^6.3.1", "@dnd-kit/sortable": "^10.0.0", diff --git a/packages/ui-react/package.json b/packages/ui-react/package.json index 79f66b1..47efb8e 100644 --- a/packages/ui-react/package.json +++ b/packages/ui-react/package.json @@ -1,6 +1,6 @@ { "name": "@nodedc/ui-react", - "version": "0.7.9", + "version": "0.7.10", "type": "module", "files": [ "dist" diff --git a/packages/ui-react/src/Window.tsx b/packages/ui-react/src/Window.tsx index 6b9dc19..9e8f0d4 100644 --- a/packages/ui-react/src/Window.tsx +++ b/packages/ui-react/src/Window.tsx @@ -44,6 +44,9 @@ export interface WindowProps extends Omit, "title 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; @@ -78,6 +81,8 @@ export function Window({ headerActions, headerLayout = "inline", expanded = false, + expandedRect, + onExpandedRectCommit, headerActionsPlacement = "before-move", size = "md", placement = "center", @@ -119,7 +124,7 @@ export function Window({ const expansionRestoreRef = useRef(null); const commitRef = useRef(onRectCommit); // Temporary media expansion never replaces the application-owned window layout. - commitRef.current = expanded ? undefined : onRectCommit; + 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); @@ -226,7 +231,9 @@ export function Window({ const bounds=dialogRef.current?.getBoundingClientRect(); if(bounds){ expansionRestoreRef.current=rectRef.current??{left:bounds.left,top:bounds.top,width:bounds.width,height:bounds.height}; - changeRect(fitWindow({left:16,top:16,width:viewport.width-32,height:viewport.height-32},viewport,minimumRef.current)); + 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; @@ -292,10 +299,10 @@ export function Window({ useEffect(() => { if (!freeGeometry || !open) return; - const fit = () => { if(rectRef.current) changeRect(fitWindow((expanded ? null : rect) ?? rectRef.current, { width: window.innerWidth, height: window.innerHeight },minimumRef.current)); }; + 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, expanded]); + }, [freeGeometry, open, rect, expanded, expandedRect]); if (!open || typeof document === "undefined") return null; diff --git a/registry/components.json b/registry/components.json index fba44a4..caea51a 100644 --- a/registry/components.json +++ b/registry/components.json @@ -474,7 +474,7 @@ "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.", - "Adaptive headers keep actions on one row, place the full title below before clipping, and derive the resize minimum from actual actions. Expanded media fits the viewport temporarily, remains resizable and restores the previous rectangle without overwriting durable geometry." + "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." ] }, {