feat(ui): add docking, viewport controls and composed settings

Add shared dock layouts, navigation cube, range bands, progress actions and comparison surfaces. Extend toolbar menus and loading composition, and align tokens, registry entries, documentation and the living catalog.
This commit is contained in:
Codex
2026-10-29 09:38:25 +03:00
parent a6e6c8f2d9
commit cb534dbe39
51 changed files with 2273 additions and 336 deletions
+29 -14
View File
@@ -1,23 +1,38 @@
import type { HTMLAttributes } from "react";
import { useCallback, useContext, useId, useLayoutEffect, useState, type HTMLAttributes } from "react";
import { ActivityIndicator } from "./ActivityIndicator.js";
import { LoadingContext } from "./LoadingContext.js";
import { cn } from "./cn.js";
export interface LoadingRegionProps extends HTMLAttributes<HTMLDivElement> {
loading: boolean;
label: string;
/** Collect nested initial-content loads into this surface's single indicator. */
aggregate?: boolean;
}
/** Keeps content mounted and centers pending feedback inside its own bounds. */
export function LoadingRegion({ loading, label, children, className, ...props }: LoadingRegionProps) {
return (
<div {...props} className={cn("nodedc-loading-region", className)} aria-busy={loading}>
{children}
{loading ? (
<div className="nodedc-loading-region__status" role="status" aria-label={label}>
<ActivityIndicator />
<span aria-hidden="true">{label}</span>
</div>
) : null}
</div>
);
/** Keeps content mounted. Failures/unmounts release each nested pending lease. */
export function LoadingRegion({ loading, label, aggregate = false, children, className, ...props }: LoadingRegionProps) {
const parent = useContext(LoadingContext);
const id = useId();
const [pending, setPending] = useState<ReadonlySet<string>>(() => new Set());
const report = useCallback((key: string, busy: boolean) => {
setPending(previous => {
if (previous.has(key) === busy) return previous;
const next = new Set(previous);
if (busy) next.add(key); else next.delete(key);
return next;
});
}, []);
useLayoutEffect(() => {
parent?.(id, loading);
return () => parent?.(id, false);
}, [parent, id, loading]);
const busy = loading || (aggregate && !parent && pending.size > 0);
const content = <div {...props} className={cn("nodedc-loading-region", className)} aria-busy={busy}>
{children}
{busy && !parent ? <div className="nodedc-loading-region__status" role="status" aria-label={label}>
<ActivityIndicator /><span aria-hidden="true">{label}</span>
</div> : null}
</div>;
return aggregate && !parent ? <LoadingContext.Provider value={report}>{content}</LoadingContext.Provider> : content;
}