@sangheepark/figma-ds-mcp 0.2.9 → 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.
@@ -168,12 +168,51 @@ function enrichSpec(traversal, mapping) {
168
168
  node['overrides'] = overrides;
169
169
  }
170
170
  }
171
- // _overrides → overrides에 병합
171
+ // _overrides → overrides에 병합 (property name resolution 포함)
172
172
  if (node._overrides) {
173
173
  const existing = node['overrides'];
174
- node['overrides'] = { ...existing, ...node._overrides };
174
+ const resolved = { ...existing };
175
+ for (const [key, value] of Object.entries(node._overrides)) {
176
+ if (component.properties && key in component.properties) {
177
+ // exact property name match
178
+ resolved[key] = value;
179
+ }
180
+ else if (component.properties) {
181
+ // case-insensitive match
182
+ const ciMatch = Object.keys(component.properties).find(p => p.toLowerCase() === key.toLowerCase());
183
+ if (ciMatch) {
184
+ resolved[ciMatch] = value;
185
+ }
186
+ else if (typeof value === 'string') {
187
+ // TEXT property auto-map (단일 TEXT prop이면 자동 매핑)
188
+ const textProps = Object.entries(component.properties)
189
+ .filter(([, type]) => type === 'TEXT')
190
+ .map(([name]) => name);
191
+ if (textProps.length === 1) {
192
+ resolved[textProps[0]] = value;
193
+ }
194
+ else {
195
+ resolved[key] = value; // 매핑 실패 → 원본 유지
196
+ }
197
+ }
198
+ else {
199
+ resolved[key] = value;
200
+ }
201
+ }
202
+ else {
203
+ resolved[key] = value;
204
+ }
205
+ }
206
+ node['overrides'] = resolved;
175
207
  delete node._overrides;
176
208
  }
209
+ // variant-props → variant string 변환 (빌드 시스템 형식)
210
+ const vp = node['variant-props'];
211
+ if (vp && Object.keys(vp).length > 0) {
212
+ const variantStr = Object.entries(vp).map(([k, v]) => `${k}=${v}`).join(', ');
213
+ node['variant'] = variantStr;
214
+ delete node['variant-props'];
215
+ }
177
216
  delete node._ds;
178
217
  delete node._ds_props;
179
218
  }
@@ -306,6 +345,42 @@ function enrichSpec(traversal, mapping) {
306
345
  node.layout.y = '0';
307
346
  }
308
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
+ }
309
384
  // children 재귀
310
385
  if (node.children) {
311
386
  node.children.forEach((child, i) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sangheepark/figma-ds-mcp",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "MCP server for Code to Figma Bridge — bridges Claude Code to Figma plugin via WebSocket",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",