75 lines
2.4 KiB
Markdown
75 lines
2.4 KiB
Markdown
# OpenSpec Change: enterprise-react-image
|
|
|
|
- **Change ID**: enterprise-react-image
|
|
- **Package**: `@suaveplan/react-image`
|
|
- **Category**: react
|
|
- **Target path**: `react/media/react-image`
|
|
- **Status**: PROPOSED
|
|
- **Date**: 2026-04-24
|
|
- **Reference spec**: `/mnt/s/web/suaveplan/enterprise/react-image.md`
|
|
|
|
---
|
|
|
|
## Summary
|
|
|
|
Deliver `@suaveplan/react-image` on genesis from scratch at enterprise quality. Zero-external-runtime React image UI library: base `Image` (lazy, blurhash, skeleton, srcSet), `Avatar`/`AvatarGroup` (initials fallback, status), `ImageComparison` (slider), `ImageCropper` (drag handles), `ImageFilter` (CSS filter presets), `ImageGallery` (masonry), `ImageMagnifier`, `ImageOverlay`, `ImagePlaceholder`, `Lightbox` (thumbnails, controls), `ZoomImage`. Supporting hooks: `useImageLoader`, `useImagePreloader`, `useImageDimensions`, `useImageColor`, `useLightbox`. Utils: `blurhashToDataURL`, `decodeBlurhash`, `getFilterCSS`.
|
|
|
|
---
|
|
|
|
## Current-state audit (genesis)
|
|
|
|
Package does not exist on genesis — fresh build.
|
|
|
|
---
|
|
|
|
## Available workspace deps on genesis
|
|
|
|
| Package | Role |
|
|
|---|---|
|
|
| `@suaveplan/error` (`workspace:^`) | `ImageError` |
|
|
| `@suaveplan/react-translate` (`workspace:^`) | i18n |
|
|
| `zod` (`catalog:forms`) | Image config schemas |
|
|
| `@opentelemetry/api` (`catalog:observability`) | `image.load` span |
|
|
|
|
External: `tslib catalog:build`. React 18 peer.
|
|
|
|
---
|
|
|
|
## Public API surface
|
|
|
|
11 components, 5 hooks, 3 utils — all listed in Summary above.
|
|
|
|
---
|
|
|
|
## New additions for genesis
|
|
|
|
1. **`ImageError`** — codes: `IMAGE_LOAD_FAILED`, `IMAGE_DECODE_FAILED`, `IMAGE_CROP_INVALID`.
|
|
2. **OTel `image.load` span** — attributes: `image.src`, `image.format`.
|
|
3. **Stories** — every component with default, loading, error, interactive, playground.
|
|
4. **Playwright E2E** — `Image` lazy-loads on scroll; `ImageCropper` drag handles; `Lightbox` keyboard navigation.
|
|
|
|
---
|
|
|
|
## File layout
|
|
|
|
```text
|
|
react/media/react-image/
|
|
package.json
|
|
tsconfig.json
|
|
vitest.config.ts
|
|
src/
|
|
index.ts
|
|
components/
|
|
image/ avatar/ image-comparison/ image-cropper/
|
|
image-filter/ image-gallery/ image-magnifier/
|
|
image-overlay/ image-placeholder/ lightbox/ zoom-image/
|
|
hooks/
|
|
use-image-loader/ use-image-preloader/ use-image-dimensions/
|
|
use-image-color/ use-lightbox/
|
|
utils/
|
|
blurhash/ filter-presets/
|
|
types/
|
|
e2e/
|
|
image.spec.ts
|
|
```
|