vistaview 0.5.3 → 0.6.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.
Files changed (56) hide show
  1. package/README.md +57 -56
  2. package/dist/lib/components.d.ts +5 -6
  3. package/dist/lib/components.d.ts.map +1 -1
  4. package/dist/lib/defaults/close.d.ts +3 -0
  5. package/dist/lib/defaults/close.d.ts.map +1 -0
  6. package/dist/lib/defaults/init.d.ts +3 -0
  7. package/dist/lib/defaults/init.d.ts.map +1 -0
  8. package/dist/lib/defaults/options.d.ts +3 -0
  9. package/dist/lib/defaults/options.d.ts.map +1 -0
  10. package/dist/lib/defaults/setup.d.ts +3 -0
  11. package/dist/lib/defaults/setup.d.ts.map +1 -0
  12. package/dist/lib/defaults/transition.d.ts +3 -0
  13. package/dist/lib/defaults/transition.d.ts.map +1 -0
  14. package/dist/lib/errors.d.ts +4 -0
  15. package/dist/lib/errors.d.ts.map +1 -0
  16. package/dist/lib/image-state.d.ts +39 -0
  17. package/dist/lib/image-state.d.ts.map +1 -0
  18. package/dist/lib/main.d.ts +3 -0
  19. package/dist/lib/main.d.ts.map +1 -0
  20. package/dist/lib/pointers.d.ts +23 -0
  21. package/dist/lib/pointers.d.ts.map +1 -0
  22. package/dist/lib/throttle.d.ts +7 -0
  23. package/dist/lib/throttle.d.ts.map +1 -0
  24. package/dist/lib/types.d.ts +70 -36
  25. package/dist/lib/types.d.ts.map +1 -1
  26. package/dist/lib/utils.d.ts +17 -9
  27. package/dist/lib/utils.d.ts.map +1 -1
  28. package/dist/lib/vista-view.d.ts +36 -70
  29. package/dist/lib/vista-view.d.ts.map +1 -1
  30. package/dist/react.d.ts +4 -12
  31. package/dist/react.d.ts.map +1 -1
  32. package/dist/react.js +17 -13
  33. package/dist/solid.d.ts +4 -12
  34. package/dist/solid.d.ts.map +1 -1
  35. package/dist/solid.js +21 -20
  36. package/dist/svelte.d.ts +2 -11
  37. package/dist/svelte.d.ts.map +1 -1
  38. package/dist/svelte.js +7 -6
  39. package/dist/vistaview.css +1 -1
  40. package/dist/vistaview.d.ts +3 -19
  41. package/dist/vistaview.d.ts.map +1 -1
  42. package/dist/vistaview.js +753 -643
  43. package/dist/vistaview.umd.js +11 -15
  44. package/dist/vue.d.ts +2 -10
  45. package/dist/vue.d.ts.map +1 -1
  46. package/dist/vue.js +15 -14
  47. package/package.json +8 -13
  48. package/dist/lib/defaults.d.ts +0 -9
  49. package/dist/lib/defaults.d.ts.map +0 -1
  50. package/dist/lib/pinch-detector.d.ts +0 -33
  51. package/dist/lib/pinch-detector.d.ts.map +0 -1
  52. package/dist/react.cjs +0 -1
  53. package/dist/solid.cjs +0 -1
  54. package/dist/svelte.cjs +0 -1
  55. package/dist/vistaview.cjs +0 -16
  56. package/dist/vue.cjs +0 -1
package/README.md CHANGED
@@ -6,13 +6,14 @@ A lightweight, modern image lightbox library for the web. Zero dependencies, fra
6
6
 
7
7
  ## Features
8
8
 
9
- - ðŸŠķ **Lightweight** — Minimal footprint, no external dependencies
10
- - ðŸ“ą **Mobile-first** — Touch gestures, smooth animations, responsive design
11
- - ðŸŽĻ **Customizable** — Configurable controls, animations, and styling
12
- - â™ŋ **Accessible** — Keyboard navigation, reduced motion support
9
+ - ðŸŠķ **Lightweight** — ~40KB ESM (~10KB gzip), minimal footprint, zero dependencies
10
+ - ðŸ“ą **Touch-first** — Swipe gestures for navigation and closing, pinch-to-zoom support
11
+ - ðŸŽĻ **Customizable** — Configurable controls, animations, and styling via CSS variables
12
+ - â™ŋ **Accessible** — Keyboard navigation, ARIA labels, reduced motion support
13
13
  - 🔧 **Framework-agnostic** — Works with vanilla JS, React, Vue, Svelte, Solid, or any framework
14
14
  - 🖞ïļ **Progressive loading** — Low-res thumbnails → high-res images with smooth transitions
15
- - 🔍 **Zoom support** — Zoom in/out with buttons, respects actual image resolution
15
+ - 🔍 **Smart zoom** — Pan and zoom with momentum physics, respects actual image resolution
16
+ - ðŸŽŊ **Pointer-aware** — Advanced multi-touch tracking with context menu prevention
16
17
 
17
18
  ## Installation
18
19
 
@@ -103,21 +104,22 @@ vistaView({
103
104
  ## Options
104
105
 
105
106
  ```ts
106
- import { vistaView, vistaViewDownload } from 'vistaview'
107
+ import { vistaView, vistaViewDownload } from 'vistaview';
107
108
 
108
109
  vistaView({
109
110
  // Required: specify elements (string selector, NodeList, or array)
110
- elements: string | NodeList | VistaViewImage[],
111
+ elements: string | NodeList | VistaImg[],
111
112
 
112
113
  // Optional configuration
113
114
  animationDurationBase: 333, // Base animation duration in ms (default: 333)
114
115
  initialZIndex: 1, // Starting z-index for the lightbox (default: 1)
115
- detectReducedMotion: true, // Respect prefers-reduced-motion (default: true)
116
116
  zoomStep: 500, // Pixels to zoom per step (default: 500)
117
117
  maxZoomLevel: 2, // Maximum zoom multiplier (default: 2)
118
118
  touchSpeedThreshold: 0.5, // Swipe speed threshold for navigation (default: 0.5)
119
119
  preloads: 1, // Number of adjacent images to preload on each side (default: 1)
120
120
  keyboardListeners: true, // Enable keyboard navigation (default: true)
121
+ arrowOnSmallScreens: false, // Show arrow buttons on small screens (default: false)
122
+ rapidLimit: 100, // Minimum time between rapid actions in ms (default: 100)
121
123
 
122
124
  // Control placement (defaults shown)
123
125
  controls: {
@@ -130,15 +132,15 @@ vistaView({
130
132
  },
131
133
 
132
134
  // Events
133
- onOpen: (data) => {}, // Called when lightbox opens
134
- onClose: (data) => {}, // Called when lightbox closes
135
+ onOpen: (vistaView) => {}, // Called when lightbox opens
136
+ onClose: (vistaView) => {}, // Called when lightbox closes
135
137
  onImageView: (data) => {}, // Called when viewing an image (including on open)
136
138
 
137
139
  // Custom behavior functions (advanced)
138
- initFunction: (vistaView) => {}, // Custom initialization
139
- setupFunction: (data) => {}, // Custom setup when navigating
140
- transitionFunction: (data, abortSignal) => void, // Custom transition animation
141
- closeFunction: (vistaView) => {}, // Custom cleanup on close
140
+ initFunction: (vistaView) => {}, // Custom initialization (runs on open)
141
+ setupFunction: (data) => {}, // Custom setup when navigating
142
+ transitionFunction: (data, abortSignal) => Promise<void>, // Custom transition animation
143
+ closeFunction: (vistaView) => {}, // Custom cleanup on close
142
144
  });
143
145
  ```
144
146
 
@@ -182,34 +184,29 @@ vistaView({
182
184
 
183
185
  ## Exported Types & Functions
184
186
 
185
- VistaView exports all types for TypeScript users, plus default behavior functions for customization:
187
+ VistaView exports all types for TypeScript users, plus helper functions:
186
188
 
187
189
  ```ts
188
190
  import {
189
191
  vistaView,
190
- vistaViewDownload,
191
- DefaultOptions,
192
- // Default behavior functions (can be used as starting points)
193
- defaultInit,
194
- defaultSetup,
195
- defaultTransition,
196
- defaultClose,
197
- setTouchActions,
198
- removeTouchActions,
192
+ vistaViewDownload, // Helper function for download control
193
+ DefaultOptions, // Default configuration options
199
194
  } from 'vistaview';
200
195
 
201
196
  import type {
202
- VistaViewParams, // Full options including `elements`
203
- VistaViewOptions, // Base options (without `elements`)
204
- VistaViewImage, // Image object: { src, alt?, thumb? }
205
- VistaViewImageIndexed, // Image with index and DOM references
206
- VistaViewInterface, // Return type from vistaView()
207
- VistaViewData, // Data passed to events/functions
208
- VistaViewSetupFunction, // Type for setupFunction
209
- VistaViewTransitionFunction, // Type for transitionFunction
210
- VistaViewCloseFunction, // Type for closeFunction
211
- VistaViewInitFunction, // Type for initFunction
212
- VistaViewCustomControl, // Custom control definition
197
+ VistaParams, // Full options including `elements`
198
+ VistaOpt, // Base options (without `elements`)
199
+ VistaImg, // Image object: { src, alt?, thumb? }
200
+ VistaImgIdx, // Image with index and DOM references
201
+ VistaInterface, // Return type from vistaView()
202
+ VistaData, // Data passed to events/functions
203
+ VistaSetupFn, // Type for setupFunction
204
+ VistaTransitionFn, // Type for transitionFunction
205
+ VistaCloseFn, // Type for closeFunction
206
+ VistaInitFn, // Type for initFunction
207
+ VistaCustomCtrl, // Custom control definition
208
+ VistaDefaultCtrl, // Built-in control names
209
+ VistaElmProps, // Element property interface
213
210
  } from 'vistaview';
214
211
  ```
215
212
 
@@ -245,6 +242,16 @@ VistaView uses CSS custom properties for easy theming:
245
242
  | `↓` Down | Zoom out |
246
243
  | `Esc` | Close lightbox |
247
244
 
245
+ ## Touch Gestures
246
+
247
+ | Gesture | Action |
248
+ | ---------------- | ------------------------- |
249
+ | Swipe left/right | Navigate between images |
250
+ | Swipe up/down | Close lightbox |
251
+ | Pinch in/out | Zoom in/out (when zoomed) |
252
+ | Drag | Pan image (when zoomed) |
253
+ | Single tap | Toggle UI visibility |
254
+
248
255
  ## Browser Support
249
256
 
250
257
  VistaView works in all modern browsers (Chrome, Firefox, Safari, Edge).
@@ -284,33 +291,27 @@ function Gallery() {
284
291
 
285
292
  ```
286
293
  vite v6.4.1 building for production...
287
- ✓ 10 modules transformed.
294
+ ✓ 18 modules transformed.
288
295
 
289
296
  [vite:dts] Start generate declaration files...
290
- dist/vistaview.css 10.34 kB │ gzip: 1.85 kB
291
- dist/svelte.js 0.54 kB │ gzip: 0.27 kB
292
- dist/solid.js 1.11 kB │ gzip: 0.52 kB
293
- dist/vue.js 1.29 kB │ gzip: 0.56 kB
294
- dist/react.js 1.54 kB │ gzip: 0.57 kB
295
- dist/vistaview.js 38.86 kB │ gzip: 9.90 kB
296
- [vite:dts] Declaration files built in 694ms.
297
-
298
- dist/vistaview.css 10.34 kB │ gzip: 1.85 kB
299
- dist/svelte.cjs 0.48 kB │ gzip: 0.29 kB
300
- dist/solid.cjs 0.92 kB │ gzip: 0.50 kB
301
- dist/vue.cjs 1.00 kB │ gzip: 0.51 kB
302
- dist/react.cjs 1.25 kB │ gzip: 0.52 kB
303
- dist/vistaview.cjs 30.20 kB │ gzip: 8.55 kB
304
- ✓ built in 811ms
297
+ dist/vistaview.css 6.66 kB │ gzip: 1.58 kB
298
+ dist/svelte.js 0.62 kB │ gzip: 0.29 kB
299
+ dist/solid.js 1.19 kB │ gzip: 0.54 kB
300
+ dist/vue.js 1.36 kB │ gzip: 0.59 kB
301
+ dist/react.js 1.67 kB │ gzip: 0.59 kB
302
+ dist/vistaview.js 39.77 kB │ gzip: 9.66 kB
303
+ [vite:dts] Declaration files built in 659ms.
304
+
305
+ ✓ built in 768ms
305
306
  vite v6.4.1 building for production...
306
- ✓ 6 modules transformed.
307
+ ✓ 14 modules transformed.
307
308
 
308
309
  [vite:dts] Start generate declaration files...
309
- dist/vistaview.css 10.34 kB │ gzip: 1.85 kB
310
- dist/vistaview.umd.js 30.35 kB │ gzip: 8.67 kB
311
- [vite:dts] Declaration files built in 649ms.
310
+ dist/vistaview.css 6.66 kB │ gzip: 1.58 kB
311
+ dist/vistaview.umd.js 31.07 kB │ gzip: 8.61 kB
312
+ [vite:dts] Declaration files built in 670ms.
312
313
 
313
- ✓ built in 738ms
314
+ ✓ built in 766ms
314
315
  ```
315
316
 
316
317
  ## License
@@ -1,8 +1,7 @@
1
- import { VistaViewCustomControl, VistaViewImageIndexed, VistaViewOptions } from './types';
2
- export declare function vistaViewDownload(): VistaViewCustomControl;
3
- export declare function vistaViewItem(el: VistaViewImageIndexed, positionalIndex?: number): HTMLDivElement;
4
- export declare function vistaViewComponent({ controls, isReducedMotion, }: {
5
- controls: VistaViewOptions['controls'];
6
- isReducedMotion: boolean;
1
+ import { VistaCustomCtrl, VistaOpt, VistaImgIdx } from './types';
2
+ export declare function vistaViewDownload(): VistaCustomCtrl;
3
+ export declare function vistaViewItem(el: VistaImgIdx, positionalIndex?: number): HTMLDivElement;
4
+ export declare function vistaViewComponent({ controls, }: {
5
+ controls: VistaOpt['controls'];
7
6
  }): DocumentFragment;
8
7
  //# sourceMappingURL=components.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/lib/components.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAWjB,wBAAgB,iBAAiB,IAAI,sBAAsB,CAgB1D;AAsBD,wBAAgB,aAAa,CAAC,EAAE,EAAE,qBAAqB,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,cAAc,CAuBjG;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,eAAe,GAChB,EAAE;IACD,QAAQ,EAAE,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACvC,eAAe,EAAE,OAAO,CAAC;CAC1B,GAAG,gBAAgB,CAiBnB"}
1
+ {"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/lib/components.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAoB,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AA4CxF,wBAAgB,iBAAiB,IAAI,eAAe,CAgBnD;AAuBD,wBAAgB,aAAa,CAAC,EAAE,EAAE,WAAW,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,cAAc,CAoBvF;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,GACT,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;CAChC,GAAG,gBAAgB,CAkBnB"}
@@ -0,0 +1,3 @@
1
+ import { VistaView } from '../vista-view';
2
+ export declare function close(_vistaView: VistaView): void;
3
+ //# sourceMappingURL=close.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"close.d.ts","sourceRoot":"","sources":["../../../src/lib/defaults/close.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C,wBAAgB,KAAK,CAAC,UAAU,EAAE,SAAS,QAE1C"}
@@ -0,0 +1,3 @@
1
+ import { VistaView } from '../vista-view';
2
+ export declare function init(vistaView: VistaView): void;
3
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/lib/defaults/init.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAG/C,wBAAgB,IAAI,CAAC,SAAS,EAAE,SAAS,QAQxC"}
@@ -0,0 +1,3 @@
1
+ import { VistaOpt } from '../types';
2
+ export declare const DefaultOptions: VistaOpt;
3
+ //# sourceMappingURL=options.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../../src/lib/defaults/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGzC,eAAO,MAAM,cAAc,EAAE,QAgB5B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { VistaData } from '../types';
2
+ export declare function setup(_params: VistaData): void;
3
+ //# sourceMappingURL=setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../../src/lib/defaults/setup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG1C,wBAAgB,KAAK,CAAC,OAAO,EAAE,SAAS,QAEvC"}
@@ -0,0 +1,3 @@
1
+ import { VistaData } from '../types';
2
+ export declare function transition({ vistaView: { isReducedMotion }, htmlElements: { to: HtmlTo }, index: { from: fromIndex, to: toIndex }, vistaView: { elements, imageContainer: imgc, options }, }: VistaData, signal: AbortSignal): Promise<(() => void) | undefined>;
3
+ //# sourceMappingURL=transition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transition.d.ts","sourceRoot":"","sources":["../../../src/lib/defaults/transition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAG1C,wBAAsB,UAAU,CAC9B,EACE,SAAS,EAAE,EAAE,eAAe,EAAE,EAC9B,YAAY,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAC5B,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,EACvC,SAAS,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAE,OAAO,EAAE,GACvD,EAAE,SAAS,EACZ,MAAM,EAAE,WAAW,kBAqBM,IAAI,eAoB9B"}
@@ -0,0 +1,4 @@
1
+ export declare class VistaIgnoredErr extends Error {
2
+ constructor(message: string);
3
+ }
4
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/lib/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B"}
@@ -0,0 +1,39 @@
1
+ import { VistaPointer } from './types';
2
+ export type VistaImageStateScaleParams = {
3
+ scale: number;
4
+ isMax: boolean;
5
+ isMin: boolean;
6
+ };
7
+ export declare class VistaImageState {
8
+ private maxZoomLevel;
9
+ private image;
10
+ private rect;
11
+ private initialCenter;
12
+ private maxDimension;
13
+ private minDimension;
14
+ private accumulatedTranslate;
15
+ private scale;
16
+ private translate;
17
+ private onScale;
18
+ constructor(maxZoomLevel: number, onScale: (par: VistaImageStateScaleParams) => void);
19
+ clean(): void;
20
+ reset(): void;
21
+ setCurrentImage(image: HTMLImageElement): void;
22
+ setInitialCenter(center?: {
23
+ x: number;
24
+ y: number;
25
+ }): void;
26
+ move(center: {
27
+ x: number;
28
+ y: number;
29
+ }): void;
30
+ scaleMove(ratio: number, center?: {
31
+ x: number;
32
+ y: number;
33
+ }): void;
34
+ moveAndNormalize(pointer: VistaPointer): () => void;
35
+ private animationTimestamp;
36
+ animateZoom(targetScale: number): void;
37
+ normalize(checkBound?: boolean): boolean | void;
38
+ }
39
+ //# sourceMappingURL=image-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"image-state.d.ts","sourceRoot":"","sources":["../../src/lib/image-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAG5C,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,qBAAa,eAAe;IAC1B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,IAAI,CAAwB;IACpC,OAAO,CAAC,aAAa,CAA4C;IACjE,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,YAAY,CAAuE;IAC3F,OAAO,CAAC,oBAAoB,CAAkB;IAG9C,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,SAAS,CAAkB;IACnC,OAAO,CAAC,OAAO,CAA4D;gBAE/D,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,0BAA0B,KAAK,IAAI;IAKpF,KAAK;IAUL,KAAK;IAYL,eAAe,CAAC,KAAK,EAAE,gBAAgB;IAsBvC,gBAAgB,CAAC,MAAM,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;IAIlD,IAAI,CAAC,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;IAcrC,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;IAyE1D,gBAAgB,CAAC,OAAO,EAAE,YAAY,GAAG,MAAM,IAAI;IAsDnD,OAAO,CAAC,kBAAkB,CAAa;IACvC,WAAW,CAAC,WAAW,EAAE,MAAM;IA+B/B,SAAS,CAAC,UAAU,GAAE,OAAc,GAAG,OAAO,GAAG,IAAI;CAoGtD"}
@@ -0,0 +1,3 @@
1
+ import { VistaParams, VistaInterface } from './types';
2
+ export declare function vistaView({ elements, ...opts }: VistaParams): VistaInterface | null;
3
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/lib/main.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EACX,cAAc,EACf,MAAM,SAAS,CAAC;AAqCjB,wBAAgB,SAAS,CAAC,EAAE,QAAQ,EAAE,GAAG,IAAI,EAAE,EAAE,WAAW,GAAG,cAAc,GAAG,IAAI,CAuBnF"}
@@ -0,0 +1,23 @@
1
+ import { VistaPointer, VistaPointerListener, VistaPointerArgs } from './types.js';
2
+ export declare class VistaPointers {
3
+ private pointers;
4
+ private elm;
5
+ private listeners;
6
+ private lastPointerDownId;
7
+ constructor({ elm, listeners }: VistaPointerArgs);
8
+ private removeLastPointer;
9
+ private onPointerDown;
10
+ private onPointerMove;
11
+ private onPointerUp;
12
+ private onPointerCancel;
13
+ startListeners(): void;
14
+ removeListeners(): void;
15
+ addEventListener(listener: VistaPointerListener): void;
16
+ removeEventListener(listener: VistaPointerListener): void;
17
+ getPointerDistance(p1: VistaPointer, p2: VistaPointer): number;
18
+ getCentroid(): {
19
+ x: number;
20
+ y: number;
21
+ } | null;
22
+ }
23
+ //# sourceMappingURL=pointers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pointers.d.ts","sourceRoot":"","sources":["../../src/lib/pointers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAGvF,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAsB;IACtC,OAAO,CAAC,GAAG,CAAyB;IACpC,OAAO,CAAC,SAAS,CAA8B;IAC/C,OAAO,CAAC,iBAAiB,CAAgC;gBAE7C,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,gBAAgB;IAUhD,OAAO,CAAC,iBAAiB,CAQvB;IAEF,OAAO,CAAC,aAAa,CAiCnB;IAEF,OAAO,CAAC,aAAa,CAkBnB;IAEF,OAAO,CAAC,WAAW,CAuCjB;IAEF,OAAO,CAAC,eAAe,CAgCrB;IAEF,cAAc;IASd,eAAe;IAUf,gBAAgB,CAAC,QAAQ,EAAE,oBAAoB;IAI/C,mBAAmB,CAAC,QAAQ,EAAE,oBAAoB;IAIlD,kBAAkB,CAAC,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,GAAG,MAAM;IAM9D,WAAW,IAAI;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;CAe/C"}
@@ -0,0 +1,7 @@
1
+ export declare class Throttle {
2
+ fiolast: {
3
+ [key: string]: number;
4
+ };
5
+ fio(func: () => void, id: string, wait?: number): void;
6
+ }
7
+ //# sourceMappingURL=throttle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"throttle.d.ts","sourceRoot":"","sources":["../../src/lib/throttle.ts"],"names":[],"mappings":"AAGA,qBAAa,QAAQ;IACnB,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAM;IAGxC,GAAG,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,GAAE,MAAW,GAAG,IAAI;CAkB3D"}
@@ -1,5 +1,5 @@
1
1
  import { VistaView } from './vista-view';
2
- export type VistaViewElmProps = {
2
+ export type VistaElmProps = {
3
3
  objectFit: string;
4
4
  borderRadius: string;
5
5
  objectPosition: string;
@@ -11,56 +11,56 @@ export type VistaViewElmProps = {
11
11
  naturalWidth?: number;
12
12
  naturalHeight?: number;
13
13
  };
14
- export type VistaViewImage = {
15
- src: string;
16
- alt?: string;
17
- thumb?: string;
18
- };
19
- export type VistaViewImageIndexed = {
20
- index: number;
21
- imageElm?: HTMLImageElement;
22
- anchorElm?: HTMLAnchorElement;
23
- } & VistaViewImage;
24
- export type VistaViewOptions = {
14
+ export type VistaOpt = {
25
15
  animationDurationBase?: number;
26
16
  initialZIndex?: number;
27
- detectReducedMotion?: boolean;
28
17
  zoomStep?: number;
29
18
  maxZoomLevel?: number;
30
19
  touchSpeedThreshold?: number;
31
20
  preloads?: number;
32
21
  keyboardListeners?: boolean;
33
22
  arrowOnSmallScreens?: boolean;
23
+ rapidLimit?: number;
34
24
  controls?: {
35
- topLeft?: (VistaViewDefaultControls | VistaViewCustomControl)[];
36
- topRight?: (VistaViewDefaultControls | VistaViewCustomControl)[];
37
- topCenter?: (VistaViewDefaultControls | VistaViewCustomControl)[];
38
- bottomCenter?: (VistaViewDefaultControls | VistaViewCustomControl)[];
39
- bottomLeft?: (VistaViewDefaultControls | VistaViewCustomControl)[];
40
- bottomRight?: (VistaViewDefaultControls | VistaViewCustomControl)[];
25
+ topLeft?: (VistaDefaultCtrl | VistaCustomCtrl)[];
26
+ topRight?: (VistaDefaultCtrl | VistaCustomCtrl)[];
27
+ topCenter?: (VistaDefaultCtrl | VistaCustomCtrl)[];
28
+ bottomCenter?: (VistaDefaultCtrl | VistaCustomCtrl)[];
29
+ bottomLeft?: (VistaDefaultCtrl | VistaCustomCtrl)[];
30
+ bottomRight?: (VistaDefaultCtrl | VistaCustomCtrl)[];
41
31
  };
42
- onImageView?: (params: VistaViewData) => void;
43
- onOpen?: (params: VistaViewData) => void;
44
- onClose?: (params: VistaViewData) => void;
45
- transitionFunction?: VistaViewTransitionFunction;
46
- setupFunction?: VistaViewSetupFunction;
47
- closeFunction?: VistaViewCloseFunction;
48
- initFunction?: VistaViewInitFunction;
32
+ onImageView?: (params: VistaData) => void;
33
+ onOpen?: (vistaView: VistaView) => void;
34
+ onClose?: (vistaView: VistaView) => void;
35
+ transitionFunction?: VistaTransitionFn;
36
+ setupFunction?: VistaSetupFn;
37
+ closeFunction?: VistaCloseFn;
38
+ initFunction?: VistaInitFn;
49
39
  };
50
- export type VistaViewDefaultControls = 'indexDisplay' | 'zoomIn' | 'zoomOut' | 'close' | 'description';
51
- export type VistaViewCustomControl = {
40
+ export type VistaDefaultCtrl = 'indexDisplay' | 'zoomIn' | 'zoomOut' | 'close' | 'description';
41
+ export type VistaImg = {
42
+ src: string;
43
+ alt?: string;
44
+ thumb?: string;
45
+ };
46
+ export type VistaImgIdx = {
47
+ index: number;
48
+ imageElm?: HTMLImageElement;
49
+ anchorElm?: HTMLAnchorElement;
50
+ } & VistaImg;
51
+ export type VistaCustomCtrl = {
52
52
  name: string;
53
53
  icon: string;
54
- onClick: (v: VistaViewImageIndexed) => void | Promise<void>;
54
+ onClick: (vistaImageIndex: VistaImgIdx, vistaView: VistaView) => void | Promise<void>;
55
55
  };
56
- export type VistaViewData = {
56
+ export type VistaData = {
57
57
  htmlElements: {
58
58
  from: HTMLElement[] | null;
59
59
  to: HTMLElement[] | null;
60
60
  };
61
61
  images: {
62
- from: VistaViewImageIndexed[] | null;
63
- to: VistaViewImageIndexed[] | null;
62
+ from: VistaImgIdx[] | null;
63
+ to: VistaImgIdx[] | null;
64
64
  };
65
65
  index: {
66
66
  from: number | null;
@@ -72,8 +72,42 @@ export type VistaViewData = {
72
72
  };
73
73
  vistaView: VistaView;
74
74
  };
75
- export type VistaViewTransitionFunction = (params: VistaViewData, abortSignal: AbortSignal) => Promise<void>;
76
- export type VistaViewSetupFunction = (params: VistaViewData) => void;
77
- export type VistaViewCloseFunction = (vistaView: VistaView) => void;
78
- export type VistaViewInitFunction = (vistaView: VistaView) => void;
75
+ export type VistaTransitionFn = (params: VistaData, abortSignal: AbortSignal) => Promise<void | (() => void)>;
76
+ export type VistaSetupFn = (params: VistaData) => void;
77
+ export type VistaCloseFn = (vistaView: VistaView) => void;
78
+ export type VistaInitFn = (vistaView: VistaView) => void;
79
+ export type VistaParams = {
80
+ elements: string | NodeListOf<HTMLElement> | VistaImg[];
81
+ } & VistaOpt;
82
+ export type VistaInterface = {
83
+ open: (startIndex?: number) => void;
84
+ close: () => Promise<void>;
85
+ next: () => void;
86
+ prev: () => void;
87
+ destroy: () => void;
88
+ getCurrentIndex: () => number;
89
+ view: (index: number) => void;
90
+ };
91
+ export type VistaPointerArgs = {
92
+ elm?: HTMLElement | Document;
93
+ listeners?: VistaPointerListener[];
94
+ };
95
+ export type VistaPointer = {
96
+ x: number;
97
+ y: number;
98
+ movementX: number;
99
+ movementY: number;
100
+ id: number | string;
101
+ };
102
+ export type VistaPointerEvent = 'down' | 'move' | 'up' | 'cancel';
103
+ export type VistaPointerListenerArgs = {
104
+ event: VistaPointerEvent;
105
+ pointer: VistaPointer;
106
+ pointers: VistaPointer[];
107
+ lastPointerLen: number;
108
+ };
109
+ export type VistaPointerListener = (args: VistaPointerListenerArgs) => void;
110
+ export type VistaExternalPointerListenerArgs = VistaPointerListenerArgs & {
111
+ hasInternalExecution: boolean;
112
+ };
79
113
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,SAAS,CAAC,EAAE,iBAAiB,CAAC;CAC/B,GAAG,cAAc,CAAC;AAEnB,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AC,EAAE,oBAAoB,EAAE,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,QAAQ,CAAC;AAClE,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,iBAAiB,CAAC;IACzB,OAAO,EAAE,YAAY,CAAC;IACtB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,cAAc,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,CAAC,IAAI,EAAE,wBAAwB,KAAK,IAAI,CAAC;AAE5E,MAAM,MAAM,gCAAgC,GAAG,wBAAwB,GAAG;IACxE,oBAAoB,EAAE,OAAO,CAAC;CAC/B,CAAC"}
@@ -1,19 +1,27 @@
1
- import { VistaViewElmProps } from './types';
2
- export declare function getElmProperties(elm: HTMLElement): VistaViewElmProps;
3
- export declare function createTrustedHtml(htmlString: string): DocumentFragment;
1
+ import { VistaElmProps, VistaImgIdx } from './types';
4
2
  export declare function isNotZeroCssValue(value?: string): false | string | undefined;
5
3
  export declare function getFittedSize(img: HTMLImageElement): {
6
4
  width: number;
7
5
  height: number;
8
6
  };
7
+ export declare function getElmProperties(elm: HTMLElement): VistaElmProps;
8
+ export declare function getElmProps(el: VistaImgIdx): {
9
+ fit: string;
10
+ pos: string;
11
+ br: string;
12
+ overflow: string;
13
+ nw: number;
14
+ nh: number;
15
+ w: number;
16
+ h: number;
17
+ top: number;
18
+ left: number;
19
+ };
20
+ export declare function setImageStyles(el: VistaImgIdx, hi: HTMLImageElement, lo: HTMLImageElement, init?: boolean): void;
9
21
  export declare function getFullSizeDim(img: HTMLImageElement): {
10
22
  width: number;
11
23
  height: number;
12
24
  };
13
- export declare function getMaxMinZoomLevels(currentWidth: number, currentHeight: number): {
14
- maxDiffX: number;
15
- minDiffY: number;
16
- maxDiffY: number;
17
- minDiffX: number;
18
- };
25
+ export declare function clamp(value: number, min: number, max: number): number;
26
+ export declare function limitPrecision(value: number, precision?: number): number;
19
27
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAEjD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,WAAW,GAAG,iBAAiB,CAepE;AAyBD,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,gBAAgB,CAQtE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,SAAS,CAI5E;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,gBAAgB,GAAG;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CA8DA;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,gBAAgB,GAAG;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAwCA;AAED,wBAAgB,mBAAmB,CACjC,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,MAAM,GACpB;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAgBA"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;A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