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
+25
View File
@@ -0,0 +1,25 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import {createElement as h} from 'react';
import {renderToStaticMarkup} from 'react-dom/server';
import {LoadingRegion,Description,SettingsCard,ComparisonTable} from '../packages/ui-react/dist/index.js';
test('composed loading draws exactly one owner even with multiple pending descendants',()=>{
const child=h(LoadingRegion,{loading:true,label:'child'},h('span',null,'retained'));
const markup=renderToStaticMarkup(h(LoadingRegion,{aggregate:true,loading:true,label:'equipment'},child,child,h(LoadingRegion,{aggregate:true,loading:true,label:'nested'},child)));
assert.equal((markup.match(/role="status"/g)||[]).length,1);assert.match(markup,/aria-label="equipment"/);assert.equal((markup.match(/retained/g)||[]).length,3);
});
test('independent surfaces keep their loaders and resolved content has no indicator',()=>{
const markup=renderToStaticMarkup(h('div',null,h(LoadingRegion,{loading:true,label:'a'}),h(LoadingRegion,{loading:true,label:'b'})));
assert.equal((markup.match(/role="status"/g)||[]).length,2);
assert.doesNotMatch(renderToStaticMarkup(h(LoadingRegion,{aggregate:true,loading:false,label:'done'},h(LoadingRegion,{loading:false,label:'child'},'ready'))),/role="status"/);
});
test('comparison has one label column, arbitrary entity columns and semantic headers',()=>{
for(const count of [1,2,3,4,8]){
const markup=renderToStaticMarkup(h(ComparisonTable,{label:'VESC',heading:'VESC',columns:Array.from({length:count},(_,i)=>({id:String(i),label:'id'+i})),rows:[{id:'position',label:'Расположение',cells:Array(count).fill('Левый')},{id:'current',label:'Ток',cells:[]}]}));
assert.equal((markup.match(/scope="col"/g)||[]).length,count+1);assert.equal((markup.match(/scope="row"/g)||[]).length,2);assert.equal((markup.match(/<td>/g)||[]).length,2*count);assert.match(markup,/tabindex="0"/);
}
});
test('SettingsCard and standalone explanatory paragraphs use one typography component',()=>{
assert.match(renderToStaticMarkup(h(Description,null,'help')),/class="nodedc-description"/);
assert.match(renderToStaticMarkup(h(SettingsCard,{title:'Settings',description:'help'})),/<p class="nodedc-description">help/);
});