js-cloudimage-hotspot 1.0.0
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/LICENSE +21 -0
- package/README.md +294 -0
- package/dist/a11y/aria.d.ts +7 -0
- package/dist/a11y/aria.d.ts.map +1 -0
- package/dist/a11y/focus.d.ts +9 -0
- package/dist/a11y/focus.d.ts.map +1 -0
- package/dist/a11y/keyboard.d.ts +14 -0
- package/dist/a11y/keyboard.d.ts.map +1 -0
- package/dist/core/CIHotspot.d.ts +48 -0
- package/dist/core/CIHotspot.d.ts.map +1 -0
- package/dist/core/ci-hotspot.d.ts +95 -0
- package/dist/core/ci-hotspot.d.ts.map +1 -0
- package/dist/core/config.d.ts +15 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/types.d.ts +227 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/editor/ci-hotspot-editor.d.ts +58 -0
- package/dist/editor/ci-hotspot-editor.d.ts.map +1 -0
- package/dist/editor/drag-manager.d.ts +18 -0
- package/dist/editor/drag-manager.d.ts.map +1 -0
- package/dist/editor/editor-toolbar.d.ts +26 -0
- package/dist/editor/editor-toolbar.d.ts.map +1 -0
- package/dist/editor/index.d.ts +3 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/js-cloudimage-hotspot-editor.cjs.js +4 -0
- package/dist/editor/js-cloudimage-hotspot-editor.cjs.js.map +1 -0
- package/dist/editor/js-cloudimage-hotspot-editor.esm.js +1981 -0
- package/dist/editor/js-cloudimage-hotspot-editor.esm.js.map +1 -0
- package/dist/editor/js-cloudimage-hotspot-editor.min.js +4 -0
- package/dist/editor/js-cloudimage-hotspot-editor.min.js.map +1 -0
- package/dist/editor/property-panel.d.ts +17 -0
- package/dist/editor/property-panel.d.ts.map +1 -0
- package/dist/editor/selection-manager.d.ts +15 -0
- package/dist/editor/selection-manager.d.ts.map +1 -0
- package/dist/editor/types.d.ts +32 -0
- package/dist/editor/types.d.ts.map +1 -0
- package/dist/editor/undo-manager.d.ts +16 -0
- package/dist/editor/undo-manager.d.ts.map +1 -0
- package/dist/fullscreen/fullscreen.d.ts +14 -0
- package/dist/fullscreen/fullscreen.d.ts.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/js-cloudimage-hotspot.cjs.js +2 -0
- package/dist/js-cloudimage-hotspot.cjs.js.map +1 -0
- package/dist/js-cloudimage-hotspot.esm.js +1408 -0
- package/dist/js-cloudimage-hotspot.esm.js.map +1 -0
- package/dist/js-cloudimage-hotspot.min.js +2 -0
- package/dist/js-cloudimage-hotspot.min.js.map +1 -0
- package/dist/markers/Marker.d.ts +10 -0
- package/dist/markers/Marker.d.ts.map +1 -0
- package/dist/markers/pulse.d.ts +9 -0
- package/dist/markers/pulse.d.ts.map +1 -0
- package/dist/popover/Popover.d.ts +41 -0
- package/dist/popover/Popover.d.ts.map +1 -0
- package/dist/popover/position.d.ts +6 -0
- package/dist/popover/position.d.ts.map +1 -0
- package/dist/popover/sanitize.d.ts +6 -0
- package/dist/popover/sanitize.d.ts.map +1 -0
- package/dist/popover/template.d.ts +9 -0
- package/dist/popover/template.d.ts.map +1 -0
- package/dist/react/index.cjs +2 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.js +1617 -0
- package/dist/react/index.js.map +1 -0
- package/dist/utils/cloudimage.d.ts +16 -0
- package/dist/utils/cloudimage.d.ts.map +1 -0
- package/dist/utils/coordinates.d.ts +17 -0
- package/dist/utils/coordinates.d.ts.map +1 -0
- package/dist/utils/dom.d.ts +13 -0
- package/dist/utils/dom.d.ts.map +1 -0
- package/dist/utils/events.d.ts +15 -0
- package/dist/utils/events.d.ts.map +1 -0
- package/dist/zoom/ScrollHint.d.ts +8 -0
- package/dist/zoom/ScrollHint.d.ts.map +1 -0
- package/dist/zoom/ZoomPan.d.ts +51 -0
- package/dist/zoom/ZoomPan.d.ts.map +1 -0
- package/dist/zoom/controls.d.ts +14 -0
- package/dist/zoom/controls.d.ts.map +1 -0
- package/dist/zoom/gestures.d.ts +28 -0
- package/dist/zoom/gestures.d.ts.map +1 -0
- package/dist/zoom/scroll-hint.d.ts +8 -0
- package/dist/zoom/scroll-hint.d.ts.map +1 -0
- package/dist/zoom/zoom-pan.d.ts +53 -0
- package/dist/zoom/zoom-pan.d.ts.map +1 -0
- package/package.json +97 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Scaleflex
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
# js-cloudimage-hotspot
|
|
2
|
+
|
|
3
|
+
Interactive image hotspots with zoom, popovers, and accessibility. Zero dependencies.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Hotspot markers** — Positioned via percentage or pixel coordinates with pulsing animation
|
|
8
|
+
- **Popover system** — Hover, click, or load triggers with built-in flip/shift positioning
|
|
9
|
+
- **Zoom & Pan** — CSS transform-based with mouse wheel, pinch-to-zoom, double-click, drag-to-pan
|
|
10
|
+
- **WCAG 2.1 AA** — Full keyboard navigation, ARIA attributes, focus management, reduced motion
|
|
11
|
+
- **CSS variable theming** — Light and dark themes, fully customizable
|
|
12
|
+
- **Two init methods** — JavaScript API and HTML data-attributes
|
|
13
|
+
- **React wrapper** — Separate entry point with component, hook, and ref API
|
|
14
|
+
- **TypeScript** — Full type definitions
|
|
15
|
+
- **Cloudimage CDN** — Optional responsive image loading
|
|
16
|
+
- **Multi-image scenes** — Navigate between images with animated transitions
|
|
17
|
+
- **< 15 KB gzipped** — Zero runtime dependencies
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install js-cloudimage-hotspot
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### CDN
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<script src="https://cdn.scaleflex.it/plugins/js-cloudimage-hotspot/latest/js-cloudimage-hotspot.min.js"></script>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
### JavaScript API
|
|
34
|
+
|
|
35
|
+
```js
|
|
36
|
+
import CIHotspot from 'js-cloudimage-hotspot';
|
|
37
|
+
|
|
38
|
+
const viewer = new CIHotspot('#product-image', {
|
|
39
|
+
src: 'https://example.com/living-room.jpg',
|
|
40
|
+
alt: 'Modern living room',
|
|
41
|
+
zoom: true,
|
|
42
|
+
trigger: 'hover',
|
|
43
|
+
hotspots: [
|
|
44
|
+
{
|
|
45
|
+
id: 'sofa',
|
|
46
|
+
x: '40%',
|
|
47
|
+
y: '60%',
|
|
48
|
+
label: 'Modern Sofa',
|
|
49
|
+
data: { title: 'Modern Sofa', price: '$899', description: 'Comfortable 3-seat sofa' },
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
id: 'lamp',
|
|
53
|
+
x: '75%',
|
|
54
|
+
y: '25%',
|
|
55
|
+
label: 'Floor Lamp',
|
|
56
|
+
data: { title: 'Arc Floor Lamp', price: '$249' },
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
onOpen(hotspot) {
|
|
60
|
+
console.log('Opened:', hotspot.id);
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### HTML Data-Attributes
|
|
66
|
+
|
|
67
|
+
```html
|
|
68
|
+
<div
|
|
69
|
+
data-ci-hotspot-src="https://example.com/room.jpg"
|
|
70
|
+
data-ci-hotspot-alt="Living room"
|
|
71
|
+
data-ci-hotspot-zoom="true"
|
|
72
|
+
data-ci-hotspot-trigger="hover"
|
|
73
|
+
data-ci-hotspot-items='[
|
|
74
|
+
{"id":"sofa","x":"40%","y":"60%","label":"Sofa","data":{"title":"Sofa","price":"$899"}}
|
|
75
|
+
]'
|
|
76
|
+
></div>
|
|
77
|
+
|
|
78
|
+
<script>CIHotspot.autoInit();</script>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## API Reference
|
|
82
|
+
|
|
83
|
+
### Constructor
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
new CIHotspot(element: HTMLElement | string, config: CIHotspotConfig)
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Config
|
|
90
|
+
|
|
91
|
+
| Option | Type | Default | Description |
|
|
92
|
+
|--------|------|---------|-------------|
|
|
93
|
+
| `src` | `string` | — | Image source URL (required) |
|
|
94
|
+
| `hotspots` | `HotspotItem[]` | — | Array of hotspot definitions (required) |
|
|
95
|
+
| `alt` | `string` | `''` | Image alt text |
|
|
96
|
+
| `trigger` | `'hover' \| 'click' \| 'load'` | `'hover'` | Popover trigger mode |
|
|
97
|
+
| `zoom` | `boolean` | `false` | Enable zoom & pan |
|
|
98
|
+
| `zoomMax` | `number` | `4` | Maximum zoom level |
|
|
99
|
+
| `zoomMin` | `number` | `1` | Minimum zoom level |
|
|
100
|
+
| `theme` | `'light' \| 'dark'` | `'light'` | Theme |
|
|
101
|
+
| `pulse` | `boolean` | `true` | Marker pulse animation |
|
|
102
|
+
| `placement` | `'top' \| 'bottom' \| 'left' \| 'right' \| 'auto'` | `'top'` | Popover placement |
|
|
103
|
+
| `lazyLoad` | `boolean` | `true` | Lazy load image |
|
|
104
|
+
| `zoomControls` | `boolean` | `true` | Show zoom control buttons |
|
|
105
|
+
| `zoomControlsPosition` | `'top-left' \| 'top-center' \| 'top-right' \| 'bottom-left' \| 'bottom-center' \| 'bottom-right'` | `'bottom-right'` | Zoom controls position |
|
|
106
|
+
| `renderPopover` | `(hotspot) => string \| HTMLElement` | — | Custom popover render |
|
|
107
|
+
| `onOpen` | `(hotspot) => void` | — | Popover open callback |
|
|
108
|
+
| `onClose` | `(hotspot) => void` | — | Popover close callback |
|
|
109
|
+
| `onZoom` | `(level) => void` | — | Zoom change callback |
|
|
110
|
+
| `onClick` | `(event, hotspot) => void` | — | Marker click callback |
|
|
111
|
+
| `cloudimage` | `CloudimageConfig` | — | Cloudimage CDN config |
|
|
112
|
+
| `scenes` | `Scene[]` | — | Array of scenes for multi-image navigation |
|
|
113
|
+
| `initialScene` | `string` | first scene | Scene ID to display initially |
|
|
114
|
+
| `sceneTransition` | `'fade' \| 'slide' \| 'none'` | `'fade'` | Scene transition animation |
|
|
115
|
+
| `sceneAspectRatio` | `string` | — | Fixed viewport ratio (e.g. `'16/9'`). Prevents layout jumps. |
|
|
116
|
+
| `onSceneChange` | `(id, scene) => void` | — | Scene change callback |
|
|
117
|
+
|
|
118
|
+
### HotspotItem
|
|
119
|
+
|
|
120
|
+
| Field | Type | Description |
|
|
121
|
+
|-------|------|-------------|
|
|
122
|
+
| `id` | `string` | Unique identifier (required) |
|
|
123
|
+
| `x` | `string \| number` | X coordinate: `'65%'` or `650` (px) |
|
|
124
|
+
| `y` | `string \| number` | Y coordinate: `'40%'` or `400` (px) |
|
|
125
|
+
| `label` | `string` | Accessible label (required) |
|
|
126
|
+
| `data` | `PopoverData` | Data for built-in template |
|
|
127
|
+
| `content` | `string` | HTML content (sanitized) |
|
|
128
|
+
| `trigger` | `'hover' \| 'click' \| 'load'` | Override global trigger |
|
|
129
|
+
| `placement` | `Placement` | Override global placement |
|
|
130
|
+
| `className` | `string` | Custom CSS class |
|
|
131
|
+
| `hidden` | `boolean` | Initially hidden |
|
|
132
|
+
| `icon` | `string` | Custom icon |
|
|
133
|
+
| `navigateTo` | `string` | Scene ID to navigate to on click |
|
|
134
|
+
|
|
135
|
+
### Instance Methods
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
instance.open(id: string): void
|
|
139
|
+
instance.close(id: string): void
|
|
140
|
+
instance.closeAll(): void
|
|
141
|
+
instance.setZoom(level: number): void
|
|
142
|
+
instance.getZoom(): number
|
|
143
|
+
instance.resetZoom(): void
|
|
144
|
+
instance.addHotspot(hotspot: HotspotItem): void
|
|
145
|
+
instance.removeHotspot(id: string): void
|
|
146
|
+
instance.updateHotspot(id: string, updates: Partial<HotspotItem>): void
|
|
147
|
+
instance.update(config: Partial<CIHotspotConfig>): void
|
|
148
|
+
instance.destroy(): void
|
|
149
|
+
instance.goToScene(sceneId: string): void
|
|
150
|
+
instance.getCurrentScene(): string | undefined
|
|
151
|
+
instance.getScenes(): string[]
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Static Methods
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
CIHotspot.autoInit(root?: HTMLElement): CIHotspotInstance[]
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## React Usage
|
|
161
|
+
|
|
162
|
+
```tsx
|
|
163
|
+
import { CIHotspotViewer, useCIHotspot } from 'js-cloudimage-hotspot/react';
|
|
164
|
+
|
|
165
|
+
// Component
|
|
166
|
+
function ProductImage() {
|
|
167
|
+
return (
|
|
168
|
+
<CIHotspotViewer
|
|
169
|
+
src="/living-room.jpg"
|
|
170
|
+
alt="Living room"
|
|
171
|
+
zoom
|
|
172
|
+
hotspots={[
|
|
173
|
+
{ id: 'sofa', x: '40%', y: '60%', label: 'Sofa', data: { title: 'Sofa', price: '$899' } },
|
|
174
|
+
]}
|
|
175
|
+
onOpen={(h) => console.log('Opened:', h.id)}
|
|
176
|
+
/>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// Hook
|
|
181
|
+
function ProductImage() {
|
|
182
|
+
const { containerRef, instance } = useCIHotspot({
|
|
183
|
+
src: '/room.jpg',
|
|
184
|
+
hotspots: [...],
|
|
185
|
+
zoom: true,
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
<>
|
|
190
|
+
<div ref={containerRef} />
|
|
191
|
+
<button onClick={() => instance.current?.setZoom(2)}>Zoom 2x</button>
|
|
192
|
+
</>
|
|
193
|
+
);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Ref API
|
|
197
|
+
function ProductImage() {
|
|
198
|
+
const ref = useRef<CIHotspotViewerRef>(null);
|
|
199
|
+
return (
|
|
200
|
+
<>
|
|
201
|
+
<CIHotspotViewer ref={ref} src="/room.jpg" hotspots={[...]} zoom />
|
|
202
|
+
<button onClick={() => ref.current?.open('sofa')}>Show Sofa</button>
|
|
203
|
+
</>
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Multi-Image Scenes
|
|
209
|
+
|
|
210
|
+
Navigate between multiple images, each with its own hotspots:
|
|
211
|
+
|
|
212
|
+
```js
|
|
213
|
+
const viewer = new CIHotspot('#tour', {
|
|
214
|
+
scenes: [
|
|
215
|
+
{
|
|
216
|
+
id: 'living-room',
|
|
217
|
+
src: '/living-room.jpg',
|
|
218
|
+
alt: 'Living room',
|
|
219
|
+
hotspots: [
|
|
220
|
+
{ id: 'sofa', x: '40%', y: '60%', label: 'Sofa', data: { title: 'Modern Sofa' } },
|
|
221
|
+
{ id: 'go-kitchen', x: '85%', y: '50%', label: 'Go to Kitchen', navigateTo: 'kitchen' },
|
|
222
|
+
],
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
id: 'kitchen',
|
|
226
|
+
src: '/kitchen.jpg',
|
|
227
|
+
alt: 'Kitchen',
|
|
228
|
+
hotspots: [
|
|
229
|
+
{ id: 'island', x: '50%', y: '65%', label: 'Island', data: { title: 'Marble Island' } },
|
|
230
|
+
{ id: 'go-back', x: '10%', y: '50%', label: 'Back', navigateTo: 'living-room' },
|
|
231
|
+
],
|
|
232
|
+
},
|
|
233
|
+
],
|
|
234
|
+
sceneTransition: 'fade', // 'fade' | 'slide' | 'none'
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
// Programmatic navigation
|
|
238
|
+
viewer.goToScene('kitchen');
|
|
239
|
+
viewer.getCurrentScene(); // 'kitchen'
|
|
240
|
+
viewer.getScenes(); // ['living-room', 'kitchen']
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
Hotspots with `navigateTo` display as arrow markers and switch scenes on click.
|
|
244
|
+
|
|
245
|
+
## Theming
|
|
246
|
+
|
|
247
|
+
All visuals are customizable via CSS variables:
|
|
248
|
+
|
|
249
|
+
```css
|
|
250
|
+
.my-viewer {
|
|
251
|
+
--ci-hotspot-marker-bg: rgba(0, 88, 163, 0.8);
|
|
252
|
+
--ci-hotspot-pulse-color: rgba(0, 88, 163, 0.3);
|
|
253
|
+
--ci-hotspot-cta-bg: #e63946;
|
|
254
|
+
--ci-hotspot-popover-border-radius: 4px;
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Set `theme: 'dark'` for the built-in dark theme.
|
|
259
|
+
|
|
260
|
+
## Accessibility
|
|
261
|
+
|
|
262
|
+
- All markers are `<button>` elements with `aria-label`
|
|
263
|
+
- `Tab` / `Shift+Tab` navigates between markers
|
|
264
|
+
- `Enter` / `Space` toggles popovers
|
|
265
|
+
- `Escape` closes popovers and returns focus
|
|
266
|
+
- `Arrow keys` pan when zoomed
|
|
267
|
+
- `+` / `-` / `0` zoom controls
|
|
268
|
+
- Focus trapping in popovers with interactive content
|
|
269
|
+
- `prefers-reduced-motion` disables animations
|
|
270
|
+
|
|
271
|
+
## Cloudimage Integration
|
|
272
|
+
|
|
273
|
+
```js
|
|
274
|
+
new CIHotspot('#el', {
|
|
275
|
+
src: 'https://example.com/room.jpg',
|
|
276
|
+
cloudimage: {
|
|
277
|
+
token: 'demo',
|
|
278
|
+
limitFactor: 100,
|
|
279
|
+
params: 'q=80',
|
|
280
|
+
},
|
|
281
|
+
hotspots: [...],
|
|
282
|
+
});
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
## Browser Support
|
|
286
|
+
|
|
287
|
+
- Chrome 80+
|
|
288
|
+
- Firefox 80+
|
|
289
|
+
- Safari 14+
|
|
290
|
+
- Edge 80+
|
|
291
|
+
|
|
292
|
+
## License
|
|
293
|
+
|
|
294
|
+
MIT
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Announce a message to screen readers via a live region */
|
|
2
|
+
export declare function announceToScreenReader(message: string): void;
|
|
3
|
+
/** Register an instance that uses the live region */
|
|
4
|
+
export declare function acquireLiveRegion(): void;
|
|
5
|
+
/** Release an instance; removes the live region when the last one is released */
|
|
6
|
+
export declare function releaseLiveRegion(): void;
|
|
7
|
+
//# sourceMappingURL=aria.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aria.d.ts","sourceRoot":"","sources":["../../src/a11y/aria.ts"],"names":[],"mappings":"AAKA,6DAA6D;AAC7D,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAmB5D;AAED,qDAAqD;AACrD,wBAAgB,iBAAiB,IAAI,IAAI,CAExC;AAED,iFAAiF;AACjF,wBAAgB,iBAAiB,IAAI,IAAI,CAMxC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** Get all focusable elements within a container */
|
|
2
|
+
export declare function getFocusableElements(container: HTMLElement): HTMLElement[];
|
|
3
|
+
/** Create a focus trap within a popover element */
|
|
4
|
+
export declare function createFocusTrap(popover: HTMLElement, returnFocusTo: HTMLElement): {
|
|
5
|
+
activate: () => void;
|
|
6
|
+
deactivate: () => void;
|
|
7
|
+
destroy: () => void;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=focus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus.d.ts","sourceRoot":"","sources":["../../src/a11y/focus.ts"],"names":[],"mappings":"AAIA,oDAAoD;AACpD,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,WAAW,GAAG,WAAW,EAAE,CAE1E;AAED,mDAAmD;AACnD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,EACpB,aAAa,EAAE,WAAW,GACzB;IAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAAE,CA8CvE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ZoomPan } from '../zoom/zoom-pan';
|
|
2
|
+
export interface KeyboardHandlerOptions {
|
|
3
|
+
container: HTMLElement;
|
|
4
|
+
getZoomPan: () => ZoomPan | null;
|
|
5
|
+
onEscape?: () => void;
|
|
6
|
+
onFullscreenToggle?: () => void;
|
|
7
|
+
}
|
|
8
|
+
/** Handles keyboard navigation within the hotspot container */
|
|
9
|
+
export declare class KeyboardHandler {
|
|
10
|
+
private cleanups;
|
|
11
|
+
constructor(options: KeyboardHandlerOptions);
|
|
12
|
+
destroy(): void;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=keyboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyboard.d.ts","sourceRoot":"","sources":["../../src/a11y/keyboard.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAGhD,MAAM,WAAW,sBAAsB;IACrC,SAAS,EAAE,WAAW,CAAC;IACvB,UAAU,EAAE,MAAM,OAAO,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC;AAKD,+DAA+D;AAC/D,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAsB;gBAE1B,OAAO,EAAE,sBAAsB;IA2E3C,OAAO,IAAI,IAAI;CAIhB"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { CIHotspotConfig, CIHotspotInstance, HotspotItem } from './types';
|
|
2
|
+
export declare class CIHotspot implements CIHotspotInstance {
|
|
3
|
+
private config;
|
|
4
|
+
private rootEl;
|
|
5
|
+
private containerEl;
|
|
6
|
+
private viewportEl;
|
|
7
|
+
private imgEl;
|
|
8
|
+
private markersEl;
|
|
9
|
+
private markers;
|
|
10
|
+
private popovers;
|
|
11
|
+
private normalizedHotspots;
|
|
12
|
+
private scrollHint;
|
|
13
|
+
private zoomPan;
|
|
14
|
+
private zoomControls;
|
|
15
|
+
private cloudimageHandler;
|
|
16
|
+
private resizeObserver;
|
|
17
|
+
private keyboardHandler;
|
|
18
|
+
private focusTraps;
|
|
19
|
+
private cleanups;
|
|
20
|
+
private destroyed;
|
|
21
|
+
constructor(element: HTMLElement | string, config: CIHotspotConfig);
|
|
22
|
+
/** Auto-initialize all elements with data-ci-hotspot-src attribute */
|
|
23
|
+
static autoInit(root?: HTMLElement): CIHotspotInstance[];
|
|
24
|
+
private buildDOM;
|
|
25
|
+
private applyTheme;
|
|
26
|
+
private setupImage;
|
|
27
|
+
private loadImage;
|
|
28
|
+
private initHotspots;
|
|
29
|
+
private addHotspotInternal;
|
|
30
|
+
private bindTrigger;
|
|
31
|
+
private renormalizePixelCoordinates;
|
|
32
|
+
private initZoom;
|
|
33
|
+
private setupResponsive;
|
|
34
|
+
private initKeyboard;
|
|
35
|
+
open(id: string): void;
|
|
36
|
+
close(id: string): void;
|
|
37
|
+
closeAll(): void;
|
|
38
|
+
setZoom(level: number): void;
|
|
39
|
+
getZoom(): number;
|
|
40
|
+
resetZoom(): void;
|
|
41
|
+
addHotspot(hotspot: HotspotItem): void;
|
|
42
|
+
removeHotspot(id: string): void;
|
|
43
|
+
updateHotspot(id: string, updates: Partial<HotspotItem>): void;
|
|
44
|
+
update(config: Partial<CIHotspotConfig>): void;
|
|
45
|
+
destroy(): void;
|
|
46
|
+
private destroyInternal;
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=CIHotspot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CIHotspot.d.ts","sourceRoot":"","sources":["../../src/core/CIHotspot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,WAAW,EAAqB,MAAM,SAAS,CAAC;AAiBlG,qBAAa,SAAU,YAAW,iBAAiB;IACjD,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,WAAW,CAAe;IAClC,OAAO,CAAC,UAAU,CAAe;IACjC,OAAO,CAAC,KAAK,CAAoB;IACjC,OAAO,CAAC,SAAS,CAAe;IAChC,OAAO,CAAC,OAAO,CAAwC;IACvD,OAAO,CAAC,QAAQ,CAA8B;IAC9C,OAAO,CAAC,kBAAkB,CAAwC;IAClE,OAAO,CAAC,UAAU,CAA2B;IAC7C,OAAO,CAAC,OAAO,CAAwB;IACvC,OAAO,CAAC,YAAY,CAAkF;IACtG,OAAO,CAAC,iBAAiB,CAAkE;IAC3F,OAAO,CAAC,cAAc,CAA+B;IACrD,OAAO,CAAC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;
|
|
4
|
+
private rootEl;
|
|
5
|
+
private containerEl;
|
|
6
|
+
private viewportEl;
|
|
7
|
+
private imgEl;
|
|
8
|
+
private markersEl;
|
|
9
|
+
private markers;
|
|
10
|
+
private popovers;
|
|
11
|
+
private normalizedHotspots;
|
|
12
|
+
private scrollHint;
|
|
13
|
+
private zoomPan;
|
|
14
|
+
private zoomControls;
|
|
15
|
+
private cloudimageHandler;
|
|
16
|
+
private resizeObserver;
|
|
17
|
+
private keyboardHandler;
|
|
18
|
+
private fullscreenControl;
|
|
19
|
+
private focusTraps;
|
|
20
|
+
private cleanups;
|
|
21
|
+
private hotspotCleanups;
|
|
22
|
+
private imageLoaded;
|
|
23
|
+
private destroyed;
|
|
24
|
+
private currentSceneId;
|
|
25
|
+
private scenesMap;
|
|
26
|
+
private isTransitioning;
|
|
27
|
+
private transitionTimer;
|
|
28
|
+
private activeTimers;
|
|
29
|
+
private sceneHotspotOverrides;
|
|
30
|
+
constructor(element: HTMLElement | string, config: CIHotspotConfig);
|
|
31
|
+
/** Auto-initialize all elements with data-ci-hotspot-src or data-ci-hotspot-scenes attribute */
|
|
32
|
+
static autoInit(root?: HTMLElement): CIHotspotInstance[];
|
|
33
|
+
private buildDOM;
|
|
34
|
+
private applyTheme;
|
|
35
|
+
private setupImage;
|
|
36
|
+
private loadImage;
|
|
37
|
+
private initHotspots;
|
|
38
|
+
private addHotspotInternal;
|
|
39
|
+
/** For navigateTo hotspots without explicit data/content, generate popover content from the destination scene */
|
|
40
|
+
private enrichNavigateHotspot;
|
|
41
|
+
private static readonly NAVIGATE_ARROW_SVG;
|
|
42
|
+
private bindNavigateTrigger;
|
|
43
|
+
private bindTrigger;
|
|
44
|
+
private bindHoverTrigger;
|
|
45
|
+
private bindClickTrigger;
|
|
46
|
+
private bindKeyboardTrigger;
|
|
47
|
+
private renormalizePixelCoordinates;
|
|
48
|
+
private showLoadTriggerPopovers;
|
|
49
|
+
private initZoom;
|
|
50
|
+
private setupResponsive;
|
|
51
|
+
/** Position the markers layer to match the rendered image area within a fixed-ratio viewport */
|
|
52
|
+
private syncMarkersToImage;
|
|
53
|
+
private initScenes;
|
|
54
|
+
private initKeyboard;
|
|
55
|
+
private initFullscreen;
|
|
56
|
+
private preloadedScenes;
|
|
57
|
+
private preloadSceneImage;
|
|
58
|
+
private ensureFocusTrap;
|
|
59
|
+
/** Create a setTimeout that is automatically cleared on destroy */
|
|
60
|
+
private trackedTimeout;
|
|
61
|
+
/** Sync current hotspots back to scene override map so navigating away and back preserves changes */
|
|
62
|
+
private syncCurrentSceneHotspots;
|
|
63
|
+
private addHotspotCleanups;
|
|
64
|
+
private clearHotspots;
|
|
65
|
+
/** Read scene transition duration from CSS variable (handles both ms and s units) */
|
|
66
|
+
private getSceneTransitionDuration;
|
|
67
|
+
private performSceneTransition;
|
|
68
|
+
private switchToScene;
|
|
69
|
+
/** Get references to the internal DOM elements */
|
|
70
|
+
getElements(): {
|
|
71
|
+
container: HTMLElement;
|
|
72
|
+
viewport: HTMLElement;
|
|
73
|
+
image: HTMLImageElement;
|
|
74
|
+
markers: HTMLElement;
|
|
75
|
+
};
|
|
76
|
+
open(id: string): void;
|
|
77
|
+
close(id: string): void;
|
|
78
|
+
closeAll(): void;
|
|
79
|
+
setZoom(level: number): void;
|
|
80
|
+
getZoom(): number;
|
|
81
|
+
resetZoom(): void;
|
|
82
|
+
goToScene(sceneId: string): void;
|
|
83
|
+
getCurrentScene(): string | undefined;
|
|
84
|
+
getScenes(): string[];
|
|
85
|
+
enterFullscreen(): void;
|
|
86
|
+
exitFullscreen(): void;
|
|
87
|
+
isFullscreen(): boolean;
|
|
88
|
+
addHotspot(hotspot: HotspotItem): void;
|
|
89
|
+
removeHotspot(id: string): void;
|
|
90
|
+
updateHotspot(id: string, updates: Partial<HotspotItem>): void;
|
|
91
|
+
update(config: Partial<CIHotspotConfig>): void;
|
|
92
|
+
destroy(): void;
|
|
93
|
+
private destroyInternal;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingUR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M,GAAG,IAAI;IAWvB,QAAQ,IAAI,IAAI;IAYhB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK5B,OAAO,IAAI,MAAM;IAIjB,SAAS,IAAI,IAAI;IAKjB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAmDhC,eAAe,IAAI,MAAM,GAAG,SAAS;IAIrC,SAAS,IAAI,MAAM,EAAE;IAIrB,eAAe,IAAI,IAAI;IAKvB,cAAc,IAAI,IAAI;IAKtB,YAAY,IAAI,OAAO;IAIvB,UAAU,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAOtC,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAiC/B,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,IAAI;IAwB9D,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,IAAI;IAwB9C,OAAO,IAAI,IAAI;IAOf,OAAO,CAAC,eAAe;CAwExB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CIHotspotConfig, ResolvedCIHotspotConfig } from './types';
|
|
2
|
+
export declare const DEFAULT_CONFIG: Omit<Required<CIHotspotConfig>, 'src' | 'hotspots' | 'cloudimage' | 'renderPopover' | 'onOpen' | 'onClose' | 'onZoom' | 'onClick' | 'scenes' | 'initialScene' | 'onSceneChange' | 'sceneAspectRatio' | 'onFullscreenChange'>;
|
|
3
|
+
/** Data attribute to config property mapping */
|
|
4
|
+
export declare const DATA_ATTR_MAP: Record<string, {
|
|
5
|
+
key: string;
|
|
6
|
+
type: 'string' | 'boolean' | 'number' | 'json';
|
|
7
|
+
nested?: string;
|
|
8
|
+
}>;
|
|
9
|
+
/** Parse data attributes from an element into a config object */
|
|
10
|
+
export declare function parseDataAttributes(element: HTMLElement): Partial<CIHotspotConfig>;
|
|
11
|
+
/** Merge user config with defaults */
|
|
12
|
+
export declare function mergeConfig(userConfig: Partial<CIHotspotConfig>): ResolvedCIHotspotConfig;
|
|
13
|
+
/** Validate config — throws on critical issues */
|
|
14
|
+
export declare function validateConfig(config: ResolvedCIHotspotConfig): void;
|
|
15
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAoB,uBAAuB,EAAE,MAAM,SAAS,CAAC;AAE1F,eAAO,MAAM,cAAc,EAAE,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,KAAK,GAAG,UAAU,GAAG,YAAY,GAAG,eAAe,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,cAAc,GAAG,eAAe,GAAG,kBAAkB,GAAG,oBAAoB,CAgBvP,CAAC;AAEF,gDAAgD;AAChD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CA0B1H,CAAC;AAEF,iEAAiE;AACjE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,eAAe,CAAC,CAsBlF;AA0BD,sCAAsC;AACtC,wBAAgB,WAAW,CAAC,UAAU,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,uBAAuB,CAOzF;AAED,kDAAkD;AAClD,wBAAgB,cAAc,CAAC,MAAM,EAAE,uBAAuB,GAAG,IAAI,CA0BpE"}
|