aboutsummaryrefslogtreecommitdiff
blob: d8847cf05873267f772edf42f4cb743c5f0665a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
declare module 'photoswipe/lightbox' {
  import PhotoSwipeBase from 'photoswipe/dist/types/core/base';

  export default PhotoSwipeLightbox;
  /**
   * <T>
   */
  export type Type<T> = import('photoswipe/dist/types/types').Type<T>;
  export type PhotoSwipe = import('photoswipe/dist/types/photoswipe').default;
  export type PhotoSwipeOptions = import('photoswipe/dist/types/photoswipe').PhotoSwipeOptions;
  export type DataSource = import('photoswipe/dist/types/photoswipe').DataSource;
  export type Content = import('photoswipe/dist/types/slide/content').default;
  export type PhotoSwipeEventsMap = import('photoswipe/dist/types/core/eventable').PhotoSwipeEventsMap;
  export type PhotoSwipeFiltersMap = import('photoswipe/dist/types/core/eventable').PhotoSwipeFiltersMap;
  /**
   * <T>
   */
  export type EventCallback<T> = import('photoswipe/dist/types/core/eventable').EventCallback<T>;
  /**
   * @template T
   * @typedef {import('../types.js').Type<T>} Type<T>
   */
  /** @typedef {import('photoswipe/dist/types/photoswipe').default} PhotoSwipe */
  /** @typedef {import('photoswipe/dist/types/photoswipe').PhotoSwipeOptions} PhotoSwipeOptions */
  /** @typedef {import('photoswipe/dist/types/photoswipe').DataSource} DataSource */
  /** @typedef {import('photoswipe/dist/types/slide/content').default} Content */
  /** @typedef {import('photoswipe/dist/types/core/eventable').PhotoSwipeEventsMap} PhotoSwipeEventsMap */
  /** @typedef {import('photoswipe/dist/types/core/eventable').PhotoSwipeFiltersMap} PhotoSwipeFiltersMap */
  /**
   * @template T
   * @typedef {import('photoswipe/dist/types/core/eventable').EventCallback<T>} EventCallback<T>
   */
  /**
   * PhotoSwipe Lightbox
   *
   * - If user has unsupported browser it falls back to default browser action (just opens URL)
   * - Binds click event to links that should open PhotoSwipe
   * - parses DOM strcture for PhotoSwipe (retrieves large image URLs and sizes)
   * - Initializes PhotoSwipe
   *
   *
   * Loader options use the same object as PhotoSwipe, and supports such options:
   *
   * gallery - Element | Element[] | NodeList | string selector for the gallery element
   * children - Element | Element[] | NodeList | string selector for the gallery children
   *
   */
  declare class PhotoSwipeLightbox extends PhotoSwipeBase {
    /**
     * @param {PhotoSwipeOptions} options
     */
    constructor(options: PhotoSwipeOptions);
    _uid: number;
    /**
     * Initialize lightbox, should be called only once.
     * It's not included in the main constructor, so you may bind events before it.
     */
    init(): void;
    /**
     * @param {MouseEvent} e
     */
    onThumbnailsClick(e: MouseEvent): void;
    /**
     * Get index of gallery item that was clicked.
     *
     * @param {MouseEvent} e click event
     */
    getClickedIndex(e: MouseEvent): number;
    /**
     * Load and open PhotoSwipe
     *
     * @param {number} index
     * @param {DataSource=} dataSource
     * @param {{ x?: number; y?: number }} [initialPoint]
     */
    loadAndOpen(
      index: number,
      dataSource?: DataSource | undefined,
      initialPoint?: {
        x?: number;
        y?: number;
      },
    ): boolean;
    shouldOpen: boolean;
    /**
     * Load the main module and the slide content by index
     *
     * @param {number} index
     * @param {DataSource=} dataSource
     */
    preload(index: number, dataSource?: DataSource | undefined): void;
    _preloadedContent: import('photoswipe/dist/types/slide/content').default;
    /**
     * @private
     * @param {Type<PhotoSwipe> | { default: Type<PhotoSwipe> }} module
     * @param {number} uid
     */
    private readonly _openPhotoswipe;
    /**
     * Unbinds all events, closes PhotoSwipe if it's open.
     */
    destroy(): void;
  }
}