2 Commits
14 changed files with 115 additions and 31 deletions
+2 -2
View File
@@ -11,8 +11,8 @@
},
"dependencies": {
"@nodedc/page-patterns": "0.1.0",
"@nodedc/ui-core": "0.7.2",
"@nodedc/ui-react": "0.7.5",
"@nodedc/ui-core": "0.7.3",
"@nodedc/ui-react": "0.7.8",
"cesium": "1.147.0",
"react": "^19.1.0",
"react-dom": "^19.1.0"
+8
View File
@@ -57,6 +57,7 @@ import {
ShareLinkModal,
SplitPane,
SortableItem,
SortableList,
SortableScope,
SettingsCard,
Switch,
@@ -406,6 +407,9 @@ export function CatalogApp() {
const [strokeColor, setStrokeColor] = useState("#2b2b36");
const [strokeOpacity, setStrokeOpacity] = useState(100);
const [treeDemoOpen,setTreeDemoOpen]=useState(false);
const [gridOrder,setGridOrder]=useState(["Первое изображение","Второе изображение","Третье изображение"]);
const [detailFloating,setDetailFloating]=useState(false);
const [detailRect,setDetailRect]=useState<import("@nodedc/ui-react").WindowRect>();
const [treeDemoRect,setTreeDemoRect]=useState({left:32,top:96,width:380,height:480});
const [treeSelected,setTreeSelected]=useState<string|null>('cells');
const [treeVisible,setTreeVisible]=useState(true);
@@ -1468,6 +1472,7 @@ export function CatalogApp() {
<div className="catalog-form">
<TextField label="Название проекта" hint="обязательно" value={projectName} onChange={(event) => setProjectName(event.target.value)} />
<TextAreaField label="Описание" value={notes} onChange={(event) => setNotes(event.target.value)} />
<TextAreaField appearance="plain" label="" aria-label="Текст заметки" value={notes} onChange={(event) => setNotes(event.target.value)} />
</div>
</Preview>
<Preview title="Действия" note="общая геометрия" className="catalog-preview--compact">
@@ -1549,6 +1554,7 @@ export function CatalogApp() {
</ResourceList>
<Button onClick={()=>setTreeDemoOpen(true)}>Дерево объектов · изменяемый размер</Button>
<DragDropRoot onDragEnd={()=>{}}><DraggableItem id="whole-material-tile">{({activator})=><Button {...activator.attributes} {...activator.listeners}>Перенос за всю плитку</Button>}</DraggableItem></DragDropRoot>
<SortableList handleSurface="control" layout="grid" className="catalog-sortable-grid" items={gridOrder} getId={item=>item} onReorder={setGridOrder}>{(item,{handle})=><GlassSurface padding="sm">{handle}<Icon name="image"/><Description>{item}</Description></GlassSurface>}</SortableList>
<SettingsCard title="Устройства не обнаружены" description="Подключите устройство, чтобы оно появилось в списке." />
<SettingsCard align="center" role="status" title="Настройки применены" description="Проверьте подключение устройства." />
</Preview>
@@ -2401,6 +2407,8 @@ export function CatalogApp() {
<Window
open={createModuleOpen}
floating={detailFloating} onFloatingChange={setDetailFloating}
rect={detailRect} onRectCommit={setDetailRect}
title="Создать модуль"
headerActionsPlacement="before-close"
headerActions={<IconButton label="Очистить форму" onClick={() => {setCreateModuleName("");setCreateModuleSlug("");}}><Icon name="trash"/></IconButton>}
+2
View File
@@ -2307,3 +2307,5 @@ textarea {
.catalog-theme-fields { display: grid; gap: var(--nodedc-space-4); }
.catalog-viewport-actions {position:absolute;top:var(--nodedc-space-3);right:var(--nodedc-space-3);display:flex;gap:var(--nodedc-space-2);padding:var(--nodedc-space-2);}
.catalog-sortable-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:var(--nodedc-space-3,12px)}
+10 -1
View File
@@ -46,7 +46,7 @@ Icon-only action по умолчанию круглый. Квадратная к
## Field
FieldFrame объединяет label, control, hint и description. `labelPlacement="below"` ставит компактную приглушённую подпись под контролом в заголовке; доступное имя контрола остаётся прежним. TextField/TextAreaField реализуют стандартные текстовые поля. Автозаполнение браузера сохраняет материал поля, цвет текста и каретки текущей темы; синяя системная заливка не используется. Клавиатурный фокус остаётся видимым.
FieldFrame объединяет label, control, hint и description. `labelPlacement="below"` ставит компактную приглушённую подпись под контролом в заголовке; доступное имя контрола остаётся прежним. TextField/TextAreaField реализуют стандартные текстовые поля. `appearance="plain"` сохраняет вид обычного текста без подложки и позволяет сразу поставить каретку; при пустой подписи нужен `aria-label`. TextAreaField в этом режиме растёт по содержимому и ширине окна, нативные выделение, вставка и undo сохраняются. Автозаполнение браузера сохраняет материал поля, цвет текста и каретки текущей темы; синяя системная заливка не используется. Клавиатурный фокус остаётся видимым.
Приложение не должно вручную собирать label и input, если подходит Field. Ошибка и validation state будут расширением этого контракта, а не локальным классом приложения.
@@ -617,3 +617,12 @@ ColorField screen sampling (owner direction, 2026-11-14): the shared palette inc
Floating EditorDockLayout tools honor minimumSize on restore, all eight resize edges and keyboard resize. If the available viewport is smaller, they fit that viewport; Inspector fields stack below a 330px content width instead of clipping. Tool footer is separate from the scrolling body; a Button width="full" is the canonical adaptive bottom action. The catalog's scene editor example demonstrates minimum size, a ColorField and fixed reset footer.
EditorDockLayout: every floating or actively detached tool uses context="scene" Glass V4 (shared scene tint/blur); docking removes that context and retains tiled surface/corner rules. Applies to hierarchy, layers, settings and any other editor tool. No application tint/blur overrides.
### Remembered detail windows and sortable image grids
`Window.floating/onFloatingChange` lets the host persist modal/floating mode by
window kind alongside `rect/onRectCommit`. See WINDOWS_AND_LAYERS.md.
`SortableList` and `SortableScope` accept `layout="grid"`; rectangular sorting
keeps the shared drag handle and activation threshold. The default stays vertical.
Для ручки поверх фотографии используйте `DragHandle surface="control"` или `SortableList handleSurface="control"`: видимый круг с общим стеклом внутри `nodedc-viewport-controls`. Bare-ручка остаётся вариантом по умолчанию для обычных строк.
+10
View File
@@ -175,3 +175,13 @@ ColorField spectrum has no decorative perimeter stroke; retain its visible sampl
## Focus of movable headers
Window, WorkspaceWindow and EditorDockLayout share the same drag-header focus contract. A pointer grab never inherits a keyboard focus ring or filled header from the previously focused input. Headers have no perimeter outline in any theme; keyboard focus uses the canonical contrasting surface. Pointer capture, focus ownership, Arrow/Shift+Arrow movement/resizing, Enter/Space docking and Escape cancellation remain unchanged. Check both direct grabbing and input → Tab → grabbing, in docked/floating and fullscreen contexts.
## Remembered presentation
Entity/detail windows persist presentation **by window kind**, not title or entity ID.
The application stores `floating` and `rect` in its durable user preferences;
`Window` consumes `floating`/`onFloatingChange` and `rect`/`onRectCommit`.
Opening the next entity restores the same mode, position and size. Return to modal
keeps the last floating rectangle for the next detachment. Viewport fitting does
not overwrite saved geometry. Switching view/edit keeps the same mounted Window.
Confirmation dialogs remain modal (`allowFloating=false`) and never inherit it.
+6 -6
View File
@@ -28,8 +28,8 @@
"version": "0.7.0",
"dependencies": {
"@nodedc/page-patterns": "0.1.0",
"@nodedc/ui-core": "0.7.2",
"@nodedc/ui-react": "0.7.5",
"@nodedc/ui-core": "0.7.3",
"@nodedc/ui-react": "0.7.8",
"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.2",
"version": "0.7.3",
"dependencies": {
"@nodedc/tokens": "0.6.0"
}
@@ -2525,17 +2525,17 @@
"name": "@nodedc/ui-dom",
"version": "0.7.0",
"dependencies": {
"@nodedc/ui-core": "0.7.2"
"@nodedc/ui-core": "0.7.3"
}
},
"packages/ui-react": {
"name": "@nodedc/ui-react",
"version": "0.7.6",
"version": "0.7.8",
"dependencies": {
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@nodedc/ui-core": "0.7.2",
"@nodedc/ui-core": "0.7.3",
"lucide-react": "^0.468.0"
},
"devDependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@nodedc/ui-core",
"version": "0.7.2",
"version": "0.7.3",
"type": "module",
"files": [
"dist",
+17
View File
@@ -4885,3 +4885,20 @@ textarea.nodedc-field__control {
background: transparent;
color: var(--nodedc-text-primary);
}
/* Directly editable detail copy: no permanent field plate. */
.nodedc-field--unlabelled > .nodedc-field__label-row {display:none;}
.nodedc-field--plain {gap:0;}
.nodedc-field--plain .nodedc-field__control {
min-height:0; padding:0; border-radius:var(--nodedc-radius-control-compact);
background:transparent; box-shadow:none; color:inherit; font:inherit; line-height:inherit;
}
.nodedc-field--plain .nodedc-field__control:focus-visible {background:var(--nodedc-focus-surface);}
.nodedc-field--plain textarea.nodedc-field__control {resize:none;overflow:hidden;}
.nodedc-drag-handle[data-surface="control"] {background:var(--nodedc-glass-control-bg);color:var(--nodedc-text-primary);}
:is(.nodedc-viewport-controls,.nodedc-scene-controls) .nodedc-drag-handle[data-surface="control"] {
background:rgb(var(--nodedc-modal-glass-tint-rgb) / var(--nodedc-scene-glass-opacity));
backdrop-filter:blur(var(--nodedc-scene-glass-blur)) saturate(var(--nodedc-modal-glass-saturation));
-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);}
+1 -1
View File
@@ -20,6 +20,6 @@
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
"@nodedc/ui-core": "0.7.2"
"@nodedc/ui-core": "0.7.3"
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@nodedc/ui-react",
"version": "0.7.6",
"version": "0.7.8",
"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.2",
"@nodedc/ui-core": "0.7.3",
"lucide-react": "^0.468.0"
},
"peerDependencies": {
+17 -9
View File
@@ -16,6 +16,7 @@ import {
arrayMove,
useSortable,
verticalListSortingStrategy,
rectSortingStrategy,
} from "@dnd-kit/sortable";
import { CSS } from "@dnd-kit/utilities";
import { cn } from "./cn.js";
@@ -51,8 +52,9 @@ const copyRect = (rect: DragRect | null | undefined): DragRect | undefined => re
height: rect.height,
}) : undefined;
export function DragHandle({ label = "Перетащить", listeners, attributes, className }: {
export function DragHandle({ label = "Перетащить", listeners, attributes, className, surface="none" }: {
label?: string;
surface?: "none" | "control";
listeners?: ReturnType<typeof useDraggable>["listeners"];
attributes?: ReturnType<typeof useDraggable>["attributes"];
className?: string;
@@ -61,6 +63,7 @@ export function DragHandle({ label = "Перетащить", listeners, attribut
<button
type="button"
className={cn("nodedc-drag-handle", className)}
data-surface={surface}
aria-label={label}
{...attributes}
{...listeners}
@@ -120,31 +123,36 @@ export function DropZone({ id, data, className, children }: { id: string; data?:
return <div ref={setNodeRef} className={cn(className, isOver && "is-drag-over")}>{children}</div>;
}
export function SortableScope({ ids, children }: { ids: string[]; children: ReactNode }) {
return <SortableContext items={ids} strategy={verticalListSortingStrategy}>{children}</SortableContext>;
const SortableLayoutContext=createContext<"list"|"grid">("list");
export function SortableScope({ ids, children, layout="list" }: { ids: string[]; children: ReactNode; layout?:"list"|"grid" }) {
return <SortableLayoutContext.Provider value={layout}><SortableContext items={ids} strategy={layout==="grid"?rectSortingStrategy:verticalListSortingStrategy}>{children}</SortableContext></SortableLayoutContext.Provider>;
}
export function SortableItem({ id, data, className, children }: {
export function SortableItem({ id, data, className, children, handleSurface="none" }: {
id: string;
handleSurface?: "none" | "control";
data?: NodedcDragData;
className?: string;
children: (state: { handle: ReactNode; isDragging: boolean }) => ReactNode;
}) {
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id, data });
const verticalTransform = transform ? { ...transform, x: 0 } : null;
const layout=useContext(SortableLayoutContext);
const verticalTransform = transform && layout!=="grid" ? { ...transform, x: 0 } : transform;
return (
<div
ref={setNodeRef}
className={cn(className, isDragging && "is-dragging")}
style={{ transform: CSS.Transform.toString(verticalTransform), transition, opacity: isDragging ? 0.65 : undefined }}
>
{children({ handle: <DragHandle listeners={listeners} attributes={attributes} />, isDragging })}
{children({ handle: <DragHandle surface={handleSurface} listeners={listeners} attributes={attributes} />, isDragging })}
</div>
);
}
export function SortableList<T>({ items, getId, className, onReorder, children }: {
export function SortableList<T>({ items, getId, className, onReorder, children, layout="list", handleSurface="none" }: {
items: T[];
handleSurface?: "none" | "control";
layout?: "list" | "grid";
getId: (item: T) => string;
className?: string;
onReorder: (items: T[]) => void;
@@ -158,10 +166,10 @@ export function SortableList<T>({ items, getId, className, onReorder, children }
const to = ids.indexOf(overId);
if (from >= 0 && to >= 0) onReorder(arrayMove(items, from, to));
}}>
<SortableScope ids={ids}>
<SortableScope ids={ids} layout={layout}>
<div className={className}>
{items.map((item) => (
<SortableItem key={getId(item)} id={getId(item)}>
<SortableItem key={getId(item)} id={getId(item)} handleSurface={handleSurface}>
{(state) => children(item, state)}
</SortableItem>
))}
+23 -4
View File
@@ -1,4 +1,4 @@
import { useId, type InputHTMLAttributes, type ReactNode, type TextareaHTMLAttributes } from "react";
import { useId, useLayoutEffect, useRef, type InputHTMLAttributes, type ReactNode, type TextareaHTMLAttributes } from "react";
import { cn } from "./cn.js";
export interface FieldFrameProps {
@@ -29,6 +29,8 @@ export interface TextFieldProps extends InputHTMLAttributes<HTMLInputElement> {
hint?: string;
description?: string;
fieldClassName?: string;
/** Plain text appearance for directly editable detail content. Keep an accessible name. */
appearance?: "default" | "plain";
}
export function TextField({
@@ -36,6 +38,7 @@ export function TextField({
hint,
description,
fieldClassName,
appearance = "default",
className,
id,
...props
@@ -43,7 +46,7 @@ export function TextField({
const generatedId = useId();
const controlId = id ?? generatedId;
return (
<FieldFrame label={label} hint={hint} description={description} htmlFor={controlId} className={fieldClassName}>
<FieldFrame label={label} hint={hint} description={description} htmlFor={controlId} className={cn(fieldClassName, appearance === "plain" && "nodedc-field--plain", !label && "nodedc-field--unlabelled")}>
<input id={controlId} className={cn("nodedc-field__control", className)} {...props} />
</FieldFrame>
);
@@ -54,6 +57,8 @@ export interface TextAreaFieldProps extends TextareaHTMLAttributes<HTMLTextAreaE
hint?: string;
description?: string;
fieldClassName?: string;
/** Plain text appearance for directly editable detail content. Keep an accessible name. */
appearance?: "default" | "plain";
}
export function TextAreaField({
@@ -61,15 +66,29 @@ export function TextAreaField({
hint,
description,
fieldClassName,
appearance = "default",
className,
id,
...props
}: TextAreaFieldProps) {
const generatedId = useId();
const controlId = id ?? generatedId;
const area = useRef<HTMLTextAreaElement>(null);
useLayoutEffect(() => {
const el = area.current;
if (!el || appearance !== "plain") return;
const resize = () => { el.style.height = "auto"; el.style.height = el.scrollHeight + "px"; };
resize();
let width = el.clientWidth;
const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => {
if (el.clientWidth !== width) { width = el.clientWidth; resize(); }
});
observer?.observe(el);
return () => observer?.disconnect();
}, [appearance, props.value]);
return (
<FieldFrame label={label} hint={hint} description={description} htmlFor={controlId} className={fieldClassName}>
<textarea id={controlId} className={cn("nodedc-field__control", className)} {...props} />
<FieldFrame label={label} hint={hint} description={description} htmlFor={controlId} className={cn(fieldClassName, appearance === "plain" && "nodedc-field--plain", !label && "nodedc-field--unlabelled")}>
<textarea ref={area} id={controlId} className={cn("nodedc-field__control", className)} {...props} />
</FieldFrame>
);
}
+8 -1
View File
@@ -59,6 +59,9 @@ export interface WindowProps extends Omit<HTMLAttributes<HTMLDivElement>, "title
onRectCommit?: (rect: WindowRect) => void;
/** Centered windows can become modeless without remounting their contents. */
allowFloating?: boolean;
/** App-owned presentation, persisted by window kind alongside rect. */
floating?: boolean;
onFloatingChange?: (floating: boolean) => void;
onClose: () => void;
}
@@ -83,6 +86,8 @@ export function Window({
rect,
onRectCommit,
allowFloating = true,
floating: controlledFloating,
onFloatingChange,
onClose,
className,
style,
@@ -107,7 +112,7 @@ export function Window({
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 = floating && allowFloating && placement === "center";
const isFloating = (controlledFloating ?? floating) && allowFloating && placement === "center";
const freeGeometry = isFloating || (resizable && placement === "end");
const canDrag = draggable || freeGeometry;
const shouldLockBodyScroll = !suspended && !isFloating && (lockBodyScroll ?? placement === "center");
@@ -310,7 +315,9 @@ export function Window({
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 (rectRef.current) commitRef.current?.({...rectRef.current});
setFloating(!isFloating);
onFloatingChange?.(!isFloating);
}}><Icon name="move" /></IconButton>}
{headerActionsPlacement === "before-close" && headerActions}
<button type="button" className="nodedc-window__close" aria-label={closeLabel} onClick={onClose}>
+8 -4
View File
@@ -257,7 +257,8 @@
"Labels and validation copy are part of the field contract.",
"Keyboard focus changes the surface and remains visible without a browser-blue outline.",
"Browser autofill retains the canonical field material, text and caret; keyboard focus remains visible.",
"FieldFrame labelPlacement=below is the compact muted caption variant for header selectors; above remains the default."
"FieldFrame labelPlacement=below is the compact muted caption variant for header selectors; above remains the default.",
"appearance=plain renders immediately editable detail copy without a permanent plate; empty labels require aria-label, textarea grows to content, keyboard focus remains visible."
]
},
{
@@ -464,14 +465,15 @@
"A draggable inspector moves by its header and remains clamped to the viewport.",
"Closing a modeless inspector is never gated by autosave; preserve the draft, close immediately and report persistence failure through ToastStack.",
"Operational copy inside Window uses component typography tokens; browser-default paragraph or heading sizes are forbidden.",
"Centered windows expose the move toggle by default; allowFloating opts a workflow out. Returning to modal restores canonical centered geometry; closing clears floating geometry.",
"Centered windows expose the move toggle by default; allowFloating opts a workflow out. Returning to modal restores canonical centered geometry; uncontrolled windows clear floating geometry on close.",
"Floating header supports arrow-key movement and Shift+arrow resizing. Bounds stay inside the viewport. Resize affordances have no hover decoration.",
"Inspectors inside a Window use its full available content width.",
"End inspectors opt into resizable with an optional initialRect; existing eight edge geometry and keyboard resize are shared with floating windows.",
"Application-owned rect restores modeless window geometry on reopen and external undo/import. onRectCommit reports one completed drag/resize or keyboard step; viewport fitting never overwrites saved geometry.",
"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."
"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."
]
},
{
@@ -1126,7 +1128,9 @@
"A reordered application page array is the single source of truth for both composition and navigation order.",
"Optional renderOverlay portals the drag preview above scroll clipping without moving source layout; cancellation clears it.",
"Pointer drops report client coordinates for consumer-owned canvas hit testing; dropping on empty space never implies an object target.",
"DraggableItem exposes activator attributes/listeners for whole-tile dragging without a separate handle; the same activation threshold distinguishes clicks from drags."
"DraggableItem exposes activator attributes/listeners for whole-tile dragging without a separate handle; the same activation threshold distinguishes clicks from drags.",
"SortableList/SortableScope layout=grid uses rectangular sorting and two-axis movement with the same handle-only interaction; list remains vertical by default.",
"DragHandle surface=control and SortableList handleSurface=control put the grip in a visible circle; viewport contexts use the shared glass material."
]
},
{