vistaview 0.7.7 → 0.10.9
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 +276 -97
- package/dist/extensions/dailymotion-video.d.ts +2 -0
- package/dist/extensions/dailymotion-video.js +80 -0
- package/dist/extensions/dailymotion-video.umd.js +1 -0
- package/dist/extensions/download.d.ts +2 -0
- package/dist/extensions/download.js +35 -0
- package/dist/extensions/download.umd.js +1 -0
- package/dist/extensions/google-maps.d.ts +2 -0
- package/dist/extensions/google-maps.js +94 -0
- package/dist/extensions/google-maps.umd.js +1 -0
- package/dist/extensions/image-story.d.ts +2 -0
- package/dist/extensions/image-story.js +621 -0
- package/dist/extensions/image-story.umd.js +2 -0
- package/dist/extensions/logger.d.ts +2 -0
- package/dist/extensions/logger.js +23 -0
- package/dist/extensions/logger.umd.js +1 -0
- package/dist/extensions/mapbox.d.ts +2 -0
- package/dist/extensions/mapbox.js +124 -0
- package/dist/extensions/mapbox.umd.js +1 -0
- package/dist/extensions/openstreetmap.d.ts +2 -0
- package/dist/extensions/openstreetmap.js +125 -0
- package/dist/extensions/openstreetmap.umd.js +1 -0
- package/dist/extensions/streamable-video.d.ts +2 -0
- package/dist/extensions/streamable-video.js +76 -0
- package/dist/extensions/streamable-video.umd.js +1 -0
- package/dist/extensions/vidyard-video.d.ts +2 -0
- package/dist/extensions/vidyard-video.js +80 -0
- package/dist/extensions/vidyard-video.umd.js +1 -0
- package/dist/extensions/vimeo-video.d.ts +2 -0
- package/dist/extensions/vimeo-video.js +76 -0
- package/dist/extensions/vimeo-video.umd.js +1 -0
- package/dist/extensions/wistia-video.d.ts +2 -0
- package/dist/extensions/wistia-video.js +85 -0
- package/dist/extensions/wistia-video.umd.js +1 -0
- package/dist/extensions/youtube-video.d.ts +2 -0
- package/dist/extensions/youtube-video.js +88 -0
- package/dist/extensions/youtube-video.umd.js +1 -0
- package/dist/lib/components.d.ts +1 -3
- package/dist/lib/components.d.ts.map +1 -1
- package/dist/lib/defaults/image-setup.d.ts +3 -0
- package/dist/lib/defaults/image-setup.d.ts.map +1 -0
- package/dist/lib/defaults/init.d.ts.map +1 -1
- package/dist/lib/defaults/open.d.ts +3 -0
- package/dist/lib/defaults/open.d.ts.map +1 -0
- package/dist/lib/defaults/options.d.ts.map +1 -1
- package/dist/lib/defaults/transition.d.ts +1 -1
- package/dist/lib/defaults/transition.d.ts.map +1 -1
- package/dist/lib/extensions/dailymotion-video.d.ts +34 -0
- package/dist/lib/extensions/dailymotion-video.d.ts.map +1 -0
- package/dist/lib/extensions/download.d.ts +3 -0
- package/dist/lib/extensions/download.d.ts.map +1 -0
- package/dist/lib/extensions/google-maps.d.ts +49 -0
- package/dist/lib/extensions/google-maps.d.ts.map +1 -0
- package/dist/lib/extensions/image-story.d.ts +12 -0
- package/dist/lib/extensions/image-story.d.ts.map +1 -0
- package/dist/lib/extensions/logger.d.ts +3 -0
- package/dist/lib/extensions/logger.d.ts.map +1 -0
- package/dist/lib/extensions/mapbox.d.ts +53 -0
- package/dist/lib/extensions/mapbox.d.ts.map +1 -0
- package/dist/lib/extensions/openstreetmap.d.ts +51 -0
- package/dist/lib/extensions/openstreetmap.d.ts.map +1 -0
- package/dist/lib/extensions/streamable-video.d.ts +32 -0
- package/dist/lib/extensions/streamable-video.d.ts.map +1 -0
- package/dist/lib/extensions/vidyard-video.d.ts +33 -0
- package/dist/lib/extensions/vidyard-video.d.ts.map +1 -0
- package/dist/lib/extensions/vimeo-video.d.ts +36 -0
- package/dist/lib/extensions/vimeo-video.d.ts.map +1 -0
- package/dist/lib/extensions/wistia-video.d.ts +34 -0
- package/dist/lib/extensions/wistia-video.d.ts.map +1 -0
- package/dist/lib/extensions/youtube-video.d.ts +38 -0
- package/dist/lib/extensions/youtube-video.d.ts.map +1 -0
- package/dist/lib/main.d.ts +2 -2
- package/dist/lib/main.d.ts.map +1 -1
- package/dist/lib/types.d.ts +135 -43
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/utils/get-fitted-size.d.ts +5 -0
- package/dist/lib/utils/get-fitted-size.d.ts.map +1 -0
- package/dist/lib/utils/get-full-size-dim.d.ts +5 -0
- package/dist/lib/utils/get-full-size-dim.d.ts.map +1 -0
- package/dist/lib/utils/get-style.d.ts +5 -0
- package/dist/lib/utils/get-style.d.ts.map +1 -0
- package/dist/lib/utils/index.d.ts +3 -0
- package/dist/lib/utils/index.d.ts.map +1 -0
- package/dist/lib/utils/is-not-zero-css.d.ts +2 -0
- package/dist/lib/utils/is-not-zero-css.d.ts.map +1 -0
- package/dist/lib/utils/parse-element.d.ts +3 -0
- package/dist/lib/utils/parse-element.d.ts.map +1 -0
- package/dist/lib/vista-box.d.ts +107 -0
- package/dist/lib/vista-box.d.ts.map +1 -0
- package/dist/lib/vista-hires-transition.d.ts +32 -0
- package/dist/lib/vista-hires-transition.d.ts.map +1 -0
- package/dist/lib/vista-image-event.d.ts +23 -0
- package/dist/lib/vista-image-event.d.ts.map +1 -0
- package/dist/lib/vista-image.d.ts +33 -0
- package/dist/lib/vista-image.d.ts.map +1 -0
- package/dist/lib/{pointers.d.ts → vista-pointers.d.ts} +1 -1
- package/dist/lib/vista-pointers.d.ts.map +1 -0
- package/dist/lib/vista-state.d.ts +18 -0
- package/dist/lib/vista-state.d.ts.map +1 -0
- package/dist/lib/vista-view.d.ts +28 -31
- package/dist/lib/vista-view.d.ts.map +1 -1
- package/dist/react.d.ts +9 -9
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +59 -49
- package/dist/solid.d.ts +8 -11
- package/dist/solid.d.ts.map +1 -1
- package/dist/solid.js +28 -32
- package/dist/style.css +1 -1
- package/dist/styles/autumn-amber.css +1 -0
- package/dist/styles/autumn-amber.d.ts +1 -0
- package/dist/styles/cotton-candy.css +1 -0
- package/dist/styles/cotton-candy.d.ts +1 -0
- package/dist/styles/dark-rounded.css +1 -1
- package/dist/styles/ember-glow.css +1 -0
- package/dist/styles/ember-glow.d.ts +1 -0
- package/dist/styles/extensions/image-story.css +1 -0
- package/dist/styles/extensions/image-story.d.ts +1 -0
- package/dist/styles/forest-moss.css +1 -0
- package/dist/styles/forest-moss.d.ts +1 -0
- package/dist/styles/green-lake.css +1 -0
- package/dist/styles/green-lake.d.ts +1 -0
- package/dist/styles/ice-crystal.css +1 -0
- package/dist/styles/ice-crystal.d.ts +1 -0
- package/dist/styles/lavender-fields.css +1 -0
- package/dist/styles/lavender-fields.d.ts +1 -0
- package/dist/styles/midnight-gold.css +1 -0
- package/dist/styles/midnight-gold.d.ts +1 -0
- package/dist/styles/midnight-ocean.css +1 -0
- package/dist/styles/midnight-ocean.d.ts +1 -0
- package/dist/styles/mint-chocolate.css +1 -0
- package/dist/styles/mint-chocolate.d.ts +1 -0
- package/dist/styles/neon-nights.css +1 -0
- package/dist/styles/neon-nights.d.ts +1 -0
- package/dist/styles/paper-light.css +1 -0
- package/dist/styles/paper-light.d.ts +1 -0
- package/dist/styles/retro-arcade.css +1 -0
- package/dist/styles/retro-arcade.d.ts +1 -0
- package/dist/styles/soft-neutral.css +1 -0
- package/dist/styles/soft-neutral.d.ts +1 -0
- package/dist/styles/stark-minimal.css +1 -0
- package/dist/styles/stark-minimal.d.ts +1 -0
- package/dist/styles/strawberry.css +1 -0
- package/dist/styles/strawberry.d.ts +1 -0
- package/dist/svelte.d.ts +11 -2
- package/dist/svelte.d.ts.map +1 -1
- package/dist/svelte.js +36 -14
- package/dist/vista-box-CQvGrjln.js +318 -0
- package/dist/vistaview.d.ts +9 -2
- package/dist/vistaview.d.ts.map +1 -1
- package/dist/vistaview.js +740 -670
- package/dist/vistaview.umd.js +14 -7
- package/dist/vue.d.ts +28 -9
- package/dist/vue.d.ts.map +1 -1
- package/dist/vue.js +43 -24
- package/package.json +8 -3
- package/dist/lib/defaults/setup.d.ts +0 -3
- package/dist/lib/defaults/setup.d.ts.map +0 -1
- package/dist/lib/errors.d.ts +0 -4
- package/dist/lib/errors.d.ts.map +0 -1
- package/dist/lib/image-state.d.ts +0 -40
- package/dist/lib/image-state.d.ts.map +0 -1
- package/dist/lib/pointers.d.ts.map +0 -1
- package/dist/lib/utils.d.ts +0 -27
- package/dist/lib/utils.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# VistaView
|
|
2
2
|
|
|
3
|
-
⚠️ **This is
|
|
3
|
+
> ⚠️ **Not Ready for Production** — This library is currently under active development and is not yet stable. APIs may change without notice. Use at your own risk.
|
|
4
4
|
|
|
5
5
|
A lightweight, modern image lightbox library for the web. Zero dependencies, framework-agnostic, and highly customizable.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- 🪶 **Lightweight** — ~
|
|
9
|
+
- 🪶 **Lightweight** — ~41KB ESM (~10KB gzip), minimal footprint
|
|
10
10
|
- 📱 **Touch-first** — Swipe gestures for navigation and closing, pinch-to-zoom support
|
|
11
11
|
- 🎨 **Customizable** — Configurable controls, animations, and styling via CSS variables
|
|
12
12
|
- ♿ **Accessible** — Keyboard navigation, ARIA labels, reduced motion support
|
|
@@ -14,6 +14,8 @@ A lightweight, modern image lightbox library for the web. Zero dependencies, fra
|
|
|
14
14
|
- 🖼️ **Progressive loading** — Low-res thumbnails → high-res images with smooth transitions
|
|
15
15
|
- 🔍 **Smart zoom** — Pan and zoom with momentum physics, respects actual image resolution
|
|
16
16
|
- 🎯 **Pointer-aware** — Advanced multi-touch tracking with context menu prevention
|
|
17
|
+
- 🎬 **Video embeds** — Support for YouTube, Vimeo, Dailymotion, Wistia, Vidyard, Streamable
|
|
18
|
+
- 🗺️ **Map embeds** — Support for Google Maps, Mapbox, OpenStreetMap with interactive controls
|
|
17
19
|
|
|
18
20
|
## Installation
|
|
19
21
|
|
|
@@ -82,51 +84,46 @@ vistaView({
|
|
|
82
84
|
});
|
|
83
85
|
```
|
|
84
86
|
|
|
85
|
-
### Using a NodeList
|
|
86
|
-
|
|
87
|
-
```js
|
|
88
|
-
vistaView({
|
|
89
|
-
elements: document.querySelectorAll('.gallery-image'),
|
|
90
|
-
});
|
|
91
|
-
```
|
|
92
|
-
|
|
93
87
|
### Using an array of images
|
|
94
88
|
|
|
95
89
|
```js
|
|
96
90
|
vistaView({
|
|
97
91
|
elements: [
|
|
98
|
-
{ src: '/images/photo1.jpg',
|
|
99
|
-
{
|
|
92
|
+
{ src: '/images/photo1.jpg', alt: 'Photo 1' },
|
|
93
|
+
{
|
|
94
|
+
src: '/images/photo2-800.jpg',
|
|
95
|
+
alt: 'Photo 2',
|
|
96
|
+
srcSet: '/images/photo2-800.jpg 800w, /images/photo2-1200.jpg 1200w',
|
|
97
|
+
},
|
|
100
98
|
],
|
|
101
99
|
});
|
|
102
100
|
```
|
|
103
101
|
|
|
102
|
+
**Note:** When using an array of image objects, thumbnails are not supported. Use DOM elements (anchor tags or img tags) if you need progressive loading from thumbnails.
|
|
103
|
+
|
|
104
104
|
## Options
|
|
105
105
|
|
|
106
106
|
```ts
|
|
107
|
-
import { vistaView
|
|
107
|
+
import { vistaView } from 'vistaview';
|
|
108
108
|
|
|
109
109
|
vistaView({
|
|
110
|
-
// Required: specify elements (string selector
|
|
111
|
-
elements: string |
|
|
110
|
+
// Required: specify elements (string selector or array)
|
|
111
|
+
elements: string | VistaImgConfig[],
|
|
112
112
|
|
|
113
113
|
// Optional configuration
|
|
114
114
|
animationDurationBase: 333, // Base animation duration in ms (default: 333)
|
|
115
|
-
initialZIndex: 1, // Starting z-index for the lightbox (default: 1)
|
|
116
115
|
maxZoomLevel: 2, // Maximum zoom multiplier (default: 2)
|
|
117
116
|
preloads: 1, // Number of adjacent images to preload on each side (default: 1)
|
|
118
117
|
keyboardListeners: true, // Enable keyboard navigation (default: true)
|
|
119
118
|
arrowOnSmallScreens: false, // Show prev/next arrows on screens < 768px (default: false)
|
|
120
|
-
rapidLimit:
|
|
119
|
+
rapidLimit: 222, // Minimum time between rapid actions in ms (default: 222)
|
|
120
|
+
initialZIndex: 1, // Starting z-index for the lightbox (optional, no default)
|
|
121
121
|
|
|
122
122
|
// Control placement (defaults shown)
|
|
123
123
|
controls: {
|
|
124
124
|
topLeft: ['indexDisplay'],
|
|
125
|
-
topRight: ['zoomIn', 'zoomOut',
|
|
126
|
-
|
|
127
|
-
bottomLeft: [],
|
|
128
|
-
bottomCenter: ['description'],
|
|
129
|
-
bottomRight: [],
|
|
125
|
+
topRight: ['zoomIn', 'zoomOut', 'close'],
|
|
126
|
+
bottomLeft: ['description'],
|
|
130
127
|
},
|
|
131
128
|
|
|
132
129
|
// Events
|
|
@@ -137,78 +134,114 @@ vistaView({
|
|
|
137
134
|
// Custom behavior functions (advanced)
|
|
138
135
|
initFunction: (vistaView) => {}, // Custom initialization (runs on open)
|
|
139
136
|
setupFunction: (data) => {}, // Custom setup when navigating
|
|
140
|
-
transitionFunction: (data, abortSignal) =>
|
|
137
|
+
transitionFunction: (data, abortSignal) => {}, // Custom transition animation (returns cleanup function and promise)
|
|
141
138
|
closeFunction: (vistaView) => {}, // Custom cleanup on close
|
|
142
139
|
});
|
|
143
140
|
```
|
|
144
141
|
|
|
145
142
|
## Default Controls
|
|
146
143
|
|
|
147
|
-
| Control
|
|
148
|
-
|
|
|
149
|
-
| `indexDisplay`
|
|
150
|
-
| `zoomIn`
|
|
151
|
-
| `zoomOut`
|
|
152
|
-
| `
|
|
153
|
-
| `
|
|
154
|
-
| `description` | Shows the image alt text |
|
|
144
|
+
| Control | Description |
|
|
145
|
+
| -------------- | ----------------------------------------- |
|
|
146
|
+
| `indexDisplay` | Shows current image index (e.g., "1 / 5") |
|
|
147
|
+
| `zoomIn` | Zoom into the image |
|
|
148
|
+
| `zoomOut` | Zoom out of the image |
|
|
149
|
+
| `close` | Close the lightbox |
|
|
150
|
+
| `description` | Shows the image alt text |
|
|
155
151
|
|
|
156
|
-
|
|
152
|
+
**Note:** Controls can be either built-in control names (strings) or extension instances. See the [Extensions](#extensions) section for adding additional functionality like download buttons or image stories.
|
|
157
153
|
|
|
158
|
-
|
|
154
|
+
## Extensions
|
|
159
155
|
|
|
160
|
-
|
|
161
|
-
import { vistaView, vistaViewDownload } from 'vistaview';
|
|
156
|
+
VistaView provides optional extensions for additional functionality. Extensions are available in both ESM and UMD formats.
|
|
162
157
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
158
|
+
👉 **[View detailed extension documentation and usage examples](./extensions.md)**
|
|
159
|
+
|
|
160
|
+
👉 **[Learn how to create your own extensions](./extensions-authoring.md)**
|
|
161
|
+
|
|
162
|
+
### Available Extensions
|
|
163
|
+
|
|
164
|
+
**UI Extensions:**
|
|
165
|
+
|
|
166
|
+
- **`download`** — Adds a download button to save the current high-resolution image (1.42 KB ESM / 1.41 KB UMD)
|
|
167
|
+
- **`image-story`** — Display rich HTML content alongside images with XSS protection (33.60 KB ESM / 25.28 KB UMD)
|
|
168
|
+
|
|
169
|
+
**Video Platform Extensions:**
|
|
170
|
+
|
|
171
|
+
- **`youtube-video`** — Embed YouTube videos (3.10 KB ESM / 14.07 KB UMD)
|
|
172
|
+
- **`vimeo-video`** — Embed Vimeo videos (2.65 KB ESM / 13.69 KB UMD)
|
|
173
|
+
- **`dailymotion-video`** — Embed Dailymotion videos (2.80 KB ESM / 13.82 KB UMD)
|
|
174
|
+
- **`wistia-video`** — Embed Wistia videos (2.93 KB ESM / 13.92 KB UMD)
|
|
175
|
+
- **`vidyard-video`** — Embed Vidyard videos (2.73 KB ESM / 13.75 KB UMD)
|
|
176
|
+
- **`streamable-video`** — Embed Streamable videos (2.69 KB ESM / 13.73 KB UMD)
|
|
177
|
+
|
|
178
|
+
**Map Extensions:**
|
|
179
|
+
|
|
180
|
+
- **`google-maps`** — Embed Google Maps (requires API key) (3.65 KB ESM / 14.56 KB UMD)
|
|
181
|
+
- **`mapbox`** — Embed Mapbox GL JS interactive maps (requires access token) (4.99 KB ESM / 15.63 KB UMD)
|
|
182
|
+
- **`openstreetmap`** — Embed OpenStreetMap with Leaflet.js (free, no API key) (4.79 KB ESM / 15.43 KB UMD)
|
|
183
|
+
|
|
184
|
+
**Development Extensions:**
|
|
185
|
+
|
|
186
|
+
- **`logger`** — Debug extension that logs all lifecycle events (0.61 KB ESM / 0.76 KB UMD)
|
|
182
187
|
|
|
183
188
|
## Exported Types & Functions
|
|
184
189
|
|
|
185
|
-
VistaView exports all types for TypeScript users, plus helper functions:
|
|
190
|
+
VistaView exports all types for TypeScript users, plus helper functions and internal classes:
|
|
186
191
|
|
|
187
192
|
```ts
|
|
188
|
-
import {
|
|
189
|
-
vistaView,
|
|
190
|
-
vistaViewDownload, // Helper function for download control
|
|
191
|
-
DefaultOptions, // Default configuration options
|
|
192
|
-
setup, // Default setup function
|
|
193
|
-
init, // Default init function
|
|
194
|
-
close, // Default close function
|
|
195
|
-
transition, // Default transition function
|
|
196
|
-
} from 'vistaview';
|
|
193
|
+
import { vistaView } from 'vistaview';
|
|
197
194
|
|
|
195
|
+
// All types are exported via `export type *`
|
|
198
196
|
import type {
|
|
199
|
-
|
|
197
|
+
// Configuration types
|
|
198
|
+
VistaParamsNeo, // Full options including `elements`
|
|
200
199
|
VistaOpt, // Base options (without `elements`)
|
|
201
|
-
|
|
202
|
-
|
|
200
|
+
|
|
201
|
+
// Image types
|
|
202
|
+
VistaImgConfig, // Image configuration: { src, alt?, srcSet? }
|
|
203
|
+
VistaImgOrigin, // Origin element properties
|
|
204
|
+
VistaParsedElm, // Parsed element return type from parseElement
|
|
205
|
+
|
|
206
|
+
// Interface types
|
|
203
207
|
VistaInterface, // Return type from vistaView()
|
|
204
208
|
VistaData, // Data passed to events/functions
|
|
205
|
-
|
|
209
|
+
VistaImageState, // Image state interface
|
|
210
|
+
|
|
211
|
+
// Function types
|
|
212
|
+
VistaImageSetupFn, // Type for imageSetupFunction
|
|
206
213
|
VistaTransitionFn, // Type for transitionFunction
|
|
214
|
+
VistaOpenFn, // Type for openFunction
|
|
207
215
|
VistaCloseFn, // Type for closeFunction
|
|
208
216
|
VistaInitFn, // Type for initFunction
|
|
209
|
-
|
|
217
|
+
|
|
218
|
+
// Control types
|
|
210
219
|
VistaDefaultCtrl, // Built-in control names
|
|
211
|
-
|
|
220
|
+
VistaExtension, // Extension interface for adding functionality
|
|
221
|
+
|
|
222
|
+
// Pointer types
|
|
223
|
+
VistaPointerArgs, // Pointer system arguments
|
|
224
|
+
VistaPointer, // Single pointer state
|
|
225
|
+
VistaPointerListenerArgs, // Internal pointer listener args
|
|
226
|
+
VistaPointerListener, // Internal pointer listener type
|
|
227
|
+
VistaExternalPointerListenerArgs, // External pointer listener args
|
|
228
|
+
} from 'vistaview';
|
|
229
|
+
|
|
230
|
+
// Optional: Default behavior functions and internal classes (advanced usage)
|
|
231
|
+
import {
|
|
232
|
+
DefaultOptions, // Default configuration options
|
|
233
|
+
imageSetup, // Default image setup function
|
|
234
|
+
init, // Default init function (runs on class initialization)
|
|
235
|
+
open, // Default open function (runs when viewer opens)
|
|
236
|
+
close, // Default close function
|
|
237
|
+
transition, // Default transition function
|
|
238
|
+
VistaImageEvent, // Event handling system
|
|
239
|
+
VistaHiresTransition, // High-resolution image transition manager
|
|
240
|
+
VistaBox, // Base class for image containers
|
|
241
|
+
VistaImage, // Individual image instance class
|
|
242
|
+
VistaPointers, // Multi-pointer tracking system
|
|
243
|
+
VistaState, // State management class
|
|
244
|
+
VistaView, // Main view controller class
|
|
212
245
|
} from 'vistaview';
|
|
213
246
|
```
|
|
214
247
|
|
|
@@ -233,7 +266,23 @@ import 'vistaview/styles/dark-rounded.css'; // Optional theme
|
|
|
233
266
|
|
|
234
267
|
Available themes:
|
|
235
268
|
|
|
269
|
+
- `autumn-amber` - Warm oranges and browns with earthy tones
|
|
270
|
+
- `cotton-candy` - Playful pastel pink with soft styling
|
|
236
271
|
- `dark-rounded` - Dark theme with rounded corners and animated navigation buttons
|
|
272
|
+
- `ember-glow` - Dark theme with orange glow effects
|
|
273
|
+
- `forest-moss` - Earthy greens inspired by nature
|
|
274
|
+
- `green-lake` - Calming teal and green palette with smooth transitions
|
|
275
|
+
- `ice-crystal` - Cool light blue palette with crisp styling
|
|
276
|
+
- `lavender-fields` - Soft purple palette with gentle animations
|
|
277
|
+
- `midnight-gold` - Elegant black background with gold accents
|
|
278
|
+
- `midnight-ocean` - Deep navy blues with cyan accents
|
|
279
|
+
- `mint-chocolate` - Brown and mint green combination
|
|
280
|
+
- `neon-nights` - Cyberpunk-inspired magenta and cyan with glowing effects
|
|
281
|
+
- `paper-light` - Light theme with subtle shadows and paper-like appearance
|
|
282
|
+
- `retro-arcade` - Bold primary colors with classic arcade aesthetics
|
|
283
|
+
- `soft-neutral` - Warm beige and cream tones with maximum roundness
|
|
284
|
+
- `stark-minimal` - Pure black and white, zero border radius, minimalist design
|
|
285
|
+
- `strawberry` - Vibrant pink and red gradient theme
|
|
237
286
|
|
|
238
287
|
### CSS Custom Properties
|
|
239
288
|
|
|
@@ -251,11 +300,13 @@ VistaView uses CSS custom properties for easy customization:
|
|
|
251
300
|
|
|
252
301
|
## Data Attributes
|
|
253
302
|
|
|
254
|
-
| Attribute
|
|
255
|
-
|
|
|
256
|
-
| `data-vistaview-src`
|
|
257
|
-
| `data-vistaview-
|
|
258
|
-
| `data-vistaview-
|
|
303
|
+
| Attribute | Description |
|
|
304
|
+
| ----------------------- | ---------------------------------------------------------------------------------------- |
|
|
305
|
+
| `data-vistaview-src` | Full-size image URL (overrides href/src) |
|
|
306
|
+
| `data-vistaview-srcset` | Responsive image srcset (overrides native srcset) |
|
|
307
|
+
| `data-vistaview-alt` | Alt text for lightbox (overrides the element's alt attribute if you want different text) |
|
|
308
|
+
|
|
309
|
+
**Note:** Thumbnails are automatically detected from the element's `src` attribute or nested `<img>` element.
|
|
259
310
|
|
|
260
311
|
## Keyboard Navigation
|
|
261
312
|
|
|
@@ -269,13 +320,12 @@ VistaView uses CSS custom properties for easy customization:
|
|
|
269
320
|
|
|
270
321
|
## Touch Gestures
|
|
271
322
|
|
|
272
|
-
| Gesture | Action
|
|
273
|
-
| ---------------- |
|
|
274
|
-
| Swipe left/right | Navigate between images
|
|
275
|
-
| Swipe up/down | Close lightbox
|
|
276
|
-
| Pinch in/out | Zoom in/out
|
|
277
|
-
| Drag | Pan image (when zoomed)
|
|
278
|
-
| Single tap | Toggle UI visibility |
|
|
323
|
+
| Gesture | Action |
|
|
324
|
+
| ---------------- | ----------------------- |
|
|
325
|
+
| Swipe left/right | Navigate between images |
|
|
326
|
+
| Swipe up/down | Close lightbox |
|
|
327
|
+
| Pinch in/out | Zoom in/out |
|
|
328
|
+
| Drag | Pan image (when zoomed) |
|
|
279
329
|
|
|
280
330
|
## Browser Support
|
|
281
331
|
|
|
@@ -327,27 +377,156 @@ VistaView is built with accessibility in mind:
|
|
|
327
377
|
|
|
328
378
|
```
|
|
329
379
|
vite v6.4.1 building for production...
|
|
330
|
-
✓
|
|
380
|
+
✓ 60 modules transformed.
|
|
381
|
+
|
|
382
|
+
[vite:dts] Start generate declaration files...
|
|
383
|
+
dist/styles/stark-minimal.css 1.45 kB │ gzip: 0.36 kB
|
|
384
|
+
dist/styles/dark-rounded.css 1.58 kB │ gzip: 0.38 kB
|
|
385
|
+
dist/styles/autumn-amber.css 1.65 kB │ gzip: 0.41 kB
|
|
386
|
+
dist/styles/forest-moss.css 1.65 kB │ gzip: 0.41 kB
|
|
387
|
+
dist/styles/green-lake.css 1.65 kB │ gzip: 0.41 kB
|
|
388
|
+
dist/styles/ice-crystal.css 1.65 kB │ gzip: 0.41 kB
|
|
389
|
+
dist/styles/soft-neutral.css 1.65 kB │ gzip: 0.40 kB
|
|
390
|
+
dist/styles/strawberry.css 1.65 kB │ gzip: 0.41 kB
|
|
391
|
+
dist/styles/lavender-fields.css 1.65 kB │ gzip: 0.41 kB
|
|
392
|
+
dist/styles/cotton-candy.css 1.68 kB │ gzip: 0.42 kB
|
|
393
|
+
dist/styles/midnight-ocean.css 1.70 kB │ gzip: 0.42 kB
|
|
394
|
+
dist/styles/midnight-gold.css 1.71 kB │ gzip: 0.42 kB
|
|
395
|
+
dist/styles/mint-chocolate.css 1.72 kB │ gzip: 0.43 kB
|
|
396
|
+
dist/styles/neon-nights.css 1.78 kB │ gzip: 0.45 kB
|
|
397
|
+
dist/styles/paper-light.css 1.86 kB │ gzip: 0.45 kB
|
|
398
|
+
dist/styles/ember-glow.css 1.89 kB │ gzip: 0.46 kB
|
|
399
|
+
dist/styles/retro-arcade.css 2.03 kB │ gzip: 0.49 kB
|
|
400
|
+
dist/styles/extensions/image-story.css 2.52 kB │ gzip: 0.72 kB
|
|
401
|
+
dist/style.css 7.06 kB │ gzip: 1.72 kB
|
|
402
|
+
dist/extensions/logger.js 0.61 kB │ gzip: 0.23 kB
|
|
403
|
+
dist/solid.js 1.16 kB │ gzip: 0.51 kB
|
|
404
|
+
dist/svelte.js 1.23 kB │ gzip: 0.54 kB
|
|
405
|
+
dist/extensions/download.js 1.65 kB │ gzip: 0.76 kB
|
|
406
|
+
dist/vue.js 1.84 kB │ gzip: 0.74 kB
|
|
407
|
+
dist/react.js 2.12 kB │ gzip: 0.70 kB
|
|
408
|
+
dist/extensions/vimeo-video.js 2.91 kB │ gzip: 1.34 kB
|
|
409
|
+
dist/extensions/streamable-video.js 2.95 kB │ gzip: 1.34 kB
|
|
410
|
+
dist/extensions/vidyard-video.js 2.99 kB │ gzip: 1.35 kB
|
|
411
|
+
dist/extensions/dailymotion-video.js 3.05 kB │ gzip: 1.37 kB
|
|
412
|
+
dist/extensions/wistia-video.js 3.18 kB │ gzip: 1.46 kB
|
|
413
|
+
dist/extensions/youtube-video.js 3.35 kB │ gzip: 1.52 kB
|
|
414
|
+
dist/extensions/google-maps.js 3.91 kB │ gzip: 1.71 kB
|
|
415
|
+
dist/extensions/openstreetmap.js 5.28 kB │ gzip: 2.06 kB
|
|
416
|
+
dist/extensions/mapbox.js 5.48 kB │ gzip: 2.08 kB
|
|
417
|
+
dist/vista-box-CQvGrjln.js 15.00 kB │ gzip: 3.93 kB
|
|
418
|
+
dist/extensions/image-story.js 33.60 kB │ gzip: 10.84 kB
|
|
419
|
+
dist/vistaview.js 42.03 kB │ gzip: 10.28 kB
|
|
420
|
+
[vite:dts] Declaration files built in 798ms.
|
|
421
|
+
|
|
422
|
+
✓ built in 1.03s
|
|
423
|
+
|
|
424
|
+
> vistaview@0.10.7 build:umd
|
|
425
|
+
|
|
426
|
+
vite v6.4.1 building for production...
|
|
427
|
+
✓ 21 modules transformed.
|
|
428
|
+
|
|
429
|
+
[vite:dts] Start generate declaration files...
|
|
430
|
+
dist/vistaview.umd.js 42.71 kB │ gzip: 11.57 kB
|
|
431
|
+
[vite:dts] Declaration files built in 786ms.
|
|
432
|
+
|
|
433
|
+
✓ built in 892ms
|
|
434
|
+
vite v6.4.1 building for production...
|
|
435
|
+
✓ 1 modules transformed.
|
|
436
|
+
|
|
437
|
+
[vite:dts] Start generate declaration files...
|
|
438
|
+
dist/extensions/download.umd.js 1.58 kB │ gzip: 0.84 kB
|
|
439
|
+
[vite:dts] Declaration files built in 789ms.
|
|
440
|
+
|
|
441
|
+
✓ built in 822ms
|
|
442
|
+
vite v6.4.1 building for production...
|
|
443
|
+
✓ 1 modules transformed.
|
|
444
|
+
|
|
445
|
+
[vite:dts] Start generate declaration files...
|
|
446
|
+
dist/extensions/logger.umd.js 0.76 kB │ gzip: 0.37 kB
|
|
447
|
+
[vite:dts] Declaration files built in 767ms.
|
|
448
|
+
|
|
449
|
+
✓ built in 793ms
|
|
450
|
+
vite v6.4.1 building for production...
|
|
451
|
+
✓ 5 modules transformed.
|
|
452
|
+
|
|
453
|
+
[vite:dts] Start generate declaration files...
|
|
454
|
+
dist/extensions/image-story.umd.js 25.28 kB │ gzip: 9.81 kB
|
|
455
|
+
[vite:dts] Declaration files built in 771ms.
|
|
456
|
+
|
|
457
|
+
✓ built in 865ms
|
|
458
|
+
vite v6.4.1 building for production...
|
|
459
|
+
✓ 4 modules transformed.
|
|
460
|
+
|
|
461
|
+
[vite:dts] Start generate declaration files...
|
|
462
|
+
dist/extensions/youtube-video.umd.js 14.28 kB │ gzip: 4.46 kB
|
|
463
|
+
[vite:dts] Declaration files built in 782ms.
|
|
464
|
+
|
|
465
|
+
✓ built in 845ms
|
|
466
|
+
vite v6.4.1 building for production...
|
|
467
|
+
✓ 4 modules transformed.
|
|
468
|
+
|
|
469
|
+
[vite:dts] Start generate declaration files...
|
|
470
|
+
dist/extensions/vimeo-video.umd.js 13.90 kB │ gzip: 4.29 kB
|
|
471
|
+
[vite:dts] Declaration files built in 782ms.
|
|
472
|
+
|
|
473
|
+
✓ built in 842ms
|
|
474
|
+
vite v6.4.1 building for production...
|
|
475
|
+
✓ 4 modules transformed.
|
|
476
|
+
|
|
477
|
+
[vite:dts] Start generate declaration files...
|
|
478
|
+
dist/extensions/dailymotion-video.umd.js 14.03 kB │ gzip: 4.31 kB
|
|
479
|
+
[vite:dts] Declaration files built in 802ms.
|
|
480
|
+
|
|
481
|
+
✓ built in 863ms
|
|
482
|
+
vite v6.4.1 building for production...
|
|
483
|
+
✓ 4 modules transformed.
|
|
484
|
+
|
|
485
|
+
[vite:dts] Start generate declaration files...
|
|
486
|
+
dist/extensions/wistia-video.umd.js 14.13 kB │ gzip: 4.38 kB
|
|
487
|
+
[vite:dts] Declaration files built in 765ms.
|
|
488
|
+
|
|
489
|
+
✓ built in 825ms
|
|
490
|
+
vite v6.4.1 building for production...
|
|
491
|
+
✓ 4 modules transformed.
|
|
492
|
+
|
|
493
|
+
[vite:dts] Start generate declaration files...
|
|
494
|
+
dist/extensions/vidyard-video.umd.js 13.97 kB │ gzip: 4.29 kB
|
|
495
|
+
[vite:dts] Declaration files built in 763ms.
|
|
496
|
+
|
|
497
|
+
✓ built in 824ms
|
|
498
|
+
vite v6.4.1 building for production...
|
|
499
|
+
✓ 4 modules transformed.
|
|
500
|
+
|
|
501
|
+
[vite:dts] Start generate declaration files...
|
|
502
|
+
dist/extensions/streamable-video.umd.js 13.94 kB │ gzip: 4.29 kB
|
|
503
|
+
[vite:dts] Declaration files built in 770ms.
|
|
504
|
+
|
|
505
|
+
✓ built in 831ms
|
|
506
|
+
vite v6.4.1 building for production...
|
|
507
|
+
✓ 4 modules transformed.
|
|
331
508
|
|
|
332
509
|
[vite:dts] Start generate declaration files...
|
|
333
|
-
dist/
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
[vite:dts]
|
|
341
|
-
|
|
342
|
-
|
|
510
|
+
dist/extensions/google-maps.umd.js 14.78 kB │ gzip: 4.66 kB
|
|
511
|
+
[vite:dts] Declaration files built in 769ms.
|
|
512
|
+
|
|
513
|
+
✓ built in 834ms
|
|
514
|
+
vite v6.4.1 building for production...
|
|
515
|
+
✓ 4 modules transformed.
|
|
516
|
+
|
|
517
|
+
[vite:dts] Start generate declaration files...
|
|
518
|
+
dist/extensions/mapbox.umd.js 16.07 kB │ gzip: 4.96 kB
|
|
519
|
+
[vite:dts] Declaration files built in 801ms.
|
|
520
|
+
|
|
521
|
+
✓ built in 863ms
|
|
343
522
|
vite v6.4.1 building for production...
|
|
344
|
-
✓
|
|
523
|
+
✓ 4 modules transformed.
|
|
345
524
|
|
|
346
525
|
[vite:dts] Start generate declaration files...
|
|
347
|
-
dist/
|
|
348
|
-
[vite:dts] Declaration files built in
|
|
526
|
+
dist/extensions/openstreetmap.umd.js 15.87 kB │ gzip: 4.93 kB
|
|
527
|
+
[vite:dts] Declaration files built in 792ms.
|
|
349
528
|
|
|
350
|
-
✓ built in
|
|
529
|
+
✓ built in 856ms
|
|
351
530
|
```
|
|
352
531
|
|
|
353
532
|
## License
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var u = Object.defineProperty;
|
|
2
|
+
var f = (t, e, i) => e in t ? u(t, e, { enumerable: !0, configurable: !0, writable: !0, value: i }) : t[e] = i;
|
|
3
|
+
var a = (t, e, i) => f(t, typeof e != "symbol" ? e + "" : e, i);
|
|
4
|
+
import { V as y } from "../vista-box-CQvGrjln.js";
|
|
5
|
+
function r(t) {
|
|
6
|
+
if (!t) return null;
|
|
7
|
+
const e = [
|
|
8
|
+
/dailymotion\.com\/video\/([a-zA-Z0-9]+)/,
|
|
9
|
+
/dai\.ly\/([a-zA-Z0-9]+)/,
|
|
10
|
+
/dailymotion\.com\/embed\/video\/([a-zA-Z0-9]+)/
|
|
11
|
+
];
|
|
12
|
+
for (const i of e) {
|
|
13
|
+
const n = t.match(i);
|
|
14
|
+
if (n && n[1])
|
|
15
|
+
return n[1];
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
function p(t) {
|
|
20
|
+
const e = r(t);
|
|
21
|
+
if (!e)
|
|
22
|
+
throw new Error("Invalid Dailymotion video URL");
|
|
23
|
+
return `https://www.dailymotion.com/thumbnail/video/${e}`;
|
|
24
|
+
}
|
|
25
|
+
class h extends y {
|
|
26
|
+
constructor(i) {
|
|
27
|
+
var c;
|
|
28
|
+
super(i);
|
|
29
|
+
a(this, "element");
|
|
30
|
+
a(this, "url");
|
|
31
|
+
const n = i.elm.config.src;
|
|
32
|
+
this.url = n;
|
|
33
|
+
const l = document.createElement("div");
|
|
34
|
+
l.style.position = "relative";
|
|
35
|
+
const s = document.createElement("img");
|
|
36
|
+
l.appendChild(s), s.src = ((c = this.origin) == null ? void 0 : c.image.src) || p(n), s.style.width = "100%", s.style.height = "100%", s.style.objectFit = "cover", s.classList.add("vvw--pulsing"), this.element = l, this.element.classList.add("vvw-img-hi");
|
|
37
|
+
const { width: m, height: d } = this.getFullSizeDim();
|
|
38
|
+
if (this.fullH = d, this.fullW = m, this.minW = this.fullW * 0.5, this.maxW = this.fullW, this.element.style.width = `${m}px`, this.element.style.height = `${d}px`, this.setSizes({ stableSize: !1, initDimension: !0 }), this.pos === 0) {
|
|
39
|
+
const o = document.createElement("iframe");
|
|
40
|
+
o.frameBorder = "0", o.allow = "autoplay; fullscreen; picture-in-picture", o.allowFullscreen = !0, o.width = "100%", o.height = "100%", o.style.position = "absolute", o.style.top = "0", o.style.left = "0", o.style.opacity = "0", o.style.transition = "opacity 1s ease", o.src = `https://www.dailymotion.com/embed/video/${r(n)}?autoplay=1`, l.appendChild(o), o.onload = () => {
|
|
41
|
+
o.style.opacity = "1", s.classList.remove("vvw--pulsing");
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
this.isLoadedResolved(!0);
|
|
45
|
+
}
|
|
46
|
+
// the default full size is the scaled thumbnail size
|
|
47
|
+
// so we change it to 16:9 full window width size (or max 800px)
|
|
48
|
+
getFullSizeDim() {
|
|
49
|
+
const i = Math.min(window.innerWidth, 800);
|
|
50
|
+
return {
|
|
51
|
+
width: i,
|
|
52
|
+
height: i * 9 / 16
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
// override to avoid propagating content change event
|
|
56
|
+
// (because no change will happen on iframe)
|
|
57
|
+
setFinalTransform() {
|
|
58
|
+
return super.setFinalTransform({ propagateEvent: !1 });
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function w() {
|
|
62
|
+
return {
|
|
63
|
+
name: "dailymotionVideo",
|
|
64
|
+
onInitializeImage: (t) => {
|
|
65
|
+
const e = t.elm.config.src;
|
|
66
|
+
if (r(e))
|
|
67
|
+
return new h(t);
|
|
68
|
+
},
|
|
69
|
+
onImageView: async (t, e) => {
|
|
70
|
+
const i = t.images.to[Math.floor(t.images.to.length / 2)];
|
|
71
|
+
i instanceof h && e.deactivateUi(["download", "zoomIn", "zoomOut"], i);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
export {
|
|
76
|
+
h as VistaDailymotionVideo,
|
|
77
|
+
w as dailymotionVideo,
|
|
78
|
+
p as getDailymotionThumbnail,
|
|
79
|
+
r as parseDailymotionVideoId
|
|
80
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(m,f){typeof exports=="object"&&typeof module<"u"?f(exports):typeof define=="function"&&define.amd?define(["exports"],f):(m=typeof globalThis<"u"?globalThis:m||self,f(m.VistaView=m.VistaView||{}))})(this,(function(m){"use strict";var F=Object.defineProperty;var P=(m,f,g)=>f in m?F(m,f,{enumerable:!0,configurable:!0,writable:!0,value:g}):m[f]=g;var h=(m,f,g)=>P(m,typeof f!="symbol"?f+"":f,g);function f(d){const i=window.getComputedStyle(d).objectFit||"",{width:s,height:a}=d.getBoundingClientRect(),e=d.naturalWidth,n=d.naturalHeight;if(!i)return{width:s,height:a};if(!e||!n)return{width:s,height:a};const c=e/n,r=s/a;switch(i){case"fill":return{width:s,height:a};case"none":return{width:e,height:n};case"contain":return c>r?{width:s,height:s/c}:{width:a*c,height:a};case"cover":return c<r?{width:s,height:s/c}:{width:a*c,height:a};case"scale-down":{const l={width:e,height:n},o=c>r?{width:s,height:s/c}:{width:a*c,height:a};return o.width<=l.width&&o.height<=l.height?o:l}}return{width:s,height:a}}class g{static ease(t,i,s){const a=i-t,e=t+a*.2;return Math.abs(a)<s?i:e}static play(t,i,s){if(s()){requestAnimationFrame(()=>{this.play(t,i,s)});return}this.map.get(t)&&(t.element.classList.contains("vvw--load-cancelled")||requestAnimationFrame(()=>{var o,u,w,S,x,b,W,_,C,L;const a=this.map.get(t);if(!a||!t.element||t.element.classList.contains("vvw--load-cancelled"))return;const{current:e,target:n,log:c}=a;let r={};n.width!==void 0&&(r.width=this.ease(e._width,n.width,1)),n.height!==void 0&&(r.height=this.ease(e._height,n.height,1)),((o=n.transform)==null?void 0:o.x)!==void 0&&(r.transform=r.transform||{},r.transform.x=this.ease(e._transform.x,n.transform.x,1)),((u=n.transform)==null?void 0:u.y)!==void 0&&(r.transform=r.transform||{},r.transform.y=this.ease(e._transform.y,n.transform.y,1)),((w=n.transform)==null?void 0:w.scale)!==void 0&&(r.transform=r.transform||{},r.transform.scale=this.ease(e._transform.scale,n.transform.scale,.005)),((S=n.translate)==null?void 0:S.x)!==void 0&&(r.translate=r.translate||{},r.translate.x=this.ease(e._translate.x,n.translate.x,1)),((x=n.translate)==null?void 0:x.y)!==void 0&&(r.translate=r.translate||{},r.translate.y=this.ease(e._translate.y,n.translate.y,1)),r.width!==void 0&&(e.width=r.width),r.height!==void 0&&(e.height=r.height),r.translate&&(e.translate={...e.translate,...r.translate}),r.transform&&(e.transform={...e.transform,...r.transform}),(n.width===void 0||e._width===n.width)&&(n.height===void 0||e._height===n.height)&&(((b=n.transform)==null?void 0:b.x)===void 0||e._transform.x===n.transform.x)&&(((W=n.transform)==null?void 0:W.y)===void 0||e._transform.y===n.transform.y)&&(((_=n.transform)==null?void 0:_.scale)===void 0||e._transform.scale===n.transform.scale)&&(((C=n.translate)==null?void 0:C.x)===void 0||e._translate.x===n.translate.x)&&(((L=n.translate)==null?void 0:L.y)===void 0||e._translate.y===n.translate.y)?(this.map.delete(t),i()):(this.map.set(t,{current:e,target:n,log:c}),this.play(t,i,s))}))}static stop(t){const i=this.map.get(t);return this.map.delete(t),i}static start({vistaImage:t,target:i,onComplete:s,shouldWait:a}){this.stop(t),this.map.set(t,{current:t.state,target:i}),this.play(t,s,a)}}h(g,"map",new Map);class R{constructor(t){h(this,"state");h(this,"parsedSrcSet");h(this,"isReady",!1);h(this,"isThrowing",!1);h(this,"thumb",null);h(this,"pos");h(this,"index");h(this,"config");h(this,"origin");h(this,"initH",0);h(this,"initW",0);h(this,"fullH",0);h(this,"fullW",0);h(this,"maxW",0);h(this,"minW",0);h(this,"defaultWH",200);h(this,"isZoomedIn",!1);h(this,"isCancelled",!1);h(this,"isLoadedResolved",null);h(this,"isLoadedRejected",null);h(this,"isLoaded",new Promise((t,i)=>{this.isLoadedResolved=t,this.isLoadedRejected=i}));h(this,"replacement",null);h(this,"originalParent",null);h(this,"originalNextSibling",null);h(this,"originalStyle","");h(this,"thumbImage",null);h(this,"fittedSize",null);h(this,"maxZoomLevel");h(this,"vistaView");h(this,"transitionState",null);h(this,"transitionShouldWait",()=>!1);h(this,"initPointerCenter",{x:0,y:0});h(this,"onScale");var s;this.state=this.createState(),this.pos=t.pos,this.index=t.index,this.config=t.elm.config,this.parsedSrcSet=t.elm.parsedSrcSet,this.origin=t.elm.origin,this.maxZoomLevel=t.maxZoomLevel,this.vistaView=t.vistaView,this.onScale=t.onScale,t.transitionState&&(this.transitionState=t.transitionState),t.transitionShouldWait&&(this.transitionShouldWait=t.transitionShouldWait),this.initPointerCenter={x:window.innerWidth/2,y:window.innerHeight/2};const i=this.pos===0?(s=this.origin)==null?void 0:s.image:null;if(this.originalParent=(i==null?void 0:i.parentElement)||null,this.originalNextSibling=(i==null?void 0:i.nextSibling)||null,i&&this.originalParent){this.originalStyle=i.style.cssText,this.thumbImage=i;const a=i.cloneNode(!0);this.originalParent.insertBefore(a,i),this.replacement=a,this.thumb=document.createElement("div"),this.thumb.classList.add("vvw-img-lo");const{width:e,height:n}=this.thumbImage?f(this.thumbImage):{width:0,height:0};this.fittedSize={width:e,height:n},this.thumb.appendChild(i),i.style.width="100%",i.style.height="100%",i.style.objectFit=this.origin.objectFit}}createState(){const t=this;return{_t:this,_width:0,_height:0,_transform:{x:0,y:0,scale:1},_translate:{x:0,y:0},_lessThanMinWidth:!1,get width(){return this._width},set width(i){this._width=i,t.onWidthChange(i)},get height(){return this._height},set height(i){this._height=i,t.onHeightChange(i)},get transform(){return this._transform},set transform(i){this._transform=i,t.onTransformChange(i)},get translate(){return this._translate},set translate(i){this._translate=i,t.onTranslateChange(i)},get lessThanMinWidth(){return this._lessThanMinWidth},set lessThanMinWidth(i){this._lessThanMinWidth=i,t.onLessThanMinWidthChange(i)}}}onLessThanMinWidthChange(t){t?this.element.style.opacity="0.5":this.element.style.opacity=""}onTranslateChange(t){this.element.style.translate=`calc(-50% + ${t.x}px) calc(-50% + ${t.y}px)`}onTransformChange(t){const i=`translate3d(${t.x}px, ${t.y}px, 0px) scale3d(${t.scale}, ${t.scale}, 1)`;this.element.style.transform=i}onWidthChange(t){this.element.style.width=`${t}px`}onHeightChange(t){this.element.style.height=`${t}px`}onImageReady(){}animateZoom(t,i){}scaleMove(t,i,s){}momentumThrow(t){return()=>{}}async init(){await this.isLoaded;const t=this.element;this.transitionState&&this.transitionState.current.width&&this.transitionState.current.height?(this.state.width=this.transitionState.current.width,this.state.height=this.transitionState.current.height):t.classList.contains("vvw--loaded")||(this.state.width=this.initW,this.state.height=this.initH);const i=()=>{this.isCancelled||g.start({vistaImage:this,target:{width:this.fullW,height:this.fullH},onComplete:()=>{this.isCancelled||(this.isReady=!0,t.classList.add("vvw--ready"),this.onImageReady())},shouldWait:this.transitionShouldWait})};this.pos<-1||this.pos>1?(this.state.width=this.fullW,this.state.height=this.fullH,t.classList.add("vvw--loaded"),t.classList.add("vvw--ready"),this.isReady=!0):t.classList.contains("vvw--loaded")?t.classList.contains("vvw--ready")?(this.isReady=!0,this.onImageReady()):i():(t.classList.add("vvw--loaded"),setTimeout(()=>{this.isCancelled||i()},333))}getFullSizeDim(){const{width:t,height:i}=this.thumb.getBoundingClientRect(),s=t/i;let a=window.innerWidth,e=window.innerHeight;return s>window.innerWidth/window.innerHeight?e=a/s:a=e*s,{width:a,height:e}}setSizes(t={}){var c,r,l;const{stableSize:i=!0,initDimension:s}=t;if(!this.origin)return;const a=this.thumb;let e={width:this.defaultWH,height:this.defaultWH,top:0,left:0};if(a){e=(((c=this.origin)==null?void 0:c.anchor)||this.replacement).getBoundingClientRect();const o=a.style;o.width=e.width+"px",o.height=e.height+"px",o.top="50%",o.left="50%",o.translate="-50% -50%",o.position="fixed",o.objectFit=this.origin.objectFit,o.borderRadius=this.origin.borderRadius;const u=Math.min(Math.max(e.left,-e.width),window.innerWidth+e.width)-window.innerWidth/2+e.width/2,w=Math.min(Math.max(e.top,-e.height),window.innerHeight+e.height)-window.innerHeight/2+e.height/2;o.setProperty("--vvw-init-radius",o.borderRadius),o.setProperty("--vvw-pulse-radius",`calc(1.3 * ${o.borderRadius})`),o.setProperty("--vvw-init-x",`${u}px`),o.setProperty("--vvw-init-y",`${w}px`),s&&(o.setProperty("--vvw-current-x",`${u}px`),o.setProperty("--vvw-current-y",`${w}px`))}if(!s){const{width:o,height:u}=this.thumbImage?f(this.thumbImage):{width:0,height:0};this.fittedSize={width:o,height:u}}const n=this.element;if(this.initW=Math.min(((r=this.fittedSize)==null?void 0:r.width)??0,e.width),this.initH=Math.min(((l=this.fittedSize)==null?void 0:l.height)??0,e.height),n.style.setProperty("--vvw-init-w",this.initW+"px"),n.style.setProperty("--vvw-init-h",this.initH+"px"),n.style.setProperty("--vvw-init-radius",this.origin.borderRadius),n.style.objectFit="cover",!s){if(this.isReady&&!this.isCancelled){const{width:o,height:u}=this.getFullSizeDim();this.fullH=u,this.fullW=o,this.minW=this.fullW*.5}!this.isZoomedIn&&i&&this.normalize()}}normalize(){this.state.transform={x:0,y:0,scale:1},this.state.translate={x:0,y:0},this.state.width=this.fullW,this.state.height=this.fullH,this.isZoomedIn=!1}getFromParsedSrcSet(t){if(!this.parsedSrcSet||this.parsedSrcSet.length===0)return null;const i=t*(window.devicePixelRatio||1);let s=this.parsedSrcSet[this.parsedSrcSet.length-1];for(const a of this.parsedSrcSet)if(a.width>=i){s=a;break}return s.src}prepareClose(){g.stop(this),this.setFinalTransform()}cancelPendingLoad(){var t;this.isCancelled=!0,(t=this.element)==null||t.classList.add("vvw--load-cancelled")}setInitialCenter(t){this.initPointerCenter=t}destroy(){var t,i;this.originalParent&&this.thumbImage&&(this.thumbImage.style.cssText=this.originalStyle,this.originalNextSibling?this.originalParent.insertBefore(this.thumbImage,this.originalNextSibling):this.originalParent.appendChild(this.thumbImage)),this.originalParent=null,this.originalNextSibling=null,this.originalStyle="",this.thumbImage=null,this.replacement&&(this.replacement.remove(),this.replacement=null),(t=this.thumb)==null||t.remove(),(i=this.element)==null||i.remove(),this.thumb=null,this.origin=void 0,this.config={src:"",alt:""}}cloneStyleFrom(t,i){t!=null&&t.element&&(i&&(this.transitionState=i||null),t.element.classList.contains("vvw--loaded")&&(this.element.classList.add("vvw--loaded"),this.state.width=t.state.width,this.state.height=t.state.height),t.element.classList.contains("vvw--ready")&&this.element.classList.add("vvw--ready"))}toObject(){return structuredClone({config:{src:this.config.src,alt:this.config.alt,srcSet:this.config.srcSet},origin:this.origin?{src:this.origin.src,srcSet:this.origin.srcSet,borderRadius:this.origin.borderRadius,objectFit:this.origin.objectFit}:null,parsedSrcSet:this.parsedSrcSet,element:"src"in this.element?this.element.src:this.element.toString(),thumb:void 0,index:this.index,pos:this.pos,state:{width:this.state._width,height:this.state._height,transform:this.state._transform,translate:this.state._translate}})}setFinalTransform(t={}){const{propagateEvent:i=!0}=t;if(this.isReady){if(this.state.translate.x+=this.state.transform.x,this.state.translate.y+=this.state.transform.y,this.state.width*=this.state.transform.scale,this.state.height*=this.state.transform.scale,Math.abs(this.state.width-this.fullW)<1&&(this.state.width=this.fullW,this.state.height=this.fullH),Math.abs(this.state.translate.x)<1&&(this.state.translate.x=0),Math.abs(this.state.translate.y)<1&&(this.state.translate.y=0),this.state.translate={...this.state.translate},this.state.transform={x:0,y:0,scale:1},i){const s=this.toObject();this.vistaView.options.onContentChange&&this.vistaView.options.onContentChange(s,this.vistaView),this.vistaView.state.extensions.forEach(a=>{a.onContentChange&&a.onContentChange(s,this.vistaView)})}return{close:!0,cancel:()=>{}}}}}function y(d){if(!d)return null;const t=[/dailymotion\.com\/video\/([a-zA-Z0-9]+)/,/dai\.ly\/([a-zA-Z0-9]+)/,/dailymotion\.com\/embed\/video\/([a-zA-Z0-9]+)/];for(const i of t){const s=d.match(i);if(s&&s[1])return s[1]}return null}function v(d){const t=y(d);if(!t)throw new Error("Invalid Dailymotion video URL");return`https://www.dailymotion.com/thumbnail/video/${t}`}class p extends R{constructor(i){var r;super(i);h(this,"element");h(this,"url");const s=i.elm.config.src;this.url=s;const a=document.createElement("div");a.style.position="relative";const e=document.createElement("img");a.appendChild(e),e.src=((r=this.origin)==null?void 0:r.image.src)||v(s),e.style.width="100%",e.style.height="100%",e.style.objectFit="cover",e.classList.add("vvw--pulsing"),this.element=a,this.element.classList.add("vvw-img-hi");const{width:n,height:c}=this.getFullSizeDim();if(this.fullH=c,this.fullW=n,this.minW=this.fullW*.5,this.maxW=this.fullW,this.element.style.width=`${n}px`,this.element.style.height=`${c}px`,this.setSizes({stableSize:!1,initDimension:!0}),this.pos===0){const l=document.createElement("iframe");l.frameBorder="0",l.allow="autoplay; fullscreen; picture-in-picture",l.allowFullscreen=!0,l.width="100%",l.height="100%",l.style.position="absolute",l.style.top="0",l.style.left="0",l.style.opacity="0",l.style.transition="opacity 1s ease",l.src=`https://www.dailymotion.com/embed/video/${y(s)}?autoplay=1`,a.appendChild(l),l.onload=()=>{l.style.opacity="1",e.classList.remove("vvw--pulsing")}}this.isLoadedResolved(!0)}getFullSizeDim(){const i=Math.min(window.innerWidth,800);return{width:i,height:i*9/16}}setFinalTransform(){return super.setFinalTransform({propagateEvent:!1})}}function H(){return{name:"dailymotionVideo",onInitializeImage:d=>{const t=d.elm.config.src;if(y(t))return new p(d)},onImageView:async(d,t)=>{const i=d.images.to[Math.floor(d.images.to.length/2)];i instanceof p&&t.deactivateUi(["download","zoomIn","zoomOut"],i)}}}m.VistaDailymotionVideo=p,m.dailymotionVideo=H,m.getDailymotionThumbnail=v,m.parseDailymotionVideoId=y,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const d = '<svg viewBox="0 0 24 24"><path d="M12 15V3"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/></svg>';
|
|
2
|
+
function u() {
|
|
3
|
+
let o = null, r = null, e = null;
|
|
4
|
+
return {
|
|
5
|
+
name: "download",
|
|
6
|
+
control: () => (e = document.createElement("button"), e.setAttribute("aria-label", "Download"), e.innerHTML = d, e.addEventListener("click", async () => {
|
|
7
|
+
if (!o || e != null && e.classList.contains("vvw--pulsing")) return;
|
|
8
|
+
e == null || e.classList.add("vvw--pulsing");
|
|
9
|
+
let l = await fetch(o), i = await l.blob();
|
|
10
|
+
const n = l.url, t = r, s = n.split("?")[0].split("#")[0].split(".").pop(), c = t ? `${t}.${s}` : n.split("?")[0].split("#")[0].split("/").pop() || "download." + s, a = document.createElement("a");
|
|
11
|
+
a.href = URL.createObjectURL(i), a.download = c, document.body.appendChild(a), a.click(), document.body.removeChild(a), i = null, l = null, e == null || e.classList.remove("vvw--pulsing");
|
|
12
|
+
}), e),
|
|
13
|
+
onImageView: (l, i) => {
|
|
14
|
+
const n = l.images.to ? l.images.to[Math.floor(l.images.to.length / 2)] : null;
|
|
15
|
+
if (!n) {
|
|
16
|
+
o = null, r = null;
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
const { parsedSrcSet: t, config: s } = n;
|
|
20
|
+
o = t && t.length > 0 ? t[t.length - 1].src : s.src || null, r = s.alt || null;
|
|
21
|
+
},
|
|
22
|
+
onDeactivateUi: (l, i, n) => {
|
|
23
|
+
l.includes("download") && e && e.setAttribute("disabled", "true");
|
|
24
|
+
},
|
|
25
|
+
onReactivateUi: (l, i, n) => {
|
|
26
|
+
l.includes("download") && e && e.removeAttribute("disabled");
|
|
27
|
+
},
|
|
28
|
+
onClose: (l) => {
|
|
29
|
+
e == null || e.remove(), e = null, o = null, r = null;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
u as download
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(l,o){typeof exports=="object"&&typeof module<"u"?o(exports):typeof define=="function"&&define.amd?define(["exports"],o):(l=typeof globalThis<"u"?globalThis:l||self,o(l.VistaView=l.VistaView||{}))})(this,(function(l){"use strict";const o='<svg viewBox="0 0 24 24"><path d="M12 15V3"/><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><path d="m7 10 5 5 5-5"/></svg>';function u(){let s=null,c=null,e=null;return{name:"download",control:()=>(e=document.createElement("button"),e.setAttribute("aria-label","Download"),e.innerHTML=o,e.addEventListener("click",async()=>{if(!s||e!=null&&e.classList.contains("vvw--pulsing"))return;e==null||e.classList.add("vvw--pulsing");let n=await fetch(s),d=await n.blob();const t=n.url,i=c,a=t.split("?")[0].split("#")[0].split(".").pop(),p=i?`${i}.${a}`:t.split("?")[0].split("#")[0].split("/").pop()||"download."+a,r=document.createElement("a");r.href=URL.createObjectURL(d),r.download=p,document.body.appendChild(r),r.click(),document.body.removeChild(r),d=null,n=null,e==null||e.classList.remove("vvw--pulsing")}),e),onImageView:(n,d)=>{const t=n.images.to?n.images.to[Math.floor(n.images.to.length/2)]:null;if(!t){s=null,c=null;return}const{parsedSrcSet:i,config:a}=t;s=i&&i.length>0?i[i.length-1].src:a.src||null,c=a.alt||null},onDeactivateUi:(n,d,t)=>{n.includes("download")&&e&&e.setAttribute("disabled","true")},onReactivateUi:(n,d,t)=>{n.includes("download")&&e&&e.removeAttribute("disabled")},onClose:n=>{e==null||e.remove(),e=null,s=null,c=null}}}l.download=u,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
|