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
+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/);
});