point-focus 1.0.4 → 1.0.5
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.
- package/README.md +53 -57
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
- **TypeScript** – Safer development
|
|
21
21
|
- **SCSS Modules** – Scoped styling
|
|
22
22
|
|
|
23
|
-
**Requirements:**
|
|
23
|
+
**Requirements:**
|
|
24
|
+
|
|
24
25
|
- React 17+
|
|
25
26
|
- Node.js with npm or yarn
|
|
26
27
|
|
|
@@ -38,64 +39,58 @@ yarn add point-focus
|
|
|
38
39
|
import ImageMagnifier from 'point-focus'
|
|
39
40
|
|
|
40
41
|
function Example() {
|
|
41
|
-
return
|
|
42
|
-
<ImageMagnifier
|
|
43
|
-
src="/images/sample.jpg"
|
|
44
|
-
zoomSrc="/images/sample-large.jpg"
|
|
45
|
-
moveType="drag"
|
|
46
|
-
zoomType="click"
|
|
47
|
-
alt='Image alt'
|
|
48
|
-
zoomScale={2}
|
|
49
|
-
/>
|
|
50
|
-
)
|
|
42
|
+
return <ImageMagnifier src='/images/sample.jpg' zoomSrc='/images/sample-large.jpg' moveType='drag' zoomType='click' alt='Image alt' zoomScale={2} />
|
|
51
43
|
}
|
|
52
44
|
```
|
|
53
45
|
|
|
54
46
|
## 🔧 Props Overview
|
|
55
47
|
|
|
56
|
-
| Prop
|
|
57
|
-
|
|
58
|
-
| `src`
|
|
59
|
-
| `zoomSrc`
|
|
60
|
-
| `sources`
|
|
61
|
-
| `width` / `height`
|
|
62
|
-
| `zoomScale`
|
|
63
|
-
| `zoomPreload`
|
|
64
|
-
| `fadeDuration`
|
|
65
|
-
| `moveType`
|
|
66
|
-
| `zoomType`
|
|
67
|
-
| `clickToZoomOut`
|
|
68
|
-
| `hideCloseButton`
|
|
69
|
-
| `alt`
|
|
70
|
-
| `tabIndex`
|
|
71
|
-
| `containerClassName`
|
|
72
|
-
| `baseImageClassName`
|
|
73
|
-
| `zoomImageClassName`
|
|
74
|
-
| `closeButtonClassName`
|
|
75
|
-
| `containerAriaLabel`
|
|
76
|
-
| `zoomImageAriaLabel`
|
|
77
|
-
| `closeButtonAriaLabel`
|
|
78
|
-
| `closeButtonContent`
|
|
79
|
-
| `overlay`
|
|
80
|
-
| `loadingPlaceholder`
|
|
81
|
-
| `
|
|
82
|
-
| `
|
|
83
|
-
| `
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
| `
|
|
87
|
-
| `
|
|
88
|
-
| `
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
91
|
-
| `
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
48
|
+
| Prop | Type | Default | Description |
|
|
49
|
+
| ---------------------- | ------------------------ | ------------ | -------------------------------------- |
|
|
50
|
+
| `src` | `string` | — (required) | Main image source |
|
|
51
|
+
| `zoomSrc` | `string` | `src` | High-res zoom source |
|
|
52
|
+
| `sources` | `array` | — | `<source>` tags for `<picture>` |
|
|
53
|
+
| `width` / `height` | `number` | — | Container dimensions |
|
|
54
|
+
| `zoomScale` | `number` | `1` | Magnification ratio |
|
|
55
|
+
| `zoomPreload` | `boolean` | `false` | Preload zoom image on mount |
|
|
56
|
+
| `fadeDuration` | `number` | `150` | Animation duration in ms |
|
|
57
|
+
| `moveType` | `follow`, `drag`, `pinch`| `follow` | Pan behavior during zoom |
|
|
58
|
+
| `zoomType` | `click`, `hover` | `click` | How zoom is activated |
|
|
59
|
+
| `clickToZoomOut` | `boolean` | `false` | Allow clicking image to zoom out |
|
|
60
|
+
| `hideCloseButton` | `boolean` | `false` | Hide zoom-close button |
|
|
61
|
+
| `alt` | `string` | `''` | Alt text for both images |
|
|
62
|
+
| `tabIndex` | `number` | `0` | Keyboard navigation index |
|
|
63
|
+
| `containerClassName` | `string` | — | Extra class for the wrapper |
|
|
64
|
+
| `baseImageClassName` | `string` | — | Extra class for the base image |
|
|
65
|
+
| `zoomImageClassName` | `string` | — | Extra class for zoom image |
|
|
66
|
+
| `closeButtonClassName` | `string` | — | Custom class for close button |
|
|
67
|
+
| `containerAriaLabel` | `string` | — | Accessibility label for container |
|
|
68
|
+
| `zoomImageAriaLabel` | `string` | — | ARIA label for zoom image |
|
|
69
|
+
| `closeButtonAriaLabel` | `string` | — | ARIA label for close button |
|
|
70
|
+
| `closeButtonContent` | `ReactNode` | `X` icon | Replace the default close icon |
|
|
71
|
+
| `overlay` | `ReactNode` | — | Optional overlay inside zoom container |
|
|
72
|
+
| `loadingPlaceholder` | `ReactNode` | — | Shown while zoom image loads |
|
|
73
|
+
| `disableLoadingFallbacks` | `boolean` | `false` | Prevents/Disables loading fallbacks |
|
|
74
|
+
| `errorPlaceholder` | `ReactNode` | — | Shown if zoom image fails |
|
|
75
|
+
| `disableErrorFallbacks` | `boolean` | `false` | Prevents/Disables error fallbacks |
|
|
76
|
+
| `externalZoomState` | `boolean` | — | For controlled zoom state |
|
|
77
|
+
| `setExternalZoomState` | `(val: boolean) => void` | — | Setter for external zoom state |
|
|
78
|
+
| `onMouseEnter` | `() => void` | — | Called on hover enter |
|
|
79
|
+
| `onMouseLeave` | `() => void` | — | Called on hover leave |
|
|
80
|
+
| `onClickImage` | `() => void` | — | Called when image is clicked |
|
|
81
|
+
| `onZoom` | `() => void` | — | Called when zoom starts |
|
|
82
|
+
| `onClose` | `() => void` | — | Called when zoom closes |
|
|
83
|
+
| `afterZoomImgLoaded` | `() => void` | — | Called when zoom image loads |
|
|
84
|
+
| `afterZoomOut` | `() => void` | — | Called after zoom exits |
|
|
85
|
+
| `onBaseImageError` | `() => void` | — | Called if base image fails to load |
|
|
86
|
+
| `onZoomImageError` | `() => void` | — | Called if zoom image fails to load |
|
|
87
|
+
| `onDragStart` | `() => void` | — | Called on drag start |
|
|
88
|
+
| `onDragEnd` | `() => void` | — | Called on drag end |
|
|
95
89
|
|
|
96
90
|
## 🧭 Roadmap
|
|
97
91
|
|
|
98
92
|
### ✅ Already Implemented
|
|
93
|
+
|
|
99
94
|
- SSR support (Next.js, Gatsby)
|
|
100
95
|
- Click or hover zoom trigger
|
|
101
96
|
- Follow mouse or drag pan
|
|
@@ -111,13 +106,14 @@ function Example() {
|
|
|
111
106
|
- Programmatic zoom positioning setup via `onLoadCallback`
|
|
112
107
|
|
|
113
108
|
### 🚧 Planned Features
|
|
114
|
-
|
|
115
|
-
- [ ] **
|
|
116
|
-
- [ ] **Zoom
|
|
117
|
-
- [ ] **
|
|
118
|
-
- [ ] **
|
|
119
|
-
- [ ] **
|
|
120
|
-
- [ ] **
|
|
109
|
+
|
|
110
|
+
- [ ] **Pinch-to-zoom** for touch devices
|
|
111
|
+
- [ ] **Zoom lens / magnifier glass** effect
|
|
112
|
+
- [ ] **Zoom on scroll / mouse wheel**
|
|
113
|
+
- [ ] **Double-click or double-tap to zoom**
|
|
114
|
+
- [ ] **Animated transitions with easing customization**
|
|
115
|
+
- [ ] **Programmatic zoom in/out methods**
|
|
116
|
+
- [ ] **Granular keyboard navigation**
|
|
121
117
|
- [ ] **Fallback UI for broken zoom images**
|
|
122
118
|
- [ ] **Built-in modal/lightbox integration**
|
|
123
119
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "point-focus",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "A React component for zooming and focusing on image points via click, drag, or cursor.",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -60,13 +60,13 @@
|
|
|
60
60
|
"url": "https://github.com/aperdomoll90/point-focus/issues"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"react": "^17.0.0 || ^18.0.0",
|
|
64
|
-
"react-dom": "^17.0.0 || ^18.0.0",
|
|
63
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
64
|
+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
65
65
|
"tslib": "^2.8.1"
|
|
66
66
|
},
|
|
67
67
|
"peerDependencies": {
|
|
68
|
-
"react": "^17.0.0 || ^18.0.0",
|
|
69
|
-
"react-dom": "^17.0.0 || ^18.0.0"
|
|
68
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
69
|
+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@rollup/plugin-commonjs": "^25.0.0",
|