(settings: TailwindSettings)
| 46 | |
| 47 | const convertNode = |
| 48 | (settings: TailwindSettings) => |
| 49 | async (node: SceneNode): Promise<string> => { |
| 50 | if (settings.embedVectors && (node as any).canBeFlattened) { |
| 51 | const altNode = await renderAndAttachSVG(node); |
| 52 | if (altNode.svg) { |
| 53 | return tailwindWrapSVG(altNode, settings); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | switch ((node as any).type) { |
| 58 | case "RECTANGLE": |
| 59 | case "ELLIPSE": |
| 60 | return tailwindContainer(node, "", "", settings); |
| 61 | case "GROUP": |
| 62 | return tailwindGroup(node, settings); |
| 63 | case "FRAME": |
| 64 | case "COMPONENT": |
| 65 | case "INSTANCE": |
| 66 | case "COMPONENT_SET": |
| 67 | case "SLOT": |
| 68 | return tailwindFrame(node, settings); |
| 69 | case "TEXT": |
| 70 | return tailwindText(node, settings); |
| 71 | case "LINE": |
| 72 | return tailwindLine(node, settings); |
| 73 | case "SECTION": |
| 74 | return tailwindSection(node, settings); |
| 75 | case "VECTOR": |
| 76 | if (!settings.embedVectors) { |
| 77 | addWarning("Vector is not supported"); |
| 78 | } |
| 79 | return tailwindContainer( |
| 80 | { ...node, type: "RECTANGLE" } as any, |
| 81 | "", |
| 82 | "", |
| 83 | settings, |
| 84 | ); |
| 85 | default: |
| 86 | addWarning(`${node.type} node is not supported`); |
| 87 | } |
| 88 | return ""; |
| 89 | }; |
| 90 | |
| 91 | const tailwindWrapSVG = ( |
| 92 | node: AltNode<SceneNode>, |
no test coverage detected