You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Closeskychee-com/run402-private#414. Consumers that hand-build <picture>
markup (data-driven sites with app-specific data-* attrs on the wrapper)
couldn't reach decodeBlurhashToDataUri / averageColorFromBlurhash even
though dist/blurhash-decoder.js was already shipping — the exports map
omitted the entry. Add the subpath and a structural regression test.
Also extend ImageProps / RenderPictureOptions with an optional
pictureAttrs: Record<string, string> so renderPicture can stamp custom
attrs on the outer wrapper (lands on <picture> with variants, on <img>
in the sub-320 fallback). Keys are validated against
[a-zA-Z][a-zA-Z0-9-]*; values are HTML-attribute-escaped. This is the
preferred path — keeps consumers from reinventing the renderer just to
attach instrumentation.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
`renderPicture` produces the same `<picture>` HTML the static `<Image>` component does, with the same CLS-prevention contract (#4 in **Before you start**). No Vite or Astro runtime dependency — safe to import from any SSR / SSG / API-route module. It accepts any `AssetRef`, whether resolved from the manifest or read straight off a row, so the persistence pattern and the manifest pattern share the same renderer.
247
247
248
+
**Attaching app-specific attrs to the `<picture>` element (v0.2.5+).** Pass `pictureAttrs` to splice `data-*`, `id`, `role`, or any other HTML attribute onto the outer wrapper without forking the renderer:
Keys are validated against `[a-zA-Z][a-zA-Z0-9-]*` and silently dropped if invalid; values are HTML-attribute-escaped. When the source falls back to a single `<img>` (sub-320 / no variants), the attrs land on the `<img>` instead — the wrapper-most element either way.
261
+
262
+
**Decoding a blurhash on your own (v0.2.5+).** If you're emitting custom `<picture>` markup that bypasses `renderPicture` entirely, the LQIP helpers ship as a subpath export:
Both functions are pure over the blurhash string — no I/O, no Vite virtual modules, byte-equivalent to Wolt's `blurhash@2.0.5` reference (see `blurhash-decoder.test.ts`). Closes [run402-private#414](https://github.com/kychee-com/run402-private/issues/414).
272
+
248
273
**Combining both paths.** Set BOTH `assetsDir` and use `<Image>` for static-template images. The integration deduplicates by absolute path + CAS dedup at the gateway, so an image referenced via both paths uploads once.
249
274
250
275
### Reading the manifest during `astro build` (v0.2.4+)
@@ -338,6 +363,7 @@ For sources smaller than 320 pixels on either axis (logos, icons), the component
|`pictureAttrs`|`Record<string, string>`| — | v0.2.5+. Extra attributes on the outer `<picture>` (or fallback `<img>`). Keys must match `[a-zA-Z][a-zA-Z0-9-]*`; values escaped. |
0 commit comments