Skip to content

Commit fd77139

Browse files
committed
Debug
1 parent 672ad5c commit fd77139

6 files changed

Lines changed: 30 additions & 49 deletions

File tree

apps/plugin/plugin-src/code.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,7 @@ const standardMode = async () => {
198198
}
199199

200200
try {
201-
result.newConversion = await convertNodesToAltNodes(
202-
result.json || [],
203-
null,
204-
);
201+
result.newConversion = await nodesToJSON(nodes, userPluginSettings);
205202
} catch (error) {
206203
console.error("Error in new conversion:", error);
207204
}

packages/backend/src/code.ts

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -187,39 +187,19 @@ const processNodePair = async (
187187
? cleanName
188188
: `${cleanName}_${count.toString().padStart(2, "0")}`;
189189

190-
// Check if we need to handle gradients
191-
const hasGradient = GRADIENT_PROPERTIES.some((propName) => {
190+
GRADIENT_PROPERTIES.forEach((propName) => {
192191
const property = jsonNode[propName];
193-
return (
192+
if (
193+
propName in figmaNode &&
194194
property &&
195-
Array.isArray(property) &&
196-
property.length > 0 &&
197-
property.some(
198-
(item: any) => item.type && item.type.startsWith("GRADIENT_"),
199-
)
200-
);
195+
property.some((item: any) => item.type.startsWith("GRADIENT_"))
196+
) {
197+
jsonNode[propName] = JSON.parse(
198+
JSON.stringify((figmaNode as any)[propName]),
199+
);
200+
}
201201
});
202202

203-
// Handle gradients
204-
if (hasGradient) {
205-
GRADIENT_PROPERTIES.forEach((propName) => {
206-
const property = jsonNode[propName];
207-
if (
208-
property &&
209-
Array.isArray(property) &&
210-
property.length > 0 &&
211-
property.some(
212-
(item) => item.type && item.type.startsWith("GRADIENT_"),
213-
) &&
214-
propName in figmaNode
215-
) {
216-
jsonNode[propName] = JSON.parse(
217-
JSON.stringify((figmaNode as any)[propName]),
218-
);
219-
}
220-
});
221-
}
222-
223203
// Handle text-specific properties
224204
if (figmaNode.type === "TEXT") {
225205
const getSegmentsStart = Date.now();
@@ -376,7 +356,7 @@ const processNodePair = async (
376356
jsonNode.children[i],
377357
figmaNode.children[i],
378358
settings,
379-
jsonNode, // Pass the current node as parent for its children
359+
jsonNode,
380360
);
381361
}
382362

packages/backend/src/html/builderImpl/htmlBorderRadius.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,29 @@ import { getCommonRadius } from "../../common/commonRadius";
22
import { formatWithJSX } from "../../common/parseJSX";
33

44
export const htmlBorderRadius = (node: SceneNode, isJsx: boolean): string[] => {
5+
let comp: string[] = [];
6+
7+
if (
8+
"children" in node &&
9+
node.children.length > 0 &&
10+
"clipsContent" in node &&
11+
node.clipsContent === true
12+
) {
13+
comp.push(formatWithJSX("overflow", isJsx, "hidden"));
14+
}
15+
516
if (node.type === "ELLIPSE") {
6-
return [formatWithJSX("border-radius", isJsx, 9999)];
17+
comp.push(formatWithJSX("border-radius", isJsx, 9999));
18+
return comp;
719
}
820

921
const radius = getCommonRadius(node);
1022

11-
let comp: string[] = [];
1223
let singleCorner: number = 0;
1324

1425
if ("all" in radius) {
1526
if (radius.all === 0) {
16-
return [];
27+
return comp;
1728
}
1829
singleCorner = radius.all;
1930
comp.push(formatWithJSX("border-radius", isJsx, radius.all));
@@ -41,14 +52,6 @@ export const htmlBorderRadius = (node: SceneNode, isJsx: boolean): string[] => {
4152
}
4253
}
4354

44-
if (
45-
"children" in node &&
46-
"clipsContent" in node &&
47-
node.children.length > 0 &&
48-
node.clipsContent === true
49-
) {
50-
comp.push(formatWithJSX("overflow", isJsx, "hidden"));
51-
}
52-
55+
console.log("comp was", comp);
5356
return comp;
5457
};

packages/backend/src/html/htmlDefaultBuilder.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,6 @@ export class HtmlDefaultBuilder {
262262
position(): this {
263263
const { node, optimizeLayout, isJSX } = this;
264264
const isAbsolutePosition = commonIsAbsolutePosition(node, optimizeLayout);
265-
console.log("node is absolute", isAbsolutePosition, node, node.parent);
266265
if (isAbsolutePosition) {
267266
const { x, y } = getCommonPositionValue(node);
268267

packages/backend/src/tailwind/builderImpl/tailwindBorder.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,6 @@ export const tailwindBorderWidth = (
6767

6868
// Check stroke alignment and layout mode
6969
const strokeAlign = "strokeAlign" in node ? node.strokeAlign : "INSIDE";
70-
const layoutMode = "layoutMode" in node ? node.layoutMode : "NONE";
7170

7271
if ("all" in commonBorder) {
7372
if (commonBorder.all === 0) {

packages/backend/src/tailwind/tailwindMain.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,10 @@ const tailwindFrame = async (
179179
);
180180
const childrenStr = await tailwindWidgetGenerator(sortedChildren, settings);
181181

182-
const clipsContentClass = node.clipsContent ? "overflow-hidden" : "";
182+
const clipsContentClass =
183+
node.clipsContent && "children" in node && node.children.length > 0
184+
? "overflow-hidden"
185+
: "";
183186
let layoutProps = "";
184187

185188
if (node.layoutMode !== "NONE") {

0 commit comments

Comments
 (0)