feat(ui): add measured level buttons and suspend modal hosts during scene editing
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
|||||||
ComparisonTable,
|
ComparisonTable,
|
||||||
StatusBadge,
|
StatusBadge,
|
||||||
ProgressBar,
|
ProgressBar,
|
||||||
|
LevelButton,
|
||||||
ProgressButton,
|
ProgressButton,
|
||||||
LayerStackIndicator,
|
LayerStackIndicator,
|
||||||
AdminNavigationPanel,
|
AdminNavigationPanel,
|
||||||
@@ -245,6 +246,7 @@ const iconGroups: Array<{ title: string; note: string; icons: IconName[] }> = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const iconLabels: Record<IconName, string> = {
|
const iconLabels: Record<IconName, string> = {
|
||||||
|
power: "Питание",
|
||||||
move: "Свободное окно",
|
move: "Свободное окно",
|
||||||
"add-point":"Добавить точку",orthographic:"Ортографическая проекция",perspective:"Перспективная проекция",select:"Выделение",pen:"Перо",rectangle:"Прямоугольник",curve:"Кривая",undo:"Отменить",redo:"Повторить",
|
"add-point":"Добавить точку",orthographic:"Ортографическая проекция",perspective:"Перспективная проекция",select:"Выделение",pen:"Перо",rectangle:"Прямоугольник",curve:"Кривая",undo:"Отменить",redo:"Повторить",
|
||||||
activity: "Активность",
|
activity: "Активность",
|
||||||
@@ -1500,6 +1502,13 @@ export function CatalogApp() {
|
|||||||
<SegmentedControl selectionMode="multiple" label="Слои сцены" value={previewLayers} onChange={setPreviewLayers}
|
<SegmentedControl selectionMode="multiple" label="Слои сцены" value={previewLayers} onChange={setPreviewLayers}
|
||||||
items={[{value:"source",label:"Источник"},{value:"geometry",label:"Геометрия"},{value:"unavailable",label:"Недоступно",disabled:true}]} />
|
items={[{value:"source",label:"Источник"},{value:"geometry",label:"Геометрия"},{value:"unavailable",label:"Недоступно",disabled:true}]} />
|
||||||
</Preview>
|
</Preview>
|
||||||
|
<Preview title="Уровень ресурса" note="измерение / последние данные / неизвестно">
|
||||||
|
<LevelButton label="Заряд аккумулятора" value={.82} levelTone="success" onClick={()=>setProjectName("Аккумулятор · 82%")}/>
|
||||||
|
<LevelButton label="Заряд аккумулятора" value={.17} levelTone="warning" freshness="stale"/>
|
||||||
|
<LevelButton label="Заряд аккумулятора" value={null} freshness="unknown" disabled/>
|
||||||
|
<LevelButton label="Белая заливка" value={.82} fillColor="#ffffff"/>
|
||||||
|
<LevelButton label="Чёрная заливка" value={.82} fillColor="#000000"/>
|
||||||
|
</Preview>
|
||||||
<Preview title="Линейный прогресс" note="измеренный / неизвестный / завершённый">
|
<Preview title="Линейный прогресс" note="измеренный / неизвестный / завершённый">
|
||||||
<ProgressBar label="Подготовка" value={0.6} valueText="Три этапа из пяти" />
|
<ProgressBar label="Подготовка" value={0.6} valueText="Три этапа из пяти" />
|
||||||
<ProgressBar label="Получение сведений" />
|
<ProgressBar label="Получение сведений" />
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import {useState} from 'react';
|
import {useState} from 'react';
|
||||||
import {Button,Description,EditorDockLayout,EditorWorkspace,type EditorDockState} from '@nodedc/ui-react';
|
import {Button,Window,Description,EditorDockLayout,EditorWorkspace,type EditorDockState} from '@nodedc/ui-react';
|
||||||
export function EditorDockExample(){
|
export function EditorDockExample({inWindow=false}:{inWindow?:boolean}){
|
||||||
|
const [modal,setModal]=useState(false);
|
||||||
const [editing,setEditing]=useState(false),[open,setOpen]=useState({objects:true,materials:true});
|
const [editing,setEditing]=useState(false),[open,setOpen]=useState({objects:true,materials:true});
|
||||||
const [layout,setLayout]=useState<EditorDockState>({tree:{axis:'y',ratio:70,first:{axis:'x',ratio:25,first:{id:'objects'},second:{id:'viewport'}},second:{id:'materials'}},floating:{}});
|
const [layout,setLayout]=useState<EditorDockState>({tree:{axis:'y',ratio:70,first:{axis:'x',ratio:25,first:{id:'objects'},second:{id:'viewport'}},second:{id:'materials'}},floating:{}});
|
||||||
return <><Button onClick={()=>{setOpen({objects:true,materials:true});setEditing(true);}}>Открыть редактор сцены</Button><div style={{height:480}}>
|
return <>{!inWindow&&<><Button onClick={()=>setModal(true)}>Сцена в модальном окне</Button><Window open={modal} title="Просмотр сцены" onClose={()=>setModal(false)}><EditorDockExample inWindow/></Window></>}<Button onClick={()=>{setOpen({objects:true,materials:true});setEditing(true);}}>Открыть редактор сцены</Button><div style={{height:480}}>
|
||||||
<EditorWorkspace editing={editing} title="Редактор сцены" subtitle="Общая оконная система" onBack={()=>setEditing(false)}>
|
<EditorWorkspace editing={editing} title="Редактор сцены" subtitle="Общая оконная система" onBack={()=>setEditing(false)}>
|
||||||
<EditorDockLayout value={layout} onChange={setLayout} enabled={editing} primary={<div style={{display:'grid',height:'100%',placeContent:'center'}}><Description>Закреплённая сцена</Description><Button onClick={()=>setOpen({objects:true,materials:true})}>Показать инструменты</Button></div>}
|
<EditorDockLayout value={layout} onChange={setLayout} enabled={editing} primary={<div style={{display:'grid',height:'100%',placeContent:'center'}}><Description>Закреплённая сцена</Description><Button onClick={()=>setOpen({objects:true,materials:true})}>Показать инструменты</Button></div>}
|
||||||
tools={[{id:'objects',title:'Объекты',label:'Объекты',open:open.objects,onClose:()=>setOpen(v=>({...v,objects:false})),content:<Description>Сцена → Модель → Детали</Description>},
|
tools={[{id:'objects',title:'Объекты',label:'Объекты',open:open.objects,onClose:()=>setOpen(v=>({...v,objects:false})),content:<Description>Сцена → Модель → Детали</Description>},
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
# LevelButton
|
||||||
|
|
||||||
|
Measured resource level inside the standard pill Button. Initial consumer: Mission
|
||||||
|
Core battery state in the observatory header. Width is 2.5 canonical controls;
|
||||||
|
height, focus, keyboard, disabled and hover grammar remain Button-owned.
|
||||||
|
|
||||||
|
`value` is a fraction in [0,1]; unknown/NaN has no fill and displays an em dash.
|
||||||
|
`valueText` supplies the visible value; `label` names the resource. `freshness`
|
||||||
|
is live, stale or unknown. Stale retains the reading, neutralises fill and adds
|
||||||
|
accessible last-reading text. No animation, no fabricated progress, no nested
|
||||||
|
interactive elements. `levelTone` uses semantic tokens, never a local palette.
|
||||||
|
|
||||||
|
Click opens domain details supplied by the consumer. The consumer decides which
|
||||||
|
physical resource is selected; it must not average unrelated batteries or treat
|
||||||
|
a stale number as fresh. Catalog includes normal, stale and unavailable states.
|
||||||
|
|
||||||
|
An explicit operator-selected `fillColor` (#RRGGBB) overrides semantic tint.
|
||||||
|
The measured fraction clips a solid fill and a second, aria-hidden copy of its
|
||||||
|
label. WCAG luminance chooses black/white text independently over the filled
|
||||||
|
part, while the unfilled part keeps the normal theme text. Unknown has no fill;
|
||||||
|
stale retains the chosen colour and its accessible stale label. Colour-range
|
||||||
|
configuration belongs to the domain profile, not the visual component.
|
||||||
@@ -151,3 +151,8 @@ Turning the free mode off returns the same contents to the normal centered size
|
|||||||
Drag a tool header to any of four outer edges to create a full-side area; drop over another tool to split beside it. Drop in the primary center to detach. An exact destination preview is shown only during placement. A 24 px outer zone wins over panel targets; broader magnets reach 160 px horizontally / 96 px vertically, capped at 16% of the workspace. The center of a tool chooses its nearest side, never swaps it with the primary. Split minima protect content; small viewports scroll the bounded layout. Invisible floating edges resize, and only the cursor changes.
|
Drag a tool header to any of four outer edges to create a full-side area; drop over another tool to split beside it. Drop in the primary center to detach. An exact destination preview is shown only during placement. A 24 px outer zone wins over panel targets; broader magnets reach 160 px horizontally / 96 px vertically, capped at 16% of the workspace. The center of a tool chooses its nearest side, never swaps it with the primary. Split minima protect content; small viewports scroll the bounded layout. Invisible floating edges resize, and only the cursor changes.
|
||||||
|
|
||||||
Header Enter/Space begins keyboard docking, arrows choose an edge, Shift+arrows choose the whole workspace, Tab selects a tool, Home selects floating, Enter commits and Escape cancels. Floating headers also accept arrows to move and Shift+arrows to resize. Pointer cancellation and Escape restore the uncommitted layout. Automatic viewport fitting does not overwrite stored rectangles. The living catalog includes the same workspace with a fixed scene, outliner and material palette.
|
Header Enter/Space begins keyboard docking, arrows choose an edge, Shift+arrows choose the whole workspace, Tab selects a tool, Home selects floating, Enter commits and Escape cancels. Floating headers also accept arrows to move and Shift+arrows to resize. Pointer cancellation and Escape restore the uncommitted layout. Automatic viewport fitting does not overwrite stored rectangles. The living catalog includes the same workspace with a fixed scene, outliner and material palette.
|
||||||
|
|
||||||
|
When an EditorWorkspace detaches from a Window, the owning overlay is suspended
|
||||||
|
without unmounting its children. Its backdrop and focus trap are inactive until
|
||||||
|
the editor returns. Escape/Tab belong to the focused dialog, so nested settings
|
||||||
|
close without also closing the battery/detail window.
|
||||||
|
|||||||
@@ -4662,3 +4662,14 @@ textarea.nodedc-field__control {
|
|||||||
.nodedc-scene-annotation[aria-pressed="true"] { box-shadow:var(--nodedc-glass-control-shadow); }
|
.nodedc-scene-annotation[aria-pressed="true"] { box-shadow:var(--nodedc-glass-control-shadow); }
|
||||||
|
|
||||||
.nodedc-scene-annotation.nodedc-button[hidden] { display:none; }
|
.nodedc-scene-annotation.nodedc-button[hidden] { display:none; }
|
||||||
|
|
||||||
|
/* A measured resource capsule; its containing row never owns a surface. */
|
||||||
|
.nodedc-level-button.nodedc-button{min-width:calc(var(--nodedc-control-height) * 2.5);font-variant-numeric:tabular-nums;--nodedc-level-color:var(--nodedc-text-secondary)}
|
||||||
|
.nodedc-level-button[data-level-tone="success"]{--nodedc-level-color:rgb(var(--nodedc-success-rgb))}
|
||||||
|
.nodedc-level-button[data-level-tone="warning"]{--nodedc-level-color:rgb(var(--nodedc-warning-rgb))}
|
||||||
|
.nodedc-level-button[data-level-tone="danger"]{--nodedc-level-color:rgb(var(--nodedc-danger-rgb))}
|
||||||
|
.nodedc-level-button[data-freshness="stale"],.nodedc-level-button[data-freshness="unknown"]{--nodedc-level-color:var(--nodedc-text-secondary)}
|
||||||
|
.nodedc-level-button.nodedc-button,.nodedc-level-button.nodedc-button:hover{background-image:linear-gradient(90deg,color-mix(in srgb,var(--nodedc-level-color) 26%,transparent) var(--nodedc-level-percent),transparent var(--nodedc-level-percent))}
|
||||||
|
|
||||||
|
.nodedc-level-button[data-custom-fill].nodedc-button{position:relative;overflow:hidden;background-image:none}
|
||||||
|
.nodedc-level-button__fill{position:absolute;inset:0;display:grid;place-items:center;pointer-events:none;background:var(--nodedc-level-custom);color:var(--nodedc-level-ink);clip-path:inset(0 calc(100% - var(--nodedc-level-percent)) 0 0)}
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
import {useEffect,useId,useLayoutEffect,useRef,useState,type ReactNode} from 'react';
|
import {useContext,useEffect,useId,useLayoutEffect,useRef,useState,type ReactNode} from 'react';
|
||||||
import {createPortal} from 'react-dom';
|
import {createPortal} from 'react-dom';
|
||||||
import {IconButton} from './Button.js';
|
import {IconButton} from './Button.js';
|
||||||
import {Icon} from './Icon.js';
|
import {Icon} from './Icon.js';
|
||||||
|
import {WindowSuspensionContext} from './WindowSuspensionContext.js';
|
||||||
import {cn} from './cn.js';
|
import {cn} from './cn.js';
|
||||||
|
|
||||||
export interface EditorWorkspaceProps {editing:boolean;title:ReactNode;subtitle?:ReactNode;onBack:()=>void;children:ReactNode;className?:string}
|
export interface EditorWorkspaceProps {editing:boolean;title:ReactNode;subtitle?:ReactNode;onBack:()=>void;children:ReactNode;className?:string}
|
||||||
/** One mounted renderer moves between its original slot and a modeless editor window. */
|
/** One mounted renderer moves between its original slot and a modeless editor window. */
|
||||||
export function EditorWorkspace({editing,title,subtitle,onBack,children,className}:EditorWorkspaceProps){
|
export function EditorWorkspace({editing,title,subtitle,onBack,children,className}:EditorWorkspaceProps){
|
||||||
|
const suspend=useContext(WindowSuspensionContext);
|
||||||
|
useLayoutEffect(()=>{if(editing)return suspend?.();},[editing,suspend]);
|
||||||
const inline=useRef<HTMLDivElement>(null),[host]=useState(()=>document.createElement('div'));
|
const inline=useRef<HTMLDivElement>(null),[host]=useState(()=>document.createElement('div'));
|
||||||
const [expanded,setExpanded]=useState(false),opener=useRef<HTMLElement|null>(null),titleId=useId();
|
const [expanded,setExpanded]=useState(false),opener=useRef<HTMLElement|null>(null),titleId=useId();
|
||||||
useLayoutEffect(()=>{host.className='nodedc-editor-workspace__host';inline.current!.append(host);return()=>host.remove();},[host]);
|
useLayoutEffect(()=>{host.className='nodedc-editor-workspace__host';inline.current!.append(host);return()=>host.remove();},[host]);
|
||||||
@@ -16,7 +19,7 @@ export function EditorWorkspace({editing,title,subtitle,onBack,children,classNam
|
|||||||
if(host.parentElement!==target){if(target.moveBefore&&host.isConnected)target.moveBefore(host,null);else target.append(host);}
|
if(host.parentElement!==target){if(target.moveBefore&&host.isConnected)target.moveBefore(host,null);else target.append(host);}
|
||||||
host.dataset.editing=String(editing);
|
host.dataset.editing=String(editing);
|
||||||
if(editing)host.querySelector<HTMLElement>('[data-editor-back]')?.focus({preventScroll:true});
|
if(editing)host.querySelector<HTMLElement>('[data-editor-back]')?.focus({preventScroll:true});
|
||||||
else {setExpanded(false);if(opener.current?.isConnected)opener.current.focus({preventScroll:true});}
|
else {setExpanded(false);const frame=requestAnimationFrame(()=>{if(opener.current?.isConnected)opener.current.focus({preventScroll:true});});return()=>cancelAnimationFrame(frame);}
|
||||||
},[editing,host]);
|
},[editing,host]);
|
||||||
useEffect(()=>{host.dataset.expanded=String(expanded);},[expanded,host]);
|
useEffect(()=>{host.dataset.expanded=String(expanded);},[expanded,host]);
|
||||||
return <div ref={inline} className={cn('nodedc-editor-workspace__slot',className)}>{createPortal(
|
return <div ref={inline} className={cn('nodedc-editor-workspace__slot',className)}>{createPortal(
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import type {CSSProperties} from 'react';
|
||||||
|
import {Button,type ButtonProps} from './Button.js';
|
||||||
|
import {cn} from './cn.js';
|
||||||
|
|
||||||
|
export interface LevelButtonProps extends Omit<ButtonProps,'children'|'shape'|'value'> {
|
||||||
|
label:string;
|
||||||
|
/** Measured fraction. Missing is unknown, never zero or animated progress. */
|
||||||
|
value?:number|null;
|
||||||
|
valueText?:string;
|
||||||
|
freshness?:'live'|'stale'|'unknown';
|
||||||
|
levelTone?:'neutral'|'success'|'warning'|'danger';
|
||||||
|
/** Explicit operator-selected fill; labels retain contrast over both parts. */
|
||||||
|
fillColor?:string;
|
||||||
|
}
|
||||||
|
/** Compact measured resource level which opens details, with native button semantics. */
|
||||||
|
export function LevelButton({label,value,valueText,freshness='live',levelTone='neutral',fillColor,className,style,...props}:LevelButtonProps){
|
||||||
|
const fraction=typeof value==='number'&&Number.isFinite(value)?Math.max(0,Math.min(1,value)):null;
|
||||||
|
const custom=typeof fillColor==='string'&&/^#[0-9a-f]{6}$/i.test(fillColor)?fillColor:null;
|
||||||
|
const channels=custom?.slice(1).match(/../g)?.map(v=>{const c=parseInt(v,16)/255;return c<=.04045?c/12.92:((c+.055)/1.055)**2.4;});
|
||||||
|
const ink=channels&&(.2126*channels[0]+.7152*channels[1]+.0722*channels[2])>.179?'#000000':'#ffffff';
|
||||||
|
const text=valueText??(fraction===null?'—':`${Math.round(fraction*100)}%`);
|
||||||
|
return <Button {...props} shape="pill" className={cn('nodedc-level-button',className)}
|
||||||
|
aria-label={`${label}: ${text}${freshness==='stale'?' · последние показания':''}`}
|
||||||
|
data-level-tone={levelTone} data-freshness={freshness} data-custom-fill={custom?true:undefined}
|
||||||
|
style={{...style,'--nodedc-level-percent':`${(fraction??0)*100}%`,...(custom?{'--nodedc-level-custom':custom,'--nodedc-level-ink':ink}:{})} as CSSProperties}><span aria-hidden="true">{text}</span>{custom&&fraction!==null&&<span aria-hidden="true" className="nodedc-level-button__fill">{text}</span>}</Button>;
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
|
useCallback,
|
||||||
useEffect,
|
useEffect,
|
||||||
useId,
|
useId,
|
||||||
useLayoutEffect,
|
useLayoutEffect,
|
||||||
@@ -11,6 +12,7 @@ import {
|
|||||||
import { createPortal } from "react-dom";
|
import { createPortal } from "react-dom";
|
||||||
import { InspectorSelectPolicyContext } from "./InspectorContext.js";
|
import { InspectorSelectPolicyContext } from "./InspectorContext.js";
|
||||||
import { LoadingContext } from "./LoadingContext.js";
|
import { LoadingContext } from "./LoadingContext.js";
|
||||||
|
import { WindowSuspensionContext } from "./WindowSuspensionContext.js";
|
||||||
import { cn } from "./cn.js";
|
import { cn } from "./cn.js";
|
||||||
import { Icon } from "./Icon.js";
|
import { Icon } from "./Icon.js";
|
||||||
import { IconButton } from "./Button.js";
|
import { IconButton } from "./Button.js";
|
||||||
@@ -82,6 +84,9 @@ export function Window({
|
|||||||
style,
|
style,
|
||||||
...props
|
...props
|
||||||
}: WindowProps) {
|
}: WindowProps) {
|
||||||
|
const [suspensions, setSuspensions] = useState(0);
|
||||||
|
const suspend = useCallback(() => {setSuspensions(value => value + 1); return () => setSuspensions(value => Math.max(0, value - 1));}, []);
|
||||||
|
const suspended = suspensions > 0;
|
||||||
const titleId = useId();
|
const titleId = useId();
|
||||||
const descriptionId = useId();
|
const descriptionId = useId();
|
||||||
const dialogRef = useRef<HTMLDivElement>(null);
|
const dialogRef = useRef<HTMLDivElement>(null);
|
||||||
@@ -100,10 +105,10 @@ export function Window({
|
|||||||
const isFloating = floating && allowFloating && placement === "center";
|
const isFloating = floating && allowFloating && placement === "center";
|
||||||
const freeGeometry = isFloating || (resizable && placement === "end");
|
const freeGeometry = isFloating || (resizable && placement === "end");
|
||||||
const canDrag = draggable || freeGeometry;
|
const canDrag = draggable || freeGeometry;
|
||||||
const shouldLockBodyScroll = !isFloating && (lockBodyScroll ?? placement === "center");
|
const shouldLockBodyScroll = !suspended && !isFloating && (lockBodyScroll ?? placement === "center");
|
||||||
const shouldTrapFocus = !isFloating && (trapFocus ?? placement === "center");
|
const shouldTrapFocus = !suspended && !isFloating && (trapFocus ?? placement === "center");
|
||||||
const modeRef = useRef({ shouldTrapFocus, isFloating });
|
const modeRef = useRef({ shouldTrapFocus, isFloating, suspended });
|
||||||
modeRef.current = { shouldTrapFocus, isFloating };
|
modeRef.current = { shouldTrapFocus, isFloating, suspended };
|
||||||
onCloseRef.current = onClose;
|
onCloseRef.current = onClose;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -116,7 +121,15 @@ export function Window({
|
|||||||
});
|
});
|
||||||
|
|
||||||
const handleKeyDown = (event: KeyboardEvent) => {
|
const handleKeyDown = (event: KeyboardEvent) => {
|
||||||
if (event.defaultPrevented) return;
|
if (event.defaultPrevented || modeRef.current.suspended) return;
|
||||||
|
// Portalled child dialogs own their Escape/Tab keys. A parent listener
|
||||||
|
// can run first, so event.defaultPrevented alone cannot guard nesting.
|
||||||
|
const focusedDialog = document.activeElement?.closest('[role="dialog"]');
|
||||||
|
if (focusedDialog && focusedDialog !== dialogRef.current) return;
|
||||||
|
if (!focusedDialog) {
|
||||||
|
const topModal = Array.from(document.querySelectorAll<HTMLElement>('[role="dialog"][aria-modal="true"]')).filter(dialog => dialog.getClientRects().length > 0).at(-1);
|
||||||
|
if (topModal && topModal !== dialogRef.current) return;
|
||||||
|
}
|
||||||
if (event.key === "Escape" && closeOnEscape && (!modeRef.current.isFloating || dialogRef.current?.contains(document.activeElement))) {
|
if (event.key === "Escape" && closeOnEscape && (!modeRef.current.isFloating || dialogRef.current?.contains(document.activeElement))) {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
onCloseRef.current();
|
onCloseRef.current();
|
||||||
@@ -227,7 +240,7 @@ export function Window({
|
|||||||
|
|
||||||
return createPortal(
|
return createPortal(
|
||||||
<LoadingContext.Provider value={null}><InspectorSelectPolicyContext.Provider value={false}>
|
<LoadingContext.Provider value={null}><InspectorSelectPolicyContext.Provider value={false}>
|
||||||
<div className="nodedc-overlay nodedc-ui-root" data-placement={placement} data-floating={isFloating || undefined} onPointerDown={handleBackdropPointerDown}>
|
<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
|
<div
|
||||||
ref={dialogRef}
|
ref={dialogRef}
|
||||||
className={cn("nodedc-window nodedc-glass-material nodedc-material-rim", className)}
|
className={cn("nodedc-window nodedc-glass-material nodedc-material-rim", className)}
|
||||||
@@ -298,7 +311,7 @@ export function Window({
|
|||||||
{footer ? <footer className="nodedc-window__footer">{footer}</footer> : null}
|
{footer ? <footer className="nodedc-window__footer">{footer}</footer> : null}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</InspectorSelectPolicyContext.Provider></LoadingContext.Provider>,
|
</WindowSuspensionContext.Provider></InspectorSelectPolicyContext.Provider></LoadingContext.Provider>,
|
||||||
document.fullscreenElement ?? document.body,
|
document.fullscreenElement ?? document.body,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
import {createContext} from 'react';
|
||||||
|
/** A detached editor hides its owning window without unmounting its contents. */
|
||||||
|
export const WindowSuspensionContext=createContext<null|(()=>()=>void)>(null);
|
||||||
@@ -54,3 +54,5 @@ export * from "./ResizableViewport.js";
|
|||||||
export {useApplicationPanelFullscreen} from "./ApplicationPanelFullscreen.js";
|
export {useApplicationPanelFullscreen} from "./ApplicationPanelFullscreen.js";
|
||||||
|
|
||||||
export {SceneAnnotation} from "./SceneAnnotation.js";
|
export {SceneAnnotation} from "./SceneAnnotation.js";
|
||||||
|
|
||||||
|
export {LevelButton,type LevelButtonProps} from "./LevelButton.js";
|
||||||
|
|||||||
@@ -412,7 +412,8 @@
|
|||||||
"backdrop close policy",
|
"backdrop close policy",
|
||||||
"modal-only body scroll lock",
|
"modal-only body scroll lock",
|
||||||
"optional bounded dragging for modeless inspectors",
|
"optional bounded dragging for modeless inspectors",
|
||||||
"move toggle: preserve mounted contents and current size; remove dimming, backdrop close, scroll lock and focus trap; header drag and eight invisible resize regions"
|
"move toggle: preserve mounted contents and current size; remove dimming, backdrop close, scroll lock and focus trap; header drag and eight invisible resize regions",
|
||||||
|
"Escape and Tab belong to the focused or topmost visible modal; parent windows do not dismiss behind nested settings."
|
||||||
],
|
],
|
||||||
"rules": [
|
"rules": [
|
||||||
"WindowFooterActions aligns modal actions to the trailing edge, including a footer with only one action group; actions wrap within narrow windows.",
|
"WindowFooterActions aligns modal actions to the trailing edge, including a footer with only one action group; actions wrap within narrow windows.",
|
||||||
@@ -1357,8 +1358,28 @@
|
|||||||
"Header Enter/Space starts keyboard docking; arrows select edges, Shift+arrows the whole workspace, Tab cycles tools, Home floats, Escape cancels. Floating headers also support arrows and Shift+arrows for move/resize.",
|
"Header Enter/Space starts keyboard docking; arrows select edges, Shift+arrows the whole workspace, Tab cycles tools, Home floats, Escape cancels. Floating headers also support arrows and Shift+arrows for move/resize.",
|
||||||
"Hidden tools retain their docking placement and remembered floating rectangle. Viewport clamps never overwrite preferred geometry.",
|
"Hidden tools retain their docking placement and remembered floating rectangle. Viewport clamps never overwrite preferred geometry.",
|
||||||
"EditorWorkspace keeps one mounted portal host, moves it atomically when supported, and restores its original slot on return. It never changes the source-view layout.",
|
"EditorWorkspace keeps one mounted portal host, moves it atomically when supported, and restores its original slot on return. It never changes the source-view layout.",
|
||||||
"The fixed editor header is outside docking bounds. Back, edit completion and close return to the original view."
|
"The fixed editor header is outside docking bounds. Back, edit completion and close return to the original view.",
|
||||||
|
"When opened inside Window, the editor suspends that overlay, backdrop and focus trap without unmounting; returning restores the same window."
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "level-button",
|
||||||
|
"status": "baseline",
|
||||||
|
"package": "@nodedc/ui-react",
|
||||||
|
"exports": [
|
||||||
|
"LevelButton",
|
||||||
|
"LevelButtonProps"
|
||||||
|
],
|
||||||
|
"domContract": [
|
||||||
|
"nodedc-level-button"
|
||||||
|
],
|
||||||
|
"summary": "Compact measured resource level inside a canonical pill button opening details.",
|
||||||
|
"rules": [
|
||||||
|
"Consumer supplies a measured fraction and freshness; unknown is not zero.",
|
||||||
|
"Stale retains the last number and accessible stale text; explicit user fill colours are retained.",
|
||||||
|
"Keyboard, focus, disabled and pointer behavior come from Button. Explicit fillColor uses contrast-correct text on the filled portion."
|
||||||
|
],
|
||||||
|
"documentation": "../docs/LEVEL_BUTTON.md"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user