/* 138-3 횡단 카드 열 수 · 폭 · 높이 — `B06_Section_UI_Section_Columns.ts` 를 그 자리에서 트랜스파일해 Node 로 돌림. */ const fs = require("fs"); const path = require("path"); const ts = require(path.join(__dirname, "..", "..", "config", "node_modules", "typescript")); const file = path.join(__dirname, "..", "..", "B06_Section", "B06_Section_UI_Section_Columns.ts"); const js = ts.transpileModule(fs.readFileSync(file, "utf8"), { compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020 }, }).outputText; const box = { exports: {} }; new Function("exports", "module", js)(box.exports, box); const c = box.exports; // 칸 폭 1232 · 간격 16 → 3열 폭 400 const baseWidth = c.crossCardWidth(1232, 3, 16); const base = [250, 300, 280, 260, 400]; const out = { clamp: [undefined, null, "", "abc", 0, 1, 2.6, 6, 9, "4"].map(c.clampCrossColumns), widths: [1, 2, 3, 6].map((n) => c.crossCardWidth(1232, n, 16)), baseWidth, rows3: c.crossRowHeights(base, baseWidth, baseWidth, 3), rows2: c.crossRowHeights(base, baseWidth, c.crossCardWidth(1232, 2, 16), 2), rows1: c.crossRowHeights(base, baseWidth, c.crossCardWidth(1232, 1, 16), 1), }; process.stdout.write(JSON.stringify(out));