feat(ui): add flat surfaces and compact profile/site controls

This commit is contained in:
DCCONSTRUCTIONS
2026-11-05 12:33:25 +03:00
parent 4904fbe1f7
commit 8addef187b
12 changed files with 98 additions and 10 deletions
+7 -3
View File
@@ -410,6 +410,7 @@ export function CatalogApp() {
const [sidePanelDemoOpen, setSidePanelDemoOpen] = useState(true);
const [createModalOpen, setCreateModalOpen] = useState(false);
const [missionAppearance, setMissionAppearance] = useState(false);
const [flatEdges, setFlatEdges] = useState(false);
const [featureSettingsDemoOpen, setFeatureSettingsDemoOpen] = useState(false);
const [featureSettingsDemoSection, setFeatureSettingsDemoSection] = useState('general');
const [confirmOpen, setConfirmOpen] = useState(false);
@@ -549,6 +550,7 @@ export function CatalogApp() {
applyNodedcTheme(document.documentElement, {
theme,
appearance: missionAppearance ? "mission" : "default",
edges: flatEdges ? "flat" : "default",
accent,
material: {
panel: panelMaterial,
@@ -558,7 +560,7 @@ export function CatalogApp() {
},
});
document.documentElement.style.setProperty("--nodedc-canvas-soft", material.nestedHex);
}, [accent, fieldMaterial, material.fieldOpacity, material.nestedHex, material.panelOpacity, panelMaterial, theme, missionAppearance]);
}, [accent, fieldMaterial, material.fieldOpacity, material.nestedHex, material.panelOpacity, panelMaterial, theme, missionAppearance, flatEdges]);
useEffect(() => {
applyGlassMaterial(document.documentElement, glassMaterial);
@@ -1408,7 +1410,7 @@ export function CatalogApp() {
</FieldFrame>
<FieldFrame label="Engine / split select">
<Select
variant="split"
variant="split" shape="pill"
label="Тип связи"
value={connectionType}
options={[
@@ -1787,7 +1789,7 @@ export function CatalogApp() {
<p className="catalog-preview__explanation">Destructive-цвет появляется только у подтверждения.</p>
<Button variant="danger" shape="pill" icon={<Icon name="trash" />} onClick={() => setConfirmOpen(true)}>Проверить удаление</Button>
</Preview>
<Preview title="Настройки модуля" note="адаптивное меню и форма" className="catalog-modal-preview"><Switch label="Визуальный профиль Mission Core" checked={missionAppearance} onChange={setMissionAppearance} />
<Preview title="Настройки модуля" note="адаптивное меню и форма" className="catalog-modal-preview"><Switch label="Без декоративных обводок" checked={flatEdges} onChange={setFlatEdges} /><Switch label="Визуальный профиль Mission Core" checked={missionAppearance} onChange={setMissionAppearance} />
<Button icon={<Icon name="settings" />} onClick={() => setFeatureSettingsDemoOpen(true)}>Открыть настройки модуля</Button>
</Preview>
<Preview title="Workflow sharing" note="ENGINE / access" className="catalog-modal-preview">
@@ -2163,6 +2165,8 @@ export function CatalogApp() {
<HeaderProfile>
<IconButton label="Уведомления"><Icon name="inbox" size={20} strokeWidth={1.7} /></IconButton>
<UserProfileMenu
triggerLabel="Профиль"
triggerIcon="inbox"
displayName={sessionProfile?.user?.displayName || "Профиль"}
subtitle={sessionProfile?.user?.email || "NODE.DC Foundry"}
avatarUrl={sessionProfile?.user?.avatarUrl || undefined}
+7
View File
@@ -105,3 +105,10 @@ collections and knowledge content remain domain UI. No package source is copied
or maintained as a local component fork. Remove this adapter as those domain
renderers move to direct component composition. CMS CI rejects stale generated
assets; the existing Git-to-canonical-runner deployment foundation is unchanged.
CMS visual follow-up, 2026-11-05: flat theme edges, neutral white default accent,
UserProfileMenu with a session avatar and inbox glyph, FeatureSettingsWindow,
ColorField, pill-shaped split Select, and the canonical six-dot DragHandle.
UI preferences belong to browser-local storage; site content and deployment
credentials stay in the existing CMS model. Immutable npm snapshots retain
package semver and are identified by source commit plus archive SHA-256.
+6
View File
@@ -524,3 +524,9 @@ Exact `RangeControl` editors synchronize external controlled-value changes while
Window: `rect` / `onRectCommit` — восстановление и фиксация геометрии инструментов; см. WINDOWS_AND_LAYERS.md. Иконка `minus` дополняет `plus` для управления масштабом содержимого.
`EditorDockLayout` / `EditorWorkspace`: переносимый редактор с закреплённым основным видом, четырьмя зонами стыковки, разделителями и отрываемыми панелями. Управляемый `EditorDockState` хранится в документе приложения. Шапка редактора не участвует в стыковке; возврат восстанавливает исходный вид. Контракт, keyboard и минимумы — в WINDOWS_AND_LAYERS.md.
## Flat surface profile and profile trigger
The shared theme supports `edges: "flat"` for borderless surfaces, including portal windows. Keyboard focus changes the fill and foreground instead of adding an outline. The living catalog exposes this alongside the Mission appearance switch. `UserProfileMenu.triggerIcon` accepts a canonical icon between the label and avatar; CMS uses `triggerLabel="Профиль"` and `triggerIcon="inbox"`, followed by a separate settings IconButton.
`Select variant="split" shape="pill"` aligns a compact workspace/site selector with adjacent round actions, preserving the shared dimensions and keyboard behavior.
+4
View File
@@ -76,3 +76,7 @@ other consumers. Light theme retains its legible light surfaces. Reapplying
Feature settings use the same geometry, focus, scrolling and responsive behavior.
Application code owns section names and icons; tracker/VPS sections follow the
text-only Mission equipment menu. Environment settings may retain their icons.
## Flat surfaces
`applyNodedcTheme(root, { theme, accent, edges: "flat" })` removes decorative borders and rims from controls, navigation and portal surfaces. Focus uses a contrasting fill; geometry and focus behavior remain unchanged. CMS uses flat surfaces with a white default accent. Other consumers keep `edges: "default"`.
+3 -2
View File
@@ -11,7 +11,7 @@
"scripts": {
"build": "npm run build --workspace @nodedc/ui-core && npm run build --workspace @nodedc/ui-dom && npm run build --workspace @nodedc/ui-react && npm run build --workspace @nodedc/page-patterns && npm run build --workspace @nodedc/map-cesium-react && npm run build --workspace @nodedc/ui-catalog",
"build:packages": "npm run build --workspace @nodedc/ui-core && npm run build --workspace @nodedc/ui-dom && npm run build --workspace @nodedc/ui-react && npm run build --workspace @nodedc/page-patterns && npm run build --workspace @nodedc/map-cesium-react",
"check": "npm run build:packages && npm run typecheck --workspaces --if-present && npm run validate:registry && npm run test:spark-governance && npm run test:analysis-controls && npm run test:activity-indicator && npm run test:control-density && npm run test:icon-contract && npm run test:toast-contract && npm run test:floating-position && npm run test:inspector-select && npm run test:range-control && npm run test:split-pane && npm run test:dock-layout && npm run test:hgeozone-projection && npm run test:map-grid-lod && npm run test:map-filters && npm run test:map-object-layers && npm run test:map-inspector-overlay-state && npm run test:map-reference-stations && npm run test:map-search && npm run test:map-subject-card && npm run test:map-subject-detail-profile && npm run test:environment-settings && npm run test:settings-surfaces && npm run test:window-geometry && npm run test:editor-dock",
"check": "npm run build:packages && npm run typecheck --workspaces --if-present && npm run validate:registry && npm run test:spark-governance && npm run test:analysis-controls && npm run test:activity-indicator && npm run test:control-density && npm run test:icon-contract && npm run test:toast-contract && npm run test:floating-position && npm run test:inspector-select && npm run test:range-control && npm run test:split-pane && npm run test:dock-layout && npm run test:hgeozone-projection && npm run test:map-grid-lod && npm run test:map-filters && npm run test:map-object-layers && npm run test:map-inspector-overlay-state && npm run test:map-reference-stations && npm run test:map-search && npm run test:map-subject-card && npm run test:map-subject-detail-profile && npm run test:environment-settings && npm run test:settings-surfaces && npm run test:window-geometry && npm run test:editor-dock && npm run test:flat-theme",
"dev": "npm run build:packages && npm run dev --workspace @nodedc/ui-catalog",
"serve": "node server/catalog-server.mjs",
"validate:registry": "node scripts/validate-registry.mjs",
@@ -45,7 +45,8 @@
"test:analysis-controls": "node --test scripts/analysis-controls.test.mjs",
"test:settings-surfaces": "node --test scripts/settings-surfaces.test.mjs",
"test:window-geometry": "node --test scripts/window-geometry.test.mjs",
"test:editor-dock": "node --test scripts/editor-dock.test.mjs"
"test:editor-dock": "node --test scripts/editor-dock.test.mjs",
"test:flat-theme": "node --test scripts/flat-theme.test.mjs"
},
"engines": {
"node": ">=20"
+4 -1
View File
@@ -17,6 +17,8 @@ export interface ApplyThemeOptions {
theme?: NodedcTheme;
/** Operator UI qualified against Mission Core; opt-in across portals. */
appearance?: "default" | "mission";
/** Flat surfaces remove decorative edges; keyboard focus uses a contrasting fill. */
edges?: "default" | "flat";
accent?: RgbTuple;
material?: NodedcMaterial;
}
@@ -31,10 +33,11 @@ function clampOpacity(value: number): number {
export function applyNodedcTheme(
target: HTMLElement,
{ theme = "dark", accent, material, appearance = "default" }: ApplyThemeOptions = {},
{ theme = "dark", accent, material, appearance = "default", edges = "default" }: ApplyThemeOptions = {},
): void {
target.dataset.nodedcTheme = theme;
target.dataset.nodedcAppearance = appearance;
target.dataset.nodedcEdges = edges;
target.dataset.nodedcUi = "true";
if (accent) {
+28
View File
@@ -4676,3 +4676,31 @@ textarea.nodedc-field__control {
.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)}
/* Opt-in flat material. Applies at the document root, including portal layers.
Focus remains visible through a high-contrast fill instead of a contour. */
[data-nodedc-edges="flat"] {
--nodedc-glass-outline: transparent;
--nodedc-glass-control-shadow: none;
--nodedc-panel-action-border: transparent;
--nodedc-panel-action-border-hover: transparent;
--nodedc-panel-action-shadow: none;
}
[data-nodedc-edges="flat"] .nodedc-material-rim::after,
[data-nodedc-edges="flat"] .nodedc-glass-material::before { display: none; }
[data-nodedc-edges="flat"] :is(.nodedc-admin-panel__nav-item, .nodedc-application-panel__action, .nodedc-admin-panel__close, .nodedc-media-source-button, .nodedc-media-preview, .nodedc-color-field__swatch) {
border: 0;
box-shadow: none;
}
[data-nodedc-edges="flat"] :is(button, input, textarea, [tabindex]):focus-visible {
outline: 0;
box-shadow: none;
background-color: var(--nodedc-text-primary);
color: var(--nodedc-canvas);
}
[data-nodedc-edges="flat"] .nodedc-admin-panel__nav-item:focus-visible .nodedc-admin-panel__nav-icon {
background: var(--nodedc-canvas);
color: var(--nodedc-text-primary);
}
.nodedc-select[data-shape="pill"] :is(.nodedc-select__value,.nodedc-select__toggle) { border-radius: var(--nodedc-radius-circle); }
+4 -1
View File
@@ -29,6 +29,8 @@ export interface SelectProps<T extends string> {
menuWidth?: number | "anchor";
disabled?: boolean;
variant?: SelectVariant;
/** Split site/workspace selectors can align with adjacent circular actions. */
shape?: "default" | "pill";
className?: string;
triggerClassName?: string;
menuClassName?: string;
@@ -47,6 +49,7 @@ export function Select<T extends string>({
menuWidth = "anchor",
disabled = false,
variant = "integrated",
shape = "default",
className,
triggerClassName,
menuClassName,
@@ -88,7 +91,7 @@ export function Select<T extends string>({
};
if (resolvedVariant === "split") {
return (
<div className={cn("nodedc-select", triggerClassName)} data-disabled={disabled ? "true" : undefined}>
<div className={cn("nodedc-select", triggerClassName)} data-shape={shape === "pill" ? "pill" : undefined} data-disabled={disabled ? "true" : undefined}>
<div ref={setAnchorRef} className="nodedc-select__control">
<div className="nodedc-select__value">
{selected?.icon ? <span className="nodedc-select__value-icon">{selected.icon}</span> : null}
@@ -19,6 +19,8 @@ export interface UserProfileMenuProps {
avatarUrl?: string;
coverImageUrl?: string;
triggerLabel?: ReactNode;
/** Optional status glyph between the label and avatar. */
triggerIcon?: IconName;
actions: readonly UserProfileMenuAction[];
}
@@ -28,6 +30,7 @@ export function UserProfileMenu({
avatarUrl,
coverImageUrl,
triggerLabel,
triggerIcon,
actions,
}: UserProfileMenuProps) {
const label = displayName || "NODE.DC";
@@ -49,6 +52,7 @@ export function UserProfileMenu({
onClick={toggle}
>
{triggerLabel === null ? null : <span className="nodedc-user-profile-menu__trigger-label">{triggerLabel ?? label}</span>}
{triggerIcon ? <Icon name={triggerIcon} size={18} /> : null}
<HeaderAvatar label={label} imageUrl={avatarUrl} />
</button>
)}
+6 -3
View File
@@ -114,7 +114,8 @@
"A material rim is a glass highlight, not a hard product-colored border.",
"Nested surfaces must use a softer tone to avoid card-inside-card noise.",
"GlassMaterialSurface supports modal/Inspector floating material and explicit context=scene telemetry overlays over rendered imagery; ordinary panels remain matte. Optional material and radiusPx apply appearance to one instance without changing the global theme.",
"MapGlassSurface is restricted to overlays over Cesium/map imagery and must match the map Toolbar translucency."
"MapGlassSurface is restricted to overlays over Cesium/map imagery and must match the map Toolbar translucency.",
"Theme edges=flat removes decorative rims and active outlines across portals; keyboard focus uses contrasting fill without changing geometry."
]
},
{
@@ -382,7 +383,8 @@
"Split is the Engine form: a separate value surface and a 46 px toggle separated by an 8 px gap.",
"Inline is a compact label-only toolbar trigger without a persistent surface or chevron; its menu and keyboard behavior remain canonical.",
"Integrated Select is forbidden inside Inspector; use InspectorSelectField so the visible label is above a full-width split control.",
"The portal menu preserves its source-family row geometry instead of inheriting card radii."
"The portal menu preserves its source-family row geometry instead of inheriting card radii.",
"Split Select accepts shape=pill to align its separate toggle with circular workspace actions."
]
},
{
@@ -667,7 +669,8 @@
"rules": [
"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."
"Do not embed product permissions or sharing rules in the visual menu.",
"Optional triggerIcon places a shared glyph between triggerLabel and the session avatar; adjacent application settings stay a separate IconButton."
]
},
{
+4
View File
@@ -68,5 +68,9 @@
"appearanceProfiles": {
"default": "Existing theme/material behavior",
"mission": "Opt-in operator appearance, qualified against live Mission Core 2026-09-30; shared modal/floating surfaces, neutral avatars and dot statuses"
},
"surfaceEdgeProfiles": {
"default": "Existing surface edges",
"flat": "No decorative borders or rims; contrasting keyboard focus fill"
}
}
+21
View File
@@ -0,0 +1,21 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import {createElement as h} from 'react';
import {renderToStaticMarkup} from 'react-dom/server';
import {applyNodedcTheme} from '../packages/ui-core/dist/index.js';
import {UserProfileMenu} from '../packages/ui-react/dist/index.js';
test('flat profile can be switched back and keeps legible white accent in both themes',()=>{
const values=new Map(); const element={dataset:{},style:{setProperty:(k,v)=>values.set(k,v)}};
for(const theme of ['dark','light']) {
applyNodedcTheme(element,{theme,edges:'flat',accent:[255,255,255]});
assert.equal(element.dataset.nodedcEdges,'flat'); assert.equal(element.dataset.nodedcTheme,theme);
assert.equal(values.get('--nodedc-on-accent-rgb'),'11 17 23');
}
applyNodedcTheme(element,{theme:'dark'}); assert.equal(element.dataset.nodedcEdges,'default');
});
test('profile glyph stays between label and real session avatar',()=>{
const markup=renderToStaticMarkup(h(UserProfileMenu,{displayName:'Operator',triggerLabel:'Профиль',triggerIcon:'inbox',avatarUrl:'/avatar.png',actions:[]}));
assert.ok(markup.indexOf('Профиль')<markup.indexOf('<svg'));
assert.ok(markup.indexOf('<svg')<markup.indexOf('class="nodedc-header__avatar"'));
assert.match(markup,/src="\/avatar.png"/); assert.match(markup,/Меню пользователя Operator/);
});