# What changed in d3-cloud

> 39 changes in d3-cloud 1 to 2 from its official release notes, upgrade guides and advisories: 21 breaking, 1 security, 7 new APIs and options. Each one cited. Sources checked 2026-10-30. HTML: https://unstale.sh/npm/d3-cloud/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## d3-cloud 2

### Breaking changes

- Invalid arguments now throw instead of being silently replaced, including invalid coordinates, dimensions, padding, random functions, fonts, and canvases. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- Both built-in spirals stretch to the aspect ratio only up to 64:1, changing layouts with more extreme aspect ratios. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- clear() throws while place() is searching rather than corrupting masks or occupancy. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- The event-driven factory API is replaced with the class-based CloudLayout API. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- The class-based API introduces CloudSprite in place of the old event-driven factory API. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- Custom data is carried by a single datum option, stored by reference on sprites and placed words; other option fields are ignored rather than copied. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- The default font size is now 1 instead of sqrt(value); set styling explicitly. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- The default rotation is now zero instead of a random multiple of 30 degrees. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- The package is ESM-only; the old Browserify and CommonJS distribution shapes are removed. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- getSprite() throws if called while a sprite is being drawn to the same canvas. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- Input word objects are no longer mutated; placement returns separate plain words and callers control word ordering. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- The minimum Node.js version is now 20. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- The rectangular strategy visits every point of a 4-pixel grid in aspect-ratio-shaped rings, producing denser packing at any aspect ratio. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- Search limits scale with the number of possible placement positions and apply equally to built-in and custom strategies. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- size([width, height]) now defines the centered layout box; layouts may grow beyond it. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- The old spiral() API is replaced with strategy(). (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- Padding uses round stroke joins, extending exactly padding pixels from glyph outlines instead of up to ten times that at sharp corners. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- Text rasters use measured ink bounds, account for overhang and accents, redraw when ink reaches the edge, and use centered text alignment. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- The UMD/script-tag build and d3.layout.cloud global are removed; browser scripts must use ESM imports. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)

### Security

- Placement uses a private copy of each sprite mask and accepts only sprites created by getSprite(), preventing changed or forged sprites from corrupting a layout. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)

### New APIs and options

- erase() erases a word returned by place(). (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- CloudLayout.getSprite(...) explicitly prepares immutable sprites that have no position and can be placed repeatedly. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- Sprites can be extracted from image alpha masks, with optional resizing; images without intrinsic dimensions can be drawn at explicit dimensions. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- A built-in noneStrategy provides single-attempt placement. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- overflow(true | false) controls whether placement may extend beyond the layout box. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- place() lets callers control placement using sprites created by getSprite(). (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- Sparse packed block placement supports effectively unbounded layouts. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)

### Behavior and default changes

- Image sources may be images, videos, canvases, or ImageBitmaps, including node-canvas, and placed words retain the source type. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- Placement tries the seed first, then searches from the nearest possible touch position, skipping positions that cannot fit without collision checks. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- Image coordinates mark the sprite center, and text is rendered from x and y with a centered horizontal anchor. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- Layouts may share a scratch canvas; a failed draw or readback makes layouts using it request a canvas from their factory again. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)

### Tooling

- datum is typed generically and inferred from getSprite() options. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- The package now includes TypeScript declarations for both the package entry and build/d3-cloud.js. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)

### Fixes and other changes

- blockSize() throws while place() is searching rather than corrupting masks or occupancy. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)
- Sprite geometry is trimmed to occupied pixels independently of packed row alignment, preventing bounded layouts from rejecting words because of raster slack. (2.0.0) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v2.0.0)

## d3-cloud 1

### Breaking changes

- The Bower manifest was removed. (1.2.9) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v1.2.9)
- The Tea configuration file was removed. (1.2.9) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v1.2.9)

### Behavior and default changes

- The browser bundle now includes the 1.2.8 change to default rotations, so its rotation behavior is updated. (1.2.9) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v1.2.9)
- Default rotation now uses the layout's random() function, making rotations reproducible with a seeded random number generator. (1.2.8) — [release notes](https://github.com/jasondavies/d3-cloud/releases/tag/v1.2.8)
