(settings: HTMLSettings)
| 386 | }; |
| 387 | |
| 388 | const convertNode = (settings: HTMLSettings) => async (node: SceneNode) => { |
| 389 | if (settings.embedVectors && (node as any).canBeFlattened) { |
| 390 | const altNode = await renderAndAttachSVG(node); |
| 391 | if (altNode.svg) { |
| 392 | return htmlWrapSVG(altNode, settings); |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | switch ((node as any).type) { |
| 397 | case "RECTANGLE": |
| 398 | case "ELLIPSE": |
| 399 | return await htmlContainer(node, "", [], settings); |
| 400 | case "GROUP": |
| 401 | return await htmlGroup(node, settings); |
| 402 | case "FRAME": |
| 403 | case "COMPONENT": |
| 404 | case "INSTANCE": |
| 405 | case "COMPONENT_SET": |
| 406 | case "SLOT": |
| 407 | return await htmlFrame(node, settings); |
| 408 | case "SECTION": |
| 409 | return await htmlSection(node, settings); |
| 410 | case "TEXT": |
| 411 | return htmlText(node, settings); |
| 412 | case "LINE": |
| 413 | return htmlLine(node, settings); |
| 414 | case "VECTOR": |
| 415 | if (!settings.embedVectors && !isPreviewGlobal) { |
| 416 | addWarning("Vector is not supported"); |
| 417 | } |
| 418 | return await htmlContainer( |
| 419 | { ...node, type: "RECTANGLE" } as any, |
| 420 | "", |
| 421 | [], |
| 422 | settings, |
| 423 | ); |
| 424 | default: |
| 425 | addWarning(`${node.type} node is not supported`); |
| 426 | return ""; |
| 427 | } |
| 428 | }; |
| 429 | |
| 430 | const htmlWrapSVG = ( |
| 431 | node: AltNode<SceneNode>, |
no test coverage detected