UNPKG

18 kBTypeScriptView Raw
1import { GalleryItem } from './lg-utils';
2import { LgQuery } from './lgQuery';
3import { LightGallery } from './lightgallery';
4import { AutoplaySettings } from './plugins/autoplay/lg-autoplay-settings';
5import { CommentSettings } from './plugins/comment/lg-comment-settings';
6import { FullscreenSettings } from './plugins/fullscreen/lg-fullscreen-settings';
7import { HashSettings } from './plugins/hash/lg-hash-settings';
8import { PagerSettings } from './plugins/pager/lg-pager-settings';
9import { RotateSettings } from './plugins/rotate/lg-rotate-settings';
10import { ShareSettings } from './plugins/share/lg-share-settings';
11import { ThumbnailsSettings } from './plugins/thumbnail/lg-thumbnail-settings';
12import { VideoSettings } from './plugins/video/lg-video-settings';
13import { ZoomSettings } from './plugins/zoom/lg-zoom-settings';
14declare type LightGalleryCoreMobileSettings = Exclude<LightGalleryCoreSettings, 'mobileSettings'>;
15export interface MobileSettings extends LightGalleryCoreMobileSettings, Partial<ZoomSettings>, Partial<ThumbnailsSettings>, Partial<VideoSettings>, Partial<AutoplaySettings>, Partial<CommentSettings>, Partial<FullscreenSettings>, Partial<HashSettings>, Partial<PagerSettings>, Partial<RotateSettings>, Partial<ShareSettings> {
16}
17export interface LightGalleryCoreStrings {
18 closeGallery: string;
19 toggleMaximize: string;
20 previousSlide: string;
21 nextSlide: string;
22 download: string;
23 playVideo: string;
24 mediaLoadingFailed: string;
25}
26export declare type LightGalleryAllSettings = LightGalleryCoreSettings & ZoomSettings & ThumbnailsSettings & VideoSettings & AutoplaySettings & CommentSettings & FullscreenSettings & HashSettings & PagerSettings & RotateSettings & ShareSettings;
27export declare type LightGallerySettings = Partial<LightGalleryAllSettings>;
28export interface LightGalleryCoreSettings {
29 /**
30 * Type of transition between images.
31 */
32 mode: 'lg-slide' | 'lg-fade' | 'lg-zoom-in' | 'lg-zoom-in-big' | 'lg-zoom-out' | 'lg-zoom-out-big' | 'lg-zoom-out-in' | 'lg-zoom-in-out' | 'lg-soft-zoom' | 'lg-scale-up' | 'lg-slide-circular' | 'lg-slide-circular-vertical' | 'lg-slide-vertical' | 'lg-slide-vertical-growth' | 'lg-slide-skew-only' | 'lg-slide-skew-only-rev' | 'lg-slide-skew-only-y' | 'lg-slide-skew-only-y-rev' | 'lg-slide-skew' | 'lg-slide-skew-rev' | 'lg-slide-skew-cross' | 'lg-slide-skew-cross-rev' | 'lg-slide-skew-ver' | 'lg-slide-skew-ver-rev' | 'lg-slide-skew-ver-cross' | 'lg-slide-skew-ver-cross-rev' | 'lg-lollipop' | 'lg-lollipop-rev' | 'lg-rotate' | 'lg-rotate-rev' | 'lg-tube';
33 /**
34 * Slide animation CSS easing property
35 */
36 easing: string;
37 /**
38 *Transition duration (in ms).
39 */
40 speed: number;
41 /**
42 * If you are using lightGallery for commercial projects, you need to purchase a commercial license
43 * to get the license key. For projects that are compatible with GPLv3 license,
44 * please contact us for getting a license key at <a href="mailto:contact@lightgalleryjs.com">contact@lightgalleryjs.com</a>.
45 * If you want to test lightGallery before purchasing a commercial license, you can
46 * use `0000-0000-000-0000` as a temporary license key
47 */
48 licenseKey: string;
49 /**
50 * Height of the gallery.
51 * example '100%' , '300px'
52 */
53 height: string;
54 /**
55 * Width of the gallery.
56 * example '100%' , '300px'
57 */
58 width: string;
59 /**
60 * Add custom class for gallery container
61 * This can be used to set different style for different galleries
62 */
63 addClass: string;
64 /**
65 * Start animation class for the gallery.
66 * @description
67 * <ul>
68 * <li>startClass will be empty zoomFromOrigin is true.</li>
69 * <li>This can be used to change the starting effect when the image is loaded</li>
70 * <li>This is also applied when navigating to new slides</li>
71 * </ul>
72 */
73 startClass: string;
74 /**
75 * Enable zoom from origin effect.
76 * @description You need to know the original image size upfront and provide it via data-lg-size attribute as <code> data-lg-size="1920-1280</code>"
77 *
78 * If you don't know, the size of a few images in the list, you can skip the data-lg-size attribute for the particular slides,
79 * lightGallery will show the default animation if data-lg-size is not available
80 *
81 * If you are using responsive images,
82 * you can pass a comma separated list of sizes combined with a max-width (up to what size the particular image should be used)
83 *
84 * example -
85 * <code> data-lg-size="240-160-375, 400-267-480, 1600-1067"
86 * data-responsive="img-240.jpg 375, img-400.jpg 480"
87 * data-src="img-1600.jpg" </code>
88 *
89 * In the above example, upto 375 width img.240.jpg and lg-size 240-160 will be used.
90 * Similarly, upto 480 pixel width size 400-267 and img-400.jpg will be used
91 * And above 480, lg-size 1600-1067 and img-1600.jpg will be used
92 *
93 * <ul>
94 * <li>At the moment, zoomFromOrigin options is supported only for image slides.</li>
95 * <li>Will be false if dynamic option is enabled or galleryID found in the URL.</li>
96 * <li>startClass will be empty if zoomFromOrigin is true to avoid css conflicts.</li>
97 * </ul>
98 */
99 zoomFromOrigin: boolean;
100 /**
101 * Zoom from image animation duration
102 */
103 startAnimationDuration: number;
104 /**
105 * Backdrop transition duration.
106 * Note - Do not change the value of backdrop via css.
107 */
108 backdropDuration: number;
109 /**
110 * Configure where the gallery should be appended.
111 * Useful to create inline galleries and more
112 * It is an empty string in the default settings and later assigned to document.body to avoid accessing document for SSR
113 */
114 container: HTMLElement | '';
115 /**
116 * Delay for hiding gallery controls in ms.
117 * Pass <code>0</code> if you don't want to hide the controls
118 */
119 hideBarsDelay: number;
120 /**
121 * Delay in hiding controls for the first time when gallery is opened
122 */
123 showBarsAfter: number;
124 /**
125 * Delay slide transitions.
126 * @description This is useful if you want to do any action in the current slide before moving to next slide.
127 * <section>
128 * For example, fading out the captions before going to next slide.
129 * <code>.lg-slide-progress</code> class name is added to the current slide immediately after calling the slide method.
130 * But transition begins only after the delay
131 * </section>
132 */
133 slideDelay: number;
134 /**
135 * Support legacy browsers
136 * @description Currently this is used only for adding support to srcset attribute via picturefill library
137 * If true lightGallery will show warning message to include picturefill library
138 */
139 supportLegacyBrowser: boolean;
140 /**
141 * If true, toolbar, captions and thumbnails will not overlap with media element
142 * This will not effect thumbnails if animateThumb is false
143 * Also, toggle thumbnails button is not displayed if allowMediaOverlap is false
144 * <section>
145 * Note - Changing the position of the media on every slide transition creates a flickering effect.
146 * Therefore, the height of the caption is calculated dynamically, only once based on the first slide caption.
147 * </section>
148 * <section>
149 * if you have dynamic captions for each media,
150 * you can provide an appropriate height for the captions via allowMediaOverlap option
151 * </section>
152 */
153 allowMediaOverlap: boolean;
154 /**
155 * Video max size.
156 * @description This can be over-written by passing specific size via data-lg-size attribute
157 * Recommended video resolution and & aspect ratios <a href="https://support.google.com/youtube/answer/6375112">https://support.google.com/youtube/answer/6375112</a>
158 */
159 videoMaxSize: string;
160 /**
161 * Automatically load poster image for YouTube videos
162 */
163 loadYouTubePoster: boolean;
164 /**
165 * Height of the caption for calculating allowMediaOverlap positions
166 * Note - this is only used to find the position of media item if allowMediaOverlap is true.
167 * Not for setting height of the captions
168 * Set 0 if you want to calculate the height of captions dynamically
169 */
170 defaultCaptionHeight: number;
171 /**
172 * aria-labelledby attribute fot gallery
173 */
174 ariaLabelledby: string;
175 /**
176 * aria-describedby attribute for gallery
177 */
178 ariaDescribedby: string;
179 /**
180 * Hide scrollbar when gallery is opened
181 * @version V2.5.0
182 */
183 hideScrollbar: boolean;
184 /**
185 * Reset to previous scrollPosition when lightGallery is closed
186 * @description By default, lightGallery doesn't hide the scrollbar for a smooth opening transition.
187 * If a user changes the scroll position, lightGallery resets it to the previous value
188 * @version V2.5.0
189 */
190 resetScrollPosition: boolean;
191 /**
192 * If false user won't be abel to close the gallery at all
193 * This is useful for creating inline galleries.
194 */
195 closable: boolean;
196 /**
197 * allows vertical drag/swipe to close gallery
198 * <code>false</code> if option <code>closable</code> is <code>false</code>
199 */
200 swipeToClose: boolean;
201 /**
202 * allows clicks on black area to close gallery.
203 */
204 closeOnTap: boolean;
205 /**
206 * If false, close button won't be displayed.
207 * Useful for creating inline galleries.
208 */
209 showCloseIcon: boolean;
210 /**
211 * Show maximize icon.
212 * Useful for creating inline galleries.
213 */
214 showMaximizeIcon: boolean;
215 /**
216 * If false, will disable the ability to loop back to the beginning of the gallery from the last slide.
217 */
218 loop: boolean;
219 /**
220 * Whether the LightGallery could be closed by pressing the "Esc" key.
221 */
222 escKey: boolean;
223 /**
224 * Enable keyboard navigation
225 */
226 keyPress: boolean;
227 /**
228 * Trap focus within the lightGallery
229 * @version V2.5.0
230 */
231 trapFocus: boolean;
232 /**
233 * If false, prev/next buttons will not be displayed.
234 */
235 controls: boolean;
236 /**
237 * Enable slideEnd animation
238 */
239 slideEndAnimation: boolean;
240 /**
241 * If true, prev/next button will be hidden on first/last image.
242 * @description Note - this option will be ignored if <code>loop</code> or <code>slideEndAnimation</code> is set to true
243 */
244 hideControlOnEnd: boolean;
245 /**
246 * ability to navigate to next/prev slides on mousewheel
247 */
248 mousewheel: boolean;
249 /**
250 * Option to get captions from alt or title tags.
251 */
252 getCaptionFromTitleOrAlt: boolean;
253 /**
254 * control where the sub-html should be appended.
255 * If you choose '.lg-outer', you are responsible for placing the div at the right position.
256 * '.lg-outer' is useful if you want show custom HTML outside the normal gallery
257 */
258 appendSubHtmlTo: '.lg-sub-html' | '.lg-item' | '.lg-outer';
259 /**
260 * Set to true if the selector in "data-sub-html" should use the current item as its origin.
261 */
262 subHtmlSelectorRelative: boolean;
263 /**
264 * number of preload slides
265 * @description will exicute only after the current slide is fully loaded.
266 * for example, if you click on 4th image and if preload = 1 then 3rd slide and 5th
267 * slide will be loaded in the background after the 4th slide is fully loaded..
268 * if preload is 2 then 2nd 3rd 5th 6th slides will be preloaded.
269 */
270 preload: number;
271 /**
272 * Control how many slide items should be kept in dom at a time
273 * @description To improve performance by reducing number of gallery items in the dom,
274 * lightGallery keeps only the lowest possible number of slides in the dom at a time.
275 * This has a minimum value of 3
276 */
277 numberOfSlideItemsInDom: number;
278 /**
279 * Custom selector property instead of direct children.
280 * @description Based on your markup structure, you can specify custom selectors to fetch media data for the gallery
281 * Pass "this" to select same element
282 * You can also pass HTMLCollection directly
283 * Example - '.my-selector' | '#my-selector' | this | document.querySelectorAll('.my-selector')
284 */
285 selector: string | HTMLCollection[];
286 /**
287 * By default selector element relative to the current gallery.
288 * Instead of that you can tell lightGallery to select element relative to another element.
289 * Example - '.my-selector-container' | '#my-selector-container'
290 * In the code this become selector = document.querySelector(this.s.selectWithin ).querySelectorAll(this.s.selector);
291 */
292 selectWithin: string;
293 /**
294 * Custom html for next control
295 */
296 nextHtml: string;
297 /**
298 * Custom html for prev control
299 */
300 prevHtml: string;
301 /**
302 * specify which slide should load initially
303 */
304 index: number;
305 /**
306 * Set width for iframe.
307 */
308 iframeWidth: string;
309 /**
310 * Set height for iframe.
311 */
312 iframeHeight: string;
313 /**
314 * Set max width for iframe.
315 */
316 iframeMaxWidth: string;
317 /**
318 * Set max height for iframe.
319 */
320 iframeMaxHeight: string;
321 /**
322 * Enable download button.
323 * @description By default download url will be taken from data-src/href attribute but it supports only for modern browsers.
324 * If you want you can provide another url for download via data-download-url.
325 * pass false in data-download-url if you want to hide download button for the particular slide.
326 */
327 download: boolean;
328 /**
329 * Whether to show total number of images and index number of currently displayed image.
330 */
331 counter: boolean;
332 /**
333 * Where the counter should be appended
334 */
335 appendCounterTo: string;
336 /**
337 * By setting the swipeThreshold (in px) you can set how far the user must swipe for the next/prev image.
338 */
339 swipeThreshold: number;
340 /**
341 * Enables swipe support for touch devices
342 */
343 enableSwipe: boolean;
344 /**
345 * Enables desktop mouse drag support
346 */
347 enableDrag: boolean;
348 /**
349 * LightGallery can be instantiated and launched programmatically by setting this option to true and populating dynamicEl option (see below) with the definitions of images.
350 */
351 dynamic: boolean;
352 /**
353 * An array of objects (src, iframe, subHtml, thumb, poster, responsive, srcset sizes) representing gallery elements.
354 */
355 dynamicEl: GalleryItem[];
356 /**
357 * Fetch custom properties from the selector
358 * @description this is useful for plugin development
359 * By default lightGallery fetches and store all the props selectors to
360 * reduce frequent dom interaction for fetching props every time.
361 *
362 * If you need any addition data to be fetched and stored in the galleryItems variable,
363 * you can do this just by passing the prop names via extraProps
364 * @example
365 * HTML:
366 * <div id="lightGallery">
367 * <a href="a.jpg" data-custom-prop="abc"><img src="thumb.jpg" /></a>
368 * <a href="a.jpg" data-custom-prop="xyz"><img src="thumb.jpg" /></a>
369 * </div>
370 * JS:
371 * lightGallery(document.getElementById('lightGallery'), {
372 * extraProps: ['customProp']
373 * })
374 * // Note - If you are using dynamic mode, you can pass any custom prop in the galleryItem
375 * lightGallery(document.getElementById('lightGallery'), {
376 * dynamic: true,
377 * dynamicEl: [{
378 * src: 'img/img1.jpg',
379 * customProp:'abc',
380 * }]
381 * })
382 *
383 */
384 extraProps: string[];
385 /**
386 * Option to fetch different thumbnail image other than first image
387 * @description If you want to use external image for thumbnail,
388 * add the path of that image inside "data-" attribute
389 * and set value of this option to the name of your custom attribute.
390 *
391 * @example
392 * <div id="lightGallery">
393 * <a href="a.jpg" data-external-thumb-image="images/externalThumb.jpg" ><img src="thumb.jpg" /></a>
394 * </div>
395 *
396 * lightGallery(document.getElementById('lightGallery'), {
397 * exThumbImage: 'data-external-thumb-image'
398 * })
399 */
400 exThumbImage: string;
401 /**
402 * Function to detect mobile devices
403 */
404 isMobile?: () => boolean;
405 /**
406 * Separate settings for mobile devices
407 * @description Note - this is applied only at the time of loading
408 * by default controls and close buttons are disabled on mobile devices.
409 * use this options if you want to enable them or change any other settings for mobile devices
410 * Note - mobileSettings does not merge default values, You need to provide all mobileSettings including default values
411 */
412 mobileSettings: Partial<MobileSettings>;
413 /**
414 * Customize string.
415 * @description This can be useful if you want to localize the lightGallery strings to other languages.
416 * Use your own service to translate the strings and pass it via settings.strings
417 * You can find dedicated strings option for all lightGallery modules in their respective documentation.
418 * Note - You need to provide values for all the strings. For example, even if you just want to change the closeGallery string, you need to provide all the other strings as well.
419 */
420 strings: LightGalleryCoreStrings;
421 plugins: (new (instance: LightGallery, $LG: LgQuery) => any)[];
422}
423export declare const lightGalleryCoreSettings: LightGalleryCoreSettings;
424export {};
425
\No newline at end of file