${l.id} / ${l.name}
原图第 ${l.source.row} 行、第 ${l.source.column} 列;${l.width}×${l.height} 像素。显示为原始构件重组,无新生成图形。放大不增加细节。
import {readFile,writeFile,mkdir} from 'node:fs/promises';
import path from 'node:path';
import layouts from '../src/content/layouts/reference/manifest.json';
const root=path.resolve(import.meta.dirname,'..'),target=path.join(root,'public/layout-reference');
const esc=(s:string)=>s.replaceAll('&','&').replaceAll('<','<').replaceAll('"','"');
async function main(){
await writeFile(path.join(target,'manifest.json'),JSON.stringify(layouts,null,2)+'\n');
const runtime=await readFile(path.join(root,'src/content/layouts/reference/ReferenceLayout.tsx'),'utf8');await writeFile(path.join(target,'ReferenceLayout.tsx'),runtime);
for(const l of layouts){
const layers=l.elements.map(e=>{const[x,y,w,h]=e.box;return ``}).join('\n');
const html=`\n
原图第 ${l.source.row} 行、第 ${l.source.column} 列;${l.width}×${l.height} 像素。显示为原始构件重组,无新生成图形。放大不增加细节。
按原图从上到下、每行从左到右编号,排除左侧说明栏。点击每张可分开检查文字、图片占位/色块与装饰。
\n`); console.log('Built 27 layer inspectors and the source ID index.'); } main().catch(e=>{console.error(e);process.exitCode=1});