Skip to content

Derive srcset and sizes from layout intent #744

Description

@romain-pm

Part of #734. The highest-leverage DevEx item: stop asking call sites to hand-write widths and sizes.

Today a module author must know srcset/sizes semantics, resource-vs-CSS pixels, and DPR to write widths={[300,600]} sizes="300px" — and get it right at every call site (13 in luxe, split into two undocumented conventions, one file explaining its reasoning; a missing sizes silently means 100vw and over-download).

Borrow Astro's layout: declare the intent, derive the rest.

layout candidates derived sizes
fixed (needs width) width, 2×width <width>px
constrained (needs width) breakpoints ≤ width, width, 2×width (min-width: <width>px) <width>px, 100vw
full-width configured breakpoints 100vw
  • layout on getImageProps and the component; default constrained.
  • Configurable breakpoint set with a sane default; candidates always clamped to the intrinsic width.
  • widths + sizes remain as the explicit escape hatch, not the primary API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featA new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions