1 | import { GalleryItem, ImageSize } from './lg-utils';
|
2 | import { lgQuery } from './lgQuery';
|
3 | import { LightGallerySettings, LightGalleryAllSettings } from './lg-settings';
|
4 | import { Coords, MediaContainerPosition, SlideDirection, VideoInfo } from './types';
|
5 | export declare class LightGallery {
|
6 | settings: LightGalleryAllSettings;
|
7 | galleryItems: GalleryItem[];
|
8 | lgId: number;
|
9 | el: HTMLElement;
|
10 | LGel: lgQuery;
|
11 | lgOpened: boolean;
|
12 | index: number;
|
13 | plugins: any[];
|
14 | lGalleryOn: boolean;
|
15 | lgBusy: boolean;
|
16 | touchAction?: 'swipe' | 'zoomSwipe' | 'pinch';
|
17 | swipeDirection?: 'horizontal' | 'vertical';
|
18 | hideBarTimeout: any;
|
19 | currentItemsInDom: string[];
|
20 | outer: lgQuery;
|
21 | items: any;
|
22 | $backdrop: lgQuery;
|
23 | $lgComponents: lgQuery;
|
24 | $container: lgQuery;
|
25 | $inner: lgQuery;
|
26 | $content: lgQuery;
|
27 | $toolbar: lgQuery;
|
28 | prevScrollTop: number;
|
29 | private zoomFromOrigin;
|
30 | private currentImageSize?;
|
31 | private isDummyImageRemoved;
|
32 | private dragOrSwipeEnabled;
|
33 | mediaContainerPosition: {
|
34 | top: number;
|
35 | bottom: number;
|
36 | };
|
37 | constructor(element: HTMLElement, options?: LightGallerySettings);
|
38 | private generateSettings;
|
39 | private normalizeSettings;
|
40 | init(): void;
|
41 | openGalleryOnItemClick(): void;
|
42 | /**
|
43 | * Module constructor
|
44 | * Modules are build incrementally.
|
45 | * Gallery should be opened only once all the modules are initialized.
|
46 | * use moduleBuildTimeout to make sure this
|
47 | */
|
48 | buildModules(): void;
|
49 | validateLicense(): void;
|
50 | getSlideItem(index: number): lgQuery;
|
51 | getSlideItemId(index: number): string;
|
52 | getIdName(id: string): string;
|
53 | getElementById(id: string): lgQuery;
|
54 | manageSingleSlideClassName(): void;
|
55 | buildStructure(): void;
|
56 | refreshOnResize(): void;
|
57 | resizeVideoSlide(index: number, imageSize?: ImageSize): void;
|
58 | /**
|
59 | * Update slides dynamically.
|
60 | * Add, edit or delete slides dynamically when lightGallery is opened.
|
61 | * Modify the current gallery items and pass it via updateSlides method
|
62 | * @note
|
63 | * - Do not mutate existing lightGallery items directly.
|
64 | * - Always pass new list of gallery items
|
65 | * - You need to take care of thumbnails outside the gallery if any
|
66 | * - user this method only if you want to update slides when the gallery is opened. Otherwise, use `refresh()` method.
|
67 | * @param items Gallery items
|
68 | * @param index After the update operation, which slide gallery should navigate to
|
69 | * @category lGPublicMethods
|
70 | * @example
|
71 | * const plugin = lightGallery();
|
72 | *
|
73 | * // Adding slides dynamically
|
74 | * let galleryItems = [
|
75 | * // Access existing lightGallery items
|
76 | * // galleryItems are automatically generated internally from the gallery HTML markup
|
77 | * // or directly from galleryItems when dynamic gallery is used
|
78 | * ...plugin.galleryItems,
|
79 | * ...[
|
80 | * {
|
81 | * src: 'img/img-1.png',
|
82 | * thumb: 'img/thumb1.png',
|
83 | * },
|
84 | * ],
|
85 | * ];
|
86 | * plugin.updateSlides(
|
87 | * galleryItems,
|
88 | * plugin.index,
|
89 | * );
|
90 | *
|
91 | *
|
92 | * // Remove slides dynamically
|
93 | * galleryItems = JSON.parse(
|
94 | * JSON.stringify(updateSlideInstance.galleryItems),
|
95 | * );
|
96 | * galleryItems.shift();
|
97 | * updateSlideInstance.updateSlides(galleryItems, 1);
|
98 | * @see <a href="/demos/update-slides/">Demo</a>
|
99 | */
|
100 | updateSlides(items: GalleryItem[], index: number): void;
|
101 | getItems(): GalleryItem[];
|
102 | /**
|
103 | * Open lightGallery.
|
104 | * Open gallery with specific slide by passing index of the slide as parameter.
|
105 | * @category lGPublicMethods
|
106 | * @param {Number} index - index of the slide
|
107 | * @param {HTMLElement} element - Which image lightGallery should zoom from
|
108 | *
|
109 | * @example
|
110 | * const $dynamicGallery = document.getElementById('dynamic-gallery-demo');
|
111 | * const dynamicGallery = lightGallery($dynamicGallery, {
|
112 | * dynamic: true,
|
113 | * dynamicEl: [
|
114 | * {
|
115 | * src: 'img/1.jpg',
|
116 | * thumb: 'img/thumb-1.jpg',
|
117 | * subHtml: '<h4>Image 1 title</h4><p>Image 1 descriptions.</p>',
|
118 | * },
|
119 | * ...
|
120 | * ],
|
121 | * });
|
122 | * $dynamicGallery.addEventListener('click', function () {
|
123 | *
|
124 | *
|
125 | *
|
126 | * dynamicGallery.openGallery(2);
|
127 | * });
|
128 | *
|
129 | */
|
130 | openGallery(index?: number, element?: HTMLElement): void;
|
131 | |
132 |
|
133 |
|
134 |
|
135 |
|
136 |
|
137 | getMediaContainerPosition(): MediaContainerPosition;
|
138 | private setMediaContainerPosition;
|
139 | hideBars(): void;
|
140 | initPictureFill($img: lgQuery): void;
|
141 | |
142 |
|
143 |
|
144 |
|
145 | counter(): void;
|
146 | |
147 |
|
148 |
|
149 |
|
150 | addHtml(index: number): void;
|
151 | |
152 |
|
153 |
|
154 |
|
155 |
|
156 | preload(index: number): void;
|
157 | getDummyImgStyles(imageSize?: ImageSize): string;
|
158 | getVideoContStyle(imageSize?: ImageSize): string;
|
159 | getDummyImageContent($currentSlide: lgQuery, index: number, alt: string): string;
|
160 | setImgMarkup(src: string, $currentSlide: lgQuery, index: number): void;
|
161 | onLgObjectLoad($el: lgQuery, index: number, delay: number, speed: number, dummyImageLoaded: boolean): void;
|
162 | handleLgObjectLoad($el: lgQuery, index: number, delay: number, speed: number, dummyImageLoaded: boolean): void;
|
163 | |
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 | isVideo(src: string, index: number): VideoInfo | undefined;
|
172 | addSlideVideoInfo(items: GalleryItem[]): void;
|
173 | |
174 |
|
175 |
|
176 |
|
177 |
|
178 |
|
179 | loadContent(index: number, rec: boolean): void;
|
180 | loadContentOnLoad(index: number, $currentSlide: lgQuery, speed: number): void;
|
181 | getItemsToBeInsertedToDom(index: number, prevIndex: number, numberOfItems?: number): string[];
|
182 | organizeSlideItems(index: number, prevIndex: number): string[];
|
183 | |
184 |
|
185 |
|
186 | getPreviousSlideIndex(): number;
|
187 | setDownloadValue(index: number): void;
|
188 | makeSlideAnimation(direction: 'next' | 'prev', currentSlideItem: lgQuery, previousSlideItem: lgQuery): void;
|
189 | |
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 | slide(index: number, fromTouch?: boolean, fromThumb?: boolean, direction?: SlideDirection | false): void;
|
203 | updateCurrentCounter(index: number): void;
|
204 | updateCounterTotal(): void;
|
205 | getSlideType(item: GalleryItem): 'video' | 'iframe' | 'image';
|
206 | touchMove(startCoords: Coords, endCoords: Coords, e?: TouchEvent): void;
|
207 | touchEnd(endCoords: Coords, startCoords: Coords, event: TouchEvent): void;
|
208 | enableSwipe(): void;
|
209 | enableDrag(): void;
|
210 | triggerPosterClick(): void;
|
211 | manageSwipeClass(): void;
|
212 | |
213 |
|
214 |
|
215 |
|
216 |
|
217 |
|
218 |
|
219 |
|
220 |
|
221 | goToNextSlide(fromTouch?: boolean): void;
|
222 | |
223 |
|
224 |
|
225 |
|
226 |
|
227 |
|
228 |
|
229 |
|
230 |
|
231 |
|
232 | goToPrevSlide(fromTouch?: boolean): void;
|
233 | keyPress(): void;
|
234 | arrow(): void;
|
235 | arrowDisable(index: number): void;
|
236 | setTranslate($el: lgQuery, xValue: number, yValue: number, scaleX?: number, scaleY?: number): void;
|
237 | mousewheel(): void;
|
238 | isSlideElement(target: lgQuery): boolean;
|
239 | isPosterElement(target: lgQuery): boolean;
|
240 | |
241 |
|
242 |
|
243 |
|
244 | toggleMaximize(): void;
|
245 | invalidateItems(): void;
|
246 | manageCloseGallery(): void;
|
247 | |
248 |
|
249 |
|
250 |
|
251 |
|
252 |
|
253 |
|
254 |
|
255 |
|
256 |
|
257 |
|
258 | closeGallery(force?: boolean): number;
|
259 | initModules(): void;
|
260 | destroyModules(destroy?: true): void;
|
261 | |
262 |
|
263 |
|
264 |
|
265 |
|
266 |
|
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 | refresh(galleryItems?: GalleryItem[]): void;
|
276 | updateControls(): void;
|
277 | |
278 |
|
279 |
|
280 |
|
281 |
|
282 |
|
283 |
|
284 |
|
285 |
|
286 |
|
287 |
|
288 |
|
289 |
|
290 | destroy(): number;
|
291 | }
|