Skip to content

Commit 633a09c

Browse files
tinchox5claude
andcommitted
fix(types): drop phantom snapdom.toJpeg(), add clip option, document outer* defaults
The static snapdom namespace only ever defined toJpg (see src/api/snapdom.js) — the .d.ts declared a toJpeg() that doesn't exist at runtime. Also documents the missing `clip` option (shipped in context.js) and the actual default values for outerTransforms/outerShadows, which the JSDoc omitted. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
1 parent e69f51b commit 633a09c

1 file changed

Lines changed: 11 additions & 9 deletions

File tree

types/snapdom.d.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,22 @@ export interface SnapdomOptions {
8989
*/
9090
reconcile?: boolean;
9191

92-
/** outerTransforms the root: remove translate/rotate, keep scale/skew. */
92+
/** outerTransforms the root: remove translate/rotate, keep scale/skew. Default true. */
9393
outerTransforms?: boolean;
9494
/**
95-
* Do not expand root bbox for shadows/blur/outline; also strip shadows/outline
96-
* from the cloned root to get a tight capture box.
95+
* Expand root bbox for shadows/blur/outline instead of stripping them from the
96+
* cloned root. Default false (root shadows/outline are stripped, blur bleed is
97+
* still included).
9798
*/
9899
outerShadows?: boolean;
99100

101+
/**
102+
* Capture only a region instead of the full element: `'viewport'` (what the user
103+
* currently sees) or a page-coordinate rect. Offscreen subtrees are pruned before
104+
* styling/inlining, so this is faster than a full capture. Default null (no clip).
105+
*/
106+
clip?: "viewport" | { x: number; y: number; width: number; height: number } | null;
107+
100108
/**
101109
* Downsample inlined raster images to their visible resolution (display box × scale × dpr),
102110
* preserving the source codec (lossless PNG stays lossless). On by default; pass `false`
@@ -397,12 +405,6 @@ export declare namespace snapdom {
397405
options?: SnapdomOptions
398406
): Promise<HTMLImageElement>;
399407

400-
function toJpeg(
401-
element: Element,
402-
options?: SnapdomOptions
403-
): Promise<HTMLImageElement>;
404-
405-
/** Alias for `toJpeg`. */
406408
function toJpg(
407409
element: Element,
408410
options?: SnapdomOptions

0 commit comments

Comments
 (0)