)
}
]
});
```
### 3. Edge / Framework Integration (`ImageResponse`)
A next/og compatible handler designed for Edge runtimes, Cloudflare Workers, Next.js API endpoints, and standard HTTP server frameworks.
```typescript
import { ImageResponse } from "takumi-js/response";
export function GET() {
return new ImageResponse(
Dynamic OG Card
,
{
width: 1200,
height: 630
}
);
}
```
### 4. Parsing Helpers (`takumi-js/helpers/*`)
Low-level utilities for compiling layout elements without executing the full renderer.
```typescript
import { fromHtml } from "takumi-js/helpers/html";
import { fromJsx } from "takumi-js/helpers/jsx";
// Converts raw HTML template string into JSON layout node tree
const htmlNodeTree = fromHtml(
"
Hello
",
{ max_depth: 512 }
);
// Compiles React ReactNode elements into JSON layout node tree
const jsxNodeTree = fromJsx(
Hello
);
```
---
## Options Configuration (`RenderOptions`)
- `fonts`: An array of custom fonts `[{ name, url, weight, style }]`. Values can point to remote URLs (WOFF2/WOFF/TTF), local file paths, or binary Node.js `Buffer` arrays.
- `emoji`: Configures the emoji fallback strategy: `"twemoji"` (default), `"blob-emoji"`, `"openmoji"`, `"noto-emoji"`, or `"from-font"` (uses custom loaded font glyphs).
- `images`: Option to pass pre-fetched image arrays `[{ url, buffer }]` or supply a shared caching fetch-client configuration.
- `stylesheets`: An array of raw global CSS string sheets to inject into the rendering layout context.
---
## Hidden Layout Capabilities (Deep-Dive)
### 1. Auto-scaling Text (`text-fit`)
Automatically scales font-size to fit the containing inline line-box width, avoiding clipping or wrapping.
- **Syntax**: `text-fit: [ none | grow | shrink ] [ consistent | per-line | per-line-all ]? [percentage]?`
- **Example**: `tw="text-fit-grow-consistent"` or `style={{ textFit: "grow consistent 120%" }}`.
### 2. CSS Motion Paths (`offset-path`)
Enables complex placement and animation sequences of elements along custom vector paths or geometric rays.
- **Properties**: `offset-path`, `offset-distance` (percentage), `offset-rotate` (angle / auto).
- **Syntax**: `ray( contain? at ?)` or `path("