@sangheepark/figma-ds-mcp 0.2.10 → 0.2.12
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 +45 -0
- package/package.json +1 -1
|
@@ -309,6 +309,15 @@ function enrichSpec(traversal, mapping) {
|
|
|
309
309
|
// 6-A2: layout에서 CSS position 키 → Figma x/y 변환 후 non-layout 키 제거
|
|
310
310
|
if (node.layout) {
|
|
311
311
|
const lay = node.layout;
|
|
312
|
+
// 6-A2a: CSS position values → Figma positioning 정규화
|
|
313
|
+
// relative/sticky → 삭제 (normal flow = auto 기본값)
|
|
314
|
+
// fixed → absolute (가장 유사한 Figma 동작)
|
|
315
|
+
if (lay['positioning'] === 'relative' || lay['positioning'] === 'sticky') {
|
|
316
|
+
delete lay['positioning'];
|
|
317
|
+
}
|
|
318
|
+
else if (lay['positioning'] === 'fixed') {
|
|
319
|
+
lay['positioning'] = 'absolute';
|
|
320
|
+
}
|
|
312
321
|
// CSS top/left → Figma y/x (absolute positioning만)
|
|
313
322
|
if (lay['positioning'] === 'absolute') {
|
|
314
323
|
if (lay['top'] !== undefined && lay['y'] === undefined) {
|
|
@@ -345,6 +354,42 @@ function enrichSpec(traversal, mapping) {
|
|
|
345
354
|
node.layout.y = '0';
|
|
346
355
|
}
|
|
347
356
|
}
|
|
357
|
+
// 6-E: CSS cross-axis stretch default → Figma fill
|
|
358
|
+
// CSS flex: children stretch on cross-axis by default (align-items: stretch).
|
|
359
|
+
// Figma auto-layout: children default to hug. 이 차이를 보정.
|
|
360
|
+
// 조건: parent가 fixed/fill 크기 + stretch alignment → 자식 frame/component에 fill 부여
|
|
361
|
+
if ((node.type === 'frame' || node.type === 'component') && node.children && node.layout) {
|
|
362
|
+
const dir = node.layout.direction;
|
|
363
|
+
const alignItems = node.layout['align-items'];
|
|
364
|
+
// CSS: align-items 미설정 또는 stretch일 때만 자식이 stretch
|
|
365
|
+
const isStretch = !alignItems || alignItems === 'stretch';
|
|
366
|
+
if (isStretch && dir === 'column') {
|
|
367
|
+
const pw = node.layout.width;
|
|
368
|
+
if (pw && (pw === 'fill' || /^\d/.test(pw))) {
|
|
369
|
+
for (const child of node.children) {
|
|
370
|
+
if ((child.type === 'frame' || child.type === 'component')
|
|
371
|
+
&& child.layout?.positioning !== 'absolute'
|
|
372
|
+
&& !child.layout?.width) {
|
|
373
|
+
child.layout = child.layout || {};
|
|
374
|
+
child.layout.width = 'fill';
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
if (isStretch && dir === 'row') {
|
|
380
|
+
const ph = node.layout.height;
|
|
381
|
+
if (ph && (ph === 'fill' || /^\d/.test(ph))) {
|
|
382
|
+
for (const child of node.children) {
|
|
383
|
+
if ((child.type === 'frame' || child.type === 'component')
|
|
384
|
+
&& child.layout?.positioning !== 'absolute'
|
|
385
|
+
&& !child.layout?.height) {
|
|
386
|
+
child.layout = child.layout || {};
|
|
387
|
+
child.layout.height = 'fill';
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
348
393
|
// children 재귀
|
|
349
394
|
if (node.children) {
|
|
350
395
|
node.children.forEach((child, i) => {
|
package/package.json
CHANGED