( node: SceneNode, stack: string = "", )
| 105 | // properties named propSomething always take care of "," |
| 106 | // sometimes a property might not exist, so it doesn't add "," |
| 107 | export const swiftuiContainer = ( |
| 108 | node: SceneNode, |
| 109 | stack: string = "", |
| 110 | ): string => { |
| 111 | // ignore the view when size is zero or less |
| 112 | // while technically it shouldn't get less than 0, due to rounding errors, |
| 113 | // it can get to values like: -0.000004196293048153166 |
| 114 | if (node.width < 0 || node.height < 0) { |
| 115 | return stack; |
| 116 | } |
| 117 | |
| 118 | let kind = ""; |
| 119 | if (node.type === "RECTANGLE" || node.type === "LINE") { |
| 120 | kind = "Rectangle()"; |
| 121 | } else if (node.type === "ELLIPSE") { |
| 122 | kind = "Ellipse()"; |
| 123 | } else { |
| 124 | kind = stack; |
| 125 | } |
| 126 | |
| 127 | const result = new SwiftuiDefaultBuilder(kind) |
| 128 | .shapeForeground(node) |
| 129 | .autoLayoutPadding(node) |
| 130 | .size(node) |
| 131 | .shapeBackground(node) |
| 132 | .cornerRadius(node) |
| 133 | .shapeBorder(node) |
| 134 | .commonPositionStyles(node) |
| 135 | .effects(node) |
| 136 | .build(kind === stack ? -2 : 0); |
| 137 | |
| 138 | return result; |
| 139 | }; |
| 140 | |
| 141 | const swiftuiGroup = ( |
| 142 | node: GroupNode | SectionNode, |
no test coverage detected