(html: string)
| 289 | |
| 290 | // Generate Svelte component from the collected styles and HTML |
| 291 | function generateSvelteComponent(html: string): string { |
| 292 | // Build CSS classes similar to styled-components but for Svelte |
| 293 | const cssRules: string[] = []; |
| 294 | |
| 295 | Object.entries(cssCollection).forEach(([className, { styles }]) => { |
| 296 | if (!styles.length) return; |
| 297 | |
| 298 | // Always use class selector to avoid conflicts |
| 299 | cssRules.push( |
| 300 | `.${className} {\n ${styles.join(";\n ")}${styles.length ? ";" : ""}\n}`, |
| 301 | ); |
| 302 | }); |
| 303 | |
| 304 | return `${html} |
| 305 | |
| 306 | <style> |
| 307 | ${cssRules.join("\n\n")} |
| 308 | </style>`; |
| 309 | } |
| 310 | |
| 311 | export const htmlMain = async ( |
| 312 | sceneNode: Array<SceneNode>, |
no outgoing calls
no test coverage detected