| 123456789101112131415161718192021222324 |
- // 列出新版 Desktop-2 的顶层结构,并定位 nav / chip / 中央一张图
- import { readFileSync } from 'node:fs'
- const j = JSON.parse(readFileSync('.scratch/lanhu-cockpit-asset-replacement/research/raw-v2/desktop-02.json', 'utf8'))
- const ab = j.artboard
- console.log('top-level layers:')
- for (const l of ab.layers || []) {
- console.log(` ${l.type}:${l.name} ${Math.round(l.frame?.width ?? 0)}x${Math.round(l.frame?.height ?? 0)} children=${(l.layers || []).length}`)
- }
- // 全树找 name 含 Chip / nav / Layer 的节点
- const hits = []
- ;(function walk(node, path = '') {
- const p = path ? `${path}/${node.name}` : node.name
- if (/(^|\/)(nav|Chip|Chip:|Layer)(:|$|\/)/.test(node.name)) hits.push({ node, path: p })
- for (const ch of node.layers || []) walk(ch, p)
- })(ab, '')
- console.log(`\nmatched nodes: ${hits.length}`)
- for (const h of hits.slice(0, 12)) {
- const kids = (h.node.layers || []).map((c) => `${c.type}:${c.name}`).slice(0, 8)
- console.log(` ${h.node.type}:${h.node.name} ${Math.round(h.node.frame?.width ?? 0)}x${Math.round(h.node.frame?.height ?? 0)} | ${h.path}`)
- if (kids.length) console.log(` children: ${kids.join(', ')}`)
- }
|