UNPKG

penframe

Version:

A lightweight DSL-based wireframe and UI structure visualization tool.

28 lines (22 loc) 793 B
const { parse, penframeToSvg } = require('../index.js'); // Simple test DSL const dslCode = ` @headline "Hello World" { level: 1 } @button "Click Me" { color: "#007bff" } `; console.log('Testing PenFrame API...\n'); try { // 1. Test parsing console.log('1. Testing parse()...'); const ast = parse(dslCode); console.log('AST:', JSON.stringify(ast, null, 2)); // 2. Test SVG conversion console.log('\n2. Testing penframeToSvg()...'); const svg = penframeToSvg(dslCode); console.log('SVG generated, length:', svg.length, 'characters'); console.log('SVG preview:', svg.substring(0, 200) + '...'); console.log('\n✅ API working correctly!'); } catch (error) { console.error('❌ Error:', error.message); console.error(error.stack); }