Implement ProgCode identity and real shared reading UI kit
Build and deploy / deploy (push) Successful in 2m39s

This commit is contained in:
huncode committed 2026-10-27 15:19:49 +03:00
1 parent 99c848189e
commit 12562baeb5
2040 files changed
+184656 -181

No files matched your search

@@ -0,0 +1,18 @@
async page=>{
const b='http://127.0.0.1:65019',out='/tmp/progcode-ds-designer0340',cases=[['home','/'],['catalog','/category/dlang/'],['hello','/articles/привет-мир/'],['tilix','/articles/о-tilix-и-d-интервью-с-геральдом-нанном/'],['gc','/articles/dconf-2017-под-капотом-мусорщика-ди-дмитрий-ол/'],['vibe','/articles/особенности-vibe-d/'],['code','/articles/пишем-аналог-функции-php-preg_match_all-на-языке-прог/'],['ctfe','/articles/новый-движок-ctfe/'],['bitrix','/articles/bitrix-api-add-foto-editor/'],['privacy','/privacy/'],['sources','/sources/'],['resources','/resources/'],['about','/about/'],['json','/tools/'],['404','/ds-designer-missing/'],['kit','/ui-kit/']];
const report={identity:await page.request.get(b+'/build-identity.json').then(r=>r.json()),checks:[]};
for(const theme of ['light','dark']){await page.goto(b+'/');await page.getByRole('combobox',{name:'Тема'}).selectOption(theme);
for(const width of [320,390,1440]){await page.setViewportSize({width,height:900});
for(const [name,path] of cases){const response=await page.goto(b+path);await page.waitForTimeout(70);await page.screenshot({path:out+'/'+name+'-'+width+'-'+theme+'-top.png'});
const state=await page.evaluate(()=>{
function rgb(s){return (s.match(/[\d.]+/g)||[]).slice(0,3).map(Number)}
function lum(c){return c.map(v=>v/255).map(v=>v<=.04045?v/12.92:((v+.055)/1.055)**2.4).reduce((a,v,i)=>a+v*[.2126,.7152,.0722][i],0)}
function bg(e){for(let p=e;p;p=p.parentElement){let x=getComputedStyle(p).backgroundColor;if(!x.includes('rgba')||!x.endsWith(', 0)'))return x}return 'rgb(255,255,255)'}
const bad=[];const seen=new Set();for(const e of document.querySelectorAll('main p,main h1,main h2,main h3,main a,main label,main .article-meta,main .search-status,main figcaption,header a,header select,main button,main .status-message')){if(!e.getClientRects().length||!e.textContent.trim())continue;const s=getComputedStyle(e),back=bg(e),key=s.color+'|'+back;const l=[lum(rgb(s.color)),lum(rgb(back))].sort((a,b)=>b-a);const ratio=(l[0]+.05)/(l[1]+.05);const large=parseFloat(s.fontSize)>=24||(parseFloat(s.fontSize)>=18.66&&parseFloat(s.fontWeight)>=700);if(ratio<(large?3:4.5)&&!seen.has(key)){seen.add(key);bad.push({text:e.textContent.trim().slice(0,80),color:s.color,bg:back,ratio,font:s.fontSize,weight:s.fontWeight})}}
const header=document.querySelector('header.masthead'),brand=header?.querySelector('.brand'),control=header?.querySelector('select');return {width:innerWidth,scroll:document.documentElement.scrollWidth,theme:document.documentElement.dataset.theme,h1:document.querySelector('h1')?.textContent,bad,brand:brand?{right:brand.getBoundingClientRect().right,width:brand.getBoundingClientRect().width}:null,themeControl:control?{left:control.getBoundingClientRect().left,right:control.getBoundingClientRect().right}:null};});
report.checks.push({name,path,requestedTheme:theme,status:response.status(),...state});
if(width===390&&['tilix','code','ctfe','bitrix','gc','vibe','kit'].includes(name)){const targets=name==='ctfe'?['.table-scroll','figure']:name==='bitrix'||name==='gc'||name==='vibe'?['figure']:name==='code'?['pre']:name==='kit'?['.uikit-native','.table-scroll','figure']:['.article-content h2'];let i=0;for(const selector of targets){const es=await page.locator(selector).all();for(const el of es.slice(0,2)){await el.scrollIntoViewIfNeeded();await page.screenshot({path:out+'/'+name+'-'+width+'-'+theme+'-detail'+i+++'.png'});}}}
}
}}
return report;
}