@sangheepark/figma-ds-mcp 0.2.13 → 0.2.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/tools/pipeline-tools.js +38 -0
- package/package.json +1 -1
|
@@ -89,6 +89,21 @@ function enrichSpec(traversal, mapping) {
|
|
|
89
89
|
}
|
|
90
90
|
const spec = deepClone(traversal);
|
|
91
91
|
function walk(node, path) {
|
|
92
|
+
// 6-G: absolute CSS constraints → Figma sizing
|
|
93
|
+
// Step 0 (LAYOUT_KEYS 필터링) 전에 실행해야 CSS 좌표(left/right/top/bottom) 활용 가능
|
|
94
|
+
if (node.layout) {
|
|
95
|
+
const lay = node.layout;
|
|
96
|
+
if (lay['positioning'] === 'absolute' || lay['positioning'] === 'fixed') {
|
|
97
|
+
const l = String(lay['left'] || ''), r = String(lay['right'] || '');
|
|
98
|
+
const t = String(lay['top'] || ''), b = String(lay['bottom'] || '');
|
|
99
|
+
if ((l === '0' || l === '0px') && (r === '0' || r === '0px') && !lay['width']) {
|
|
100
|
+
lay['width'] = 'fill';
|
|
101
|
+
}
|
|
102
|
+
if ((t === '0' || t === '0px') && (b === '0' || b === '0px') && !lay['height']) {
|
|
103
|
+
lay['height'] = 'fill';
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
92
107
|
// Step 0: 속성 위치 교정 (layout에 있으면 안 되는 key → style로 이동)
|
|
93
108
|
if (node.layout) {
|
|
94
109
|
const keysToMove = [];
|
|
@@ -298,6 +313,7 @@ function enrichSpec(traversal, mapping) {
|
|
|
298
313
|
node.layout['clip-content'] = true;
|
|
299
314
|
delete node.layout['overflow'];
|
|
300
315
|
}
|
|
316
|
+
// (6-G는 Step 0 앞으로 이동 — CSS 좌표가 LAYOUT_KEYS 필터링으로 사라지기 전에 처리)
|
|
301
317
|
// 6-A: CSS-only 속성 필터링 (Figma가 지원하지 않는 CSS 속성 제거)
|
|
302
318
|
if (node.style) {
|
|
303
319
|
for (const key of Object.keys(node.style)) {
|
|
@@ -404,6 +420,28 @@ function enrichSpec(traversal, mapping) {
|
|
|
404
420
|
delete node.layout['y'];
|
|
405
421
|
}
|
|
406
422
|
}
|
|
423
|
+
// 6-H: column parent centering inference (mx-auto 패턴)
|
|
424
|
+
// 웹에서 max-width + mx-auto는 가장 흔한 중앙 정렬 패턴.
|
|
425
|
+
// traversal이 mx-auto를 놓쳤을 때, 구조 패턴으로 추론:
|
|
426
|
+
// column + fill width 부모 + 고정폭 children (같은 width, ≥400px) → align-items:center
|
|
427
|
+
if (node.layout?.direction === 'column'
|
|
428
|
+
&& node.layout.width === 'fill'
|
|
429
|
+
&& node.children && node.children.length > 0
|
|
430
|
+
&& !node.layout['align-items']) {
|
|
431
|
+
const fixedWidths = [];
|
|
432
|
+
for (const child of node.children) {
|
|
433
|
+
const cw = child.layout?.width;
|
|
434
|
+
if (typeof cw === 'string' && /^\d+/.test(cw) && cw !== 'fill') {
|
|
435
|
+
fixedWidths.push(parseInt(cw, 10));
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
if (fixedWidths.length > 0) {
|
|
439
|
+
const allSame = fixedWidths.every(w => w === fixedWidths[0]);
|
|
440
|
+
if (allSame && fixedWidths[0] >= 400) {
|
|
441
|
+
node.layout['align-items'] = 'center';
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|
|
407
445
|
// children 재귀
|
|
408
446
|
if (node.children) {
|
|
409
447
|
node.children.forEach((child, i) => {
|
package/package.json
CHANGED