satoru-render 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -350,12 +350,12 @@ npx satoru-render input.html -f webp --verbose
350
350
  | :---------------- | :----------------------------------------- | :------------------------------------------------------ |
351
351
  | `value` | `string \| string[] \| HTMLElement \| ...` | HTML string, array of strings, or DOM element(s). |
352
352
  | `url` | `string` | URL to fetch HTML from. |
353
- | `width` | `number` | **Required.** Output width in pixels. |
354
- | `height` | `number` | Output height. Default: `0` (auto-calculate). |
353
+ | `width` | `number` | **Required.** Canvas width in pixels (used for layout). |
354
+ | `height` | `number` | Canvas height. Default: `0` (auto-calculate). |
355
355
  | `crop` | `{ x, y, width, height }` | Crop parameters to extract a specific region. |
356
- | `outputWidth` | `number` | Target output width when scaling the image. |
357
- | `outputHeight` | `number` | Target output height when scaling the image. |
358
- | `fit` | `"contain" \| "cover" \| "fill"` | Resizing behavior when output scale differs. |
356
+ | `outputWidth` | `number` | Output image width. Default: canvas/crop width. |
357
+ | `outputHeight` | `number` | Output image height. Default: canvas/crop height. |
358
+ | `fit` | `"contain" \| "cover" \| "fill"` | Fit strategy when canvas/crop size differs from output. |
359
359
  | `format` | `"svg" \| "png" \| "webp" \| "pdf"` | Output format. Default: `"svg"`. |
360
360
  | `resolveResource` | `ResourceResolver` | Async callback to fetch assets (fonts, images, CSS). |
361
361
  | `fonts` | `Object[]` | Pre-load fonts: `[{ name, data: Uint8Array }]`. |
package/dist/core.d.ts CHANGED
@@ -36,19 +36,28 @@ export interface ResolvedFontResult {
36
36
  }
37
37
  export type ResourceResolver = (resource: RequiredResource, defaultResolver: (resource: RequiredResource) => Promise<Uint8Array | ResolvedFontResult | null>) => Promise<Uint8Array | ArrayBufferView | ResolvedFontResult | null>;
38
38
  export interface RenderOptions {
39
+ /** Input content (HTML string or state object) */
39
40
  value?: string | string[] | any | any[];
41
+ /** Source URL */
40
42
  url?: string;
43
+ /** Canvas width for layout (used for CSS calculations) */
41
44
  width: number;
45
+ /** Canvas height for layout. If omitted, determined automatically by content height */
42
46
  height?: number;
47
+ /** Cropping options for the source canvas */
43
48
  crop?: {
44
49
  x: number;
45
50
  y: number;
46
51
  width: number;
47
52
  height: number;
48
53
  };
54
+ /** Final output image width. Defaults to width (or crop.width) */
49
55
  outputWidth?: number;
56
+ /** Final output image height. Defaults to height (or crop.height) */
50
57
  outputHeight?: number;
58
+ /** Resizing strategy to fit the canvas into the output size (default: "contain") */
51
59
  fit?: "contain" | "cover" | "fill";
60
+ /** Output format */
52
61
  format?: "svg" | "png" | "webp" | "pdf";
53
62
  textToPaths?: boolean;
54
63
  resolveResource?: ResourceResolver;
Binary file