@sangheepark/figma-ds-mcp 0.2.10 → 0.2.11
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 +36 -0
- package/package.json +1 -1
|
@@ -345,6 +345,42 @@ function enrichSpec(traversal, mapping) {
|
|
|
345
345
|
node.layout.y = '0';
|
|
346
346
|
}
|
|
347
347
|
}
|
|
348
|
+
// 6-E: CSS cross-axis stretch default → Figma fill
|
|
349
|
+
// CSS flex: children stretch on cross-axis by default (align-items: stretch).
|
|
350
|
+
// Figma auto-layout: children default to hug. 이 차이를 보정.
|
|
351
|
+
// 조건: parent가 fixed/fill 크기 + stretch alignment → 자식 frame/component에 fill 부여
|
|
352
|
+
if ((node.type === 'frame' || node.type === 'component') && node.children && node.layout) {
|
|
353
|
+
const dir = node.layout.direction;
|
|
354
|
+
const alignItems = node.layout['align-items'];
|
|
355
|
+
// CSS: align-items 미설정 또는 stretch일 때만 자식이 stretch
|
|
356
|
+
const isStretch = !alignItems || alignItems === 'stretch';
|
|
357
|
+
if (isStretch && dir === 'column') {
|
|
358
|
+
const pw = node.layout.width;
|
|
359
|
+
if (pw && (pw === 'fill' || /^\d/.test(pw))) {
|
|
360
|
+
for (const child of node.children) {
|
|
361
|
+
if ((child.type === 'frame' || child.type === 'component')
|
|
362
|
+
&& child.layout?.positioning !== 'absolute'
|
|
363
|
+
&& !child.layout?.width) {
|
|
364
|
+
child.layout = child.layout || {};
|
|
365
|
+
child.layout.width = 'fill';
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
if (isStretch && dir === 'row') {
|
|
371
|
+
const ph = node.layout.height;
|
|
372
|
+
if (ph && (ph === 'fill' || /^\d/.test(ph))) {
|
|
373
|
+
for (const child of node.children) {
|
|
374
|
+
if ((child.type === 'frame' || child.type === 'component')
|
|
375
|
+
&& child.layout?.positioning !== 'absolute'
|
|
376
|
+
&& !child.layout?.height) {
|
|
377
|
+
child.layout = child.layout || {};
|
|
378
|
+
child.layout.height = 'fill';
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
348
384
|
// children 재귀
|
|
349
385
|
if (node.children) {
|
|
350
386
|
node.children.forEach((child, i) => {
|
package/package.json
CHANGED