@pixelfiddler/react 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +33 -30
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -12,16 +12,16 @@ pnpm add @pixelfiddler/react
12
12
  yarn add @pixelfiddler/react
13
13
  ```
14
14
 
15
- **Note:** This package requires `react` >= 18.0.0 as a peer dependency.
15
+ **Note:** This package requires `react` >= 18.2.0 as a peer dependency.
16
16
 
17
17
  ## Quick Start
18
18
 
19
19
  ```tsx
20
- import { PixelFiddleImage } from '@pixelfiddler/react';
20
+ import { PixelFiddlerImage } from '@pixelfiddler/react';
21
21
 
22
22
  function App() {
23
23
  return (
24
- <PixelFiddleImage
24
+ <PixelFiddlerImage
25
25
  src="https://example.com/photo.jpg"
26
26
  alt="A beautiful photo"
27
27
  width={800}
@@ -33,15 +33,15 @@ function App() {
33
33
 
34
34
  ## Components
35
35
 
36
- ### `PixelFiddleImage`
36
+ ### `PixelFiddlerImage`
37
37
 
38
38
  A drop-in replacement for the `<img>` element that automatically generates optimized `srcSet` for responsive images.
39
39
 
40
40
  ```tsx
41
- import { PixelFiddleImage } from '@pixelfiddler/react';
41
+ import { PixelFiddlerImage } from '@pixelfiddler/react';
42
42
 
43
43
  // Fixed-width image with DPR support (x descriptors)
44
- <PixelFiddleImage
44
+ <PixelFiddlerImage
45
45
  src="https://example.com/photo.jpg"
46
46
  alt="Profile photo"
47
47
  width={400}
@@ -49,7 +49,7 @@ import { PixelFiddleImage } from '@pixelfiddler/react';
49
49
  // Generates: srcset="...?w=640 1x, ...?w=828 2x"
50
50
 
51
51
  // Fluid/responsive image (w descriptors)
52
- <PixelFiddleImage
52
+ <PixelFiddlerImage
53
53
  src="https://example.com/photo.jpg"
54
54
  alt="Hero image"
55
55
  sizes="(max-width: 768px) 100vw, 50vw"
@@ -61,30 +61,30 @@ import { PixelFiddleImage } from '@pixelfiddler/react';
61
61
 
62
62
  | Prop | Type | Default | Description |
63
63
  |------|------|---------|-------------|
64
- | `src` | `string` | **required** | Base URL of the image |
64
+ | `src` | `string` | **required** | URL of the image (relative or absolute). Relative paths are attached to `baseUrl` |
65
65
  | `alt` | `string` | - | Alt text (required for accessibility) |
66
+ | `baseUrl` | `string` | - | Base URL endpoint from PixelFiddler Dashboard. Can be set via `PixelFiddlerProvider` or passed directly |
66
67
  | `width` | `number \| string` | - | Display width in CSS pixels. Generates DPR descriptors (`1x`, `2x`) |
67
- | `sizes` | `string` | - | Sizes attribute for responsive images. Generates width descriptors (`w`) |
68
+ | `sizes` | `string` | - | Sizes attribute for responsive images. Generates width descriptors (`w`). Required if no fixed width is provided |
68
69
  | `transformations` | `TransformationOptions` | - | Image transformation options |
69
- | `responsive` | `boolean` | `true` | Enable automatic srcSet generation |
70
- | `deviceBreakpoints` | `number[]` | `[320, 375, 640, 768, 1024, 1280, 1536, 1920]` | Breakpoints for viewport-based sizing |
71
- | `imageBreakpoints` | `number[]` | `[16, 32, 48, 64, 96, 128, 256, 384]` | Breakpoints for smaller images |
72
- | `config` | `UrlBuilderConfig` | - | Override provider config for this image |
70
+ | `responsive` | `boolean` | `true` | Enable automatic srcSet generation. Ignored if `transformations.width` is set |
71
+ | `deviceBreakpoints` | `number[]` | - | Custom device breakpoints for responsive srcset |
72
+ | `imageBreakpoints` | `number[]` | - | Custom image breakpoints for smaller images |
73
73
 
74
74
  All standard `<img>` attributes (`className`, `loading`, `decoding`, etc.) are also supported.
75
75
 
76
76
  ### `PixelFiddlerProvider`
77
77
 
78
- A context provider for sharing configuration across all `PixelFiddleImage` components.
78
+ A context provider for sharing configuration across all `PixelFiddlerImage` components.
79
79
 
80
80
  ```tsx
81
- import { PixelFiddlerProvider, PixelFiddleImage } from '@pixelfiddler/react';
81
+ import { PixelFiddlerProvider, PixelFiddlerImage } from '@pixelfiddler/react';
82
82
 
83
83
  function App() {
84
84
  return (
85
85
  <PixelFiddlerProvider config={{ baseUrl: 'https://cdn.example.com' }}>
86
- <PixelFiddleImage src="/photos/hero.jpg" alt="Hero" sizes="100vw" />
87
- <PixelFiddleImage src="/photos/thumb.jpg" alt="Thumbnail" width={200} />
86
+ <PixelFiddlerImage src="/photos/hero.jpg" alt="Hero" sizes="100vw" />
87
+ <PixelFiddlerImage src="/photos/thumb.jpg" alt="Thumbnail" width={200} />
88
88
  </PixelFiddlerProvider>
89
89
  );
90
90
  }
@@ -94,7 +94,7 @@ function App() {
94
94
 
95
95
  | Prop | Type | Description |
96
96
  |------|------|-------------|
97
- | `config` | `PixelFiddlerConfig` | Configuration object with `baseUrl` and optional `signatureKey` |
97
+ | `config` | `PixelFiddlerConfig` | Configuration object with `baseUrl` and optional `maxDpr` |
98
98
  | `children` | `ReactNode` | Child components |
99
99
 
100
100
  ## Usage Examples
@@ -102,7 +102,7 @@ function App() {
102
102
  ### Basic Transformations
103
103
 
104
104
  ```tsx
105
- <PixelFiddleImage
105
+ <PixelFiddlerImage
106
106
  src="https://example.com/photo.jpg"
107
107
  alt="Transformed image"
108
108
  responsive={false}
@@ -120,7 +120,7 @@ function App() {
120
120
  When you know the exact display size, use `width` to generate DPR variants:
121
121
 
122
122
  ```tsx
123
- <PixelFiddleImage
123
+ <PixelFiddlerImage
124
124
  src="https://example.com/avatar.jpg"
125
125
  alt="User avatar"
126
126
  width={150}
@@ -136,7 +136,7 @@ When you know the exact display size, use `width` to generate DPR variants:
136
136
  For images that scale with the viewport, use `sizes`:
137
137
 
138
138
  ```tsx
139
- <PixelFiddleImage
139
+ <PixelFiddlerImage
140
140
  src="https://example.com/hero.jpg"
141
141
  alt="Hero banner"
142
142
  sizes="(max-width: 768px) 100vw, (max-width: 1200px) 50vw, 800px"
@@ -148,7 +148,7 @@ For images that scale with the viewport, use `sizes`:
148
148
  ### Custom Breakpoints
149
149
 
150
150
  ```tsx
151
- <PixelFiddleImage
151
+ <PixelFiddlerImage
152
152
  src="https://example.com/photo.jpg"
153
153
  alt="Custom breakpoints"
154
154
  sizes="100vw"
@@ -160,7 +160,7 @@ For images that scale with the viewport, use `sizes`:
160
160
  ### Disable Responsive Behavior
161
161
 
162
162
  ```tsx
163
- <PixelFiddleImage
163
+ <PixelFiddlerImage
164
164
  src="https://example.com/photo.jpg"
165
165
  alt="Non-responsive"
166
166
  responsive={false}
@@ -172,7 +172,7 @@ For images that scale with the viewport, use `sizes`:
172
172
  ### With Standard Image Attributes
173
173
 
174
174
  ```tsx
175
- <PixelFiddleImage
175
+ <PixelFiddlerImage
176
176
  src="https://example.com/photo.jpg"
177
177
  alt="Lazy loaded image"
178
178
  width={600}
@@ -199,14 +199,17 @@ Full TypeScript support with exported types:
199
199
  ```typescript
200
200
  import type {
201
201
  PixelFiddlerImageProps,
202
- PixelFiddlerProviderProps,
203
- } from '@pixelfiddler/react';
204
-
205
- import type {
202
+ PixelFiddlerContextValue,
206
203
  TransformationOptions,
207
- UrlBuilderConfig,
204
+ ResizeOptions,
205
+ FormatOptions,
206
+ EffectOptions,
207
+ CropOptions,
208
+ BorderOptions,
209
+ TextOptions,
210
+ WatermarkOptions,
208
211
  PixelFiddlerConfig,
209
- } from '@pixelfiddler/core';
212
+ } from '@pixelfiddler/react';
210
213
  ```
211
214
 
212
215
  ## Related
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pixelfiddler/react",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "React components for PixelFiddler image transformation SDK",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -22,10 +22,10 @@
22
22
  "dist"
23
23
  ],
24
24
  "dependencies": {
25
- "@pixelfiddler/core": "1.0.0"
25
+ "@pixelfiddler/core": "1.0.1"
26
26
  },
27
27
  "peerDependencies": {
28
- "react": ">=18.0.0"
28
+ "react": ">=18.2.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@testing-library/react": "^16.3.2",