The Coline design system: accessible React components for Coline Apps, themed live by the host workspace, and for Coline Sites in light and dark. Tailwind v4 stylesheet included. MIT.
| import { dirname, join } from "node:path"; |
| 6 |
| 7 | const here = dirname(fileURLToPath(import.meta.url)); |
| 8 | // The sandbox CSP allows only data: fonts, so a relative font URL can never |
| 9 | // load there. Apps embed Geist as a data URI through their own |
| 10 | // `@colineapp/ui/styles.css` import (the CLI inlines it); drop the host copy. |
| 11 | const css = readFileSync(join(here, "../dist/styles.css"), "utf8").replace( |
| 12 | /@font-face\{[^}]*url\(\.\/fonts\/[^)]*\)[^}]*\}/g, |
| 13 | "", |
| 14 | ); |
| 15 | if (/url\(\.\/fonts\//.test(css)) { |
| 16 | throw new Error("A relative font URL survived; update the @font-face pattern."); |
| 17 | } |
| 18 | const out = `// GENERATED by \`pnpm --filter @colineapp/ui build:css\` + scripts/sync-sandbox-styles.mjs. |
| 19 | // The @colineapp/ui stylesheet served inline by the tier-2 sandbox shell |
| 20 | // (plan §7.2.5). Regenerate when the UI package styles change. |
| 21 |
| 22 | export const SANDBOX_STYLES_CSS: string = ${JSON.stringify(css)}; |
| 23 | `; |
| 24 | writeFileSync( |
| 25 | join(here, "../../../apps/web/src/lib/apps/sandbox-styles.generated.ts"), |
| 26 | out, |
| 27 | ); |
| 28 | console.log("sandbox styles synced"); |
| 29 |