Skip to content

Commit b09cba3

Browse files
authored
Fix import extensions for TS 4.7 ESM compatibility
1 parent 87aa728 commit b09cba3

33 files changed

+1727
-2040
lines changed

.eslintrc.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
"no-lonely-if": 0,
3838
"default-case": 0,
3939
"linebreak-style": 0,
40-
"class-methods-use-this": 0
40+
"class-methods-use-this": 0,
41+
"max-classes-per-file": 0,
42+
"arrow-parens": 0,
43+
"no-multiple-empty-lines": 0,
44+
"no-mixed-operators": 0,
45+
"function-paren-newline": 0
4146
}
4247
}

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@ aws-keys.json
2727
website/dist/
2828
*.idea
2929
/.idea
30+
.vscode
3031
.node-version
3132
.sass-cache/

package-lock.json

+1,633-1,952
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,19 @@
5050
"tsc": "tsc"
5151
},
5252
"devDependencies": {
53-
"@babel/core": "^7.13.16",
54-
"@babel/eslint-parser": "^7.13.14",
53+
"@babel/core": "^7.18.0",
54+
"@babel/eslint-parser": "^7.17.0",
5555
"@babel/plugin-syntax-class-properties": "^7.12.13",
5656
"chokidar-cli": "^3.0.0",
5757
"concurrently": "^6.0.2",
5858
"copyfiles": "^2.4.1",
59-
"eslint": "^7.25.0",
60-
"eslint-config-airbnb-base": "^13.2.0",
61-
"eslint-plugin-import": "^2.22.1",
59+
"eslint": "^8.16.0",
60+
"eslint-config-airbnb-base": "^15.0.0",
61+
"eslint-plugin-import": "^2.26.0",
6262
"rollup": "^2.46.0",
6363
"rollup-plugin-copy": "^3.4.0",
6464
"rollup-plugin-terser": "^7.0.2",
65-
"typescript": "^4.6.4"
65+
"typescript": "^4.7.3"
6666
},
6767
"repository": {
6868
"type": "git",

src/js/core/base.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import Eventable from './eventable';
1+
import Eventable from './eventable.js';
22
import {
33
getElementsFromOption
44
} from '../util/util.js';
5-
import Content from '../slide/content';
5+
import Content from '../slide/content.js';
66

7-
/** @typedef {import("../photoswipe").default} PhotoSwipe */
8-
/** @typedef {import("../photoswipe").PhotoSwipeOptions} PhotoSwipeOptions */
9-
/** @typedef {import("../slide/slide").SlideData} SlideData */
7+
/** @typedef {import("../photoswipe.js").default} PhotoSwipe */
8+
/** @typedef {import("../photoswipe.js").PhotoSwipeOptions} PhotoSwipeOptions */
9+
/** @typedef {import("../slide/slide.js").SlideData} SlideData */
1010

1111
/**
1212
* PhotoSwipe base class that can retrieve data about every slide.

src/js/core/eventable.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
/** @typedef {import("../lightbox/lightbox").default} PhotoSwipeLightbox */
2-
/** @typedef {import("../photoswipe").default} PhotoSwipe */
3-
/** @typedef {import("../photoswipe").PhotoSwipeOptions} PhotoSwipeOptions */
4-
/** @typedef {import("../photoswipe").DataSource} DataSource */
5-
/** @typedef {import("../ui/ui-element").UIElementData} UIElementData */
6-
/** @typedef {import("../slide/content").default} ContentDefault */
7-
/** @typedef {import("../slide/slide").default} Slide */
8-
/** @typedef {import("../slide/slide").SlideData} SlideData */
9-
/** @typedef {import("../slide/zoom-level").default} ZoomLevel */
10-
/** @typedef {import("../slide/get-thumb-bounds").Bounds} Bounds */
1+
/** @typedef {import('../lightbox/lightbox.js').default} PhotoSwipeLightbox */
2+
/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
3+
/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */
4+
/** @typedef {import('../photoswipe.js').DataSource} DataSource */
5+
/** @typedef {import('../ui/ui-element.js').UIElementData} UIElementData */
6+
/** @typedef {import('../slide/content.js').default} ContentDefault */
7+
/** @typedef {import('../slide/slide.js').default} Slide */
8+
/** @typedef {import('../slide/slide.js').SlideData} SlideData */
9+
/** @typedef {import('../slide/zoom-level.js').default} ZoomLevel */
10+
/** @typedef {import('../slide/get-thumb-bounds.js').Bounds} Bounds */
1111

1212
/**
1313
* Allow adding an arbitrary props to the Content

src/js/gestures/drag-handler.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import {
22
equalizePoints, roundPoint, clamp
33
} from '../util/util.js';
44

5-
/** @typedef {import("../photoswipe").Point} Point */
6-
/** @typedef {import("./gestures").default} Gestures */
5+
/** @typedef {import('../photoswipe.js').Point} Point */
6+
/** @typedef {import('./gestures.js').default} Gestures */
77

88
const PAN_END_FRICTION = 0.35;
99
const VERTICAL_DRAG_FRICTION = 0.6;

src/js/gestures/gestures.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import DragHandler from './drag-handler.js';
66
import ZoomHandler from './zoom-handler.js';
77
import TapHandler from './tap-handler.js';
88

9-
/** @typedef {import("../photoswipe").default} PhotoSwipe */
10-
/** @typedef {import("../photoswipe").Point} Point */
9+
/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
10+
/** @typedef {import('../photoswipe.js').Point} Point */
1111

1212
// How far should user should drag
1313
// until we can determine that the gesture is swipe and its direction

src/js/gestures/tap-handler.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/**
22
* @template T
33
* @template P
4-
* @typedef {import("../types").AddPostfix<T, P>} AddPostfix<T, P>
4+
* @typedef {import('../types.js').AddPostfix<T, P>} AddPostfix<T, P>
55
*/
66

7-
/** @typedef {import("./gestures").default} Gestures */
7+
/** @typedef {import('./gestures.js').default} Gestures */
88

99
/** @typedef {'imageClick' | 'bgClick' | 'tap' | 'doubleTap'} Actions */
1010
/** @typedef {{ x?: number; y?: number }} Point */

src/js/gestures/zoom-handler.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import {
22
equalizePoints, getDistanceBetween, clamp, pointsEqual
33
} from '../util/util.js';
44

5-
/** @typedef {import("../photoswipe").Point} Point */
6-
/** @typedef {import("./gestures").default} Gestures */
5+
/** @typedef {import('../photoswipe.js').Point} Point */
6+
/** @typedef {import('./gestures.js').default} Gestures */
77

88
const UPPER_ZOOM_FRICTION = 0.05;
99
const LOWER_ZOOM_FRICTION = 0.15;

src/js/keyboard.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { specialKeyUsed } from './util/util.js';
22

3-
/** @typedef {import("./photoswipe").default} PhotoSwipe */
3+
/** @typedef {import('./photoswipe.js').default} PhotoSwipe */
44

55
/**
66
* @template T
7-
* @typedef {import("./types").Methods<T>} Methods<T>
7+
* @typedef {import('./types.js').Methods<T>} Methods<T>
88
*/
99

1010
/**

src/js/lightbox/lightbox.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ import { lazyLoadSlide } from '../slide/loader.js';
99

1010
/**
1111
* @template T
12-
* @typedef {import("../types").Type<T>} Type<T>
12+
* @typedef {import('../types.js').Type<T>} Type<T>
1313
*/
1414

15-
/** @typedef {import("../photoswipe").default} PhotoSwipe */
16-
/** @typedef {import("../photoswipe").PhotoSwipeOptions} PhotoSwipeOptions */
17-
/** @typedef {import("../photoswipe").DataSource} DataSource */
18-
/** @typedef {import("../slide/content").default} Content */
19-
/** @typedef {import("../core/eventable").PhotoSwipeEventsMap} PhotoSwipeEventsMap */
20-
/** @typedef {import("../core/eventable").PhotoSwipeFiltersMap} PhotoSwipeFiltersMap */
15+
/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
16+
/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */
17+
/** @typedef {import('../photoswipe.js').DataSource} DataSource */
18+
/** @typedef {import('../slide/content.js').default} Content */
19+
/** @typedef {import('../core/eventable.js').PhotoSwipeEventsMap} PhotoSwipeEventsMap */
20+
/** @typedef {import('../core/eventable.js').PhotoSwipeFiltersMap} PhotoSwipeFiltersMap */
2121

2222
/**
2323
* @template T
24-
* @typedef {import("../core/eventable").EventCallback<T>} EventCallback<T>
24+
* @typedef {import('../core/eventable.js').EventCallback<T>} EventCallback<T>
2525
*/
2626

2727
/**

src/js/main-scroll.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import {
33
createElement,
44
} from './util/util.js';
55

6-
/** @typedef {import("./photoswipe").default} PhotoSwipe */
7-
/** @typedef {import("./slide/slide").default} Slide */
6+
/** @typedef {import('./photoswipe.js').default} PhotoSwipe */
7+
/** @typedef {import('./slide/slide.js').default} Slide */
88

99
/** @typedef {{ el: HTMLDivElement; slide?: Slide }} ItemHolder */
1010

src/js/opener.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import {
55
toTransformString
66
} from './util/util.js';
77

8-
/** @typedef {import("./photoswipe").default} PhotoSwipe */
9-
/** @typedef {import("./slide/get-thumb-bounds").Bounds} Bounds */
10-
/** @typedef {import("./util/animations").AnimationProps} AnimationProps */
8+
/** @typedef {import('./photoswipe.js').default} PhotoSwipe */
9+
/** @typedef {import('./slide/get-thumb-bounds.js').Bounds} Bounds */
10+
/** @typedef {import('./util/animations.js').AnimationProps} AnimationProps */
1111

1212
// some browsers do not paint
1313
// elements which opacity is set to 0,

src/js/photoswipe.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@ import ContentLoader from './slide/loader.js';
2222

2323
/**
2424
* @template T
25-
* @typedef {import("./types").Type<T>} Type<T>
25+
* @typedef {import('./types.js').Type<T>} Type<T>
2626
*/
2727

28-
/** @typedef {import("./slide/slide").SlideData} SlideData */
29-
/** @typedef {import("./slide/zoom-level").ZoomLevelOption} ZoomLevelOption */
30-
/** @typedef {import("./ui/ui-element").UIElementData} UIElementData */
31-
/** @typedef {import("./main-scroll").ItemHolder} ItemHolder */
32-
/** @typedef {import("./core/eventable").PhotoSwipeEventsMap} PhotoSwipeEventsMap */
33-
/** @typedef {import("./core/eventable").PhotoSwipeFiltersMap} PhotoSwipeFiltersMap */
28+
/** @typedef {import('./slide/slide.js').SlideData} SlideData */
29+
/** @typedef {import('./slide/zoom-level.js').ZoomLevelOption} ZoomLevelOption */
30+
/** @typedef {import('./ui/ui-element.js').UIElementData} UIElementData */
31+
/** @typedef {import('./main-scroll.js').ItemHolder} ItemHolder */
32+
/** @typedef {import('./core/eventable.js').PhotoSwipeEventsMap} PhotoSwipeEventsMap */
33+
/** @typedef {import('./core/eventable.js').PhotoSwipeFiltersMap} PhotoSwipeFiltersMap */
3434
/**
3535
* @template T
36-
* @typedef {import("./core/eventable").EventCallback<T>} EventCallback<T>
36+
* @typedef {import('./core/eventable.js').EventCallback<T>} EventCallback<T>
3737
*/
3838
/**
3939
* @template T
40-
* @typedef {import("./core/eventable").AugmentedEvent<T>} AugmentedEvent<T>
40+
* @typedef {import('./core/eventable.js').AugmentedEvent<T>} AugmentedEvent<T>
4141
*/
4242

4343
/** @typedef {{ x?: number; y?: number; id?: string | number }} Point */

src/js/scroll-wheel.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @typedef {import("./photoswipe").default} PhotoSwipe */
1+
/** @typedef {import('./photoswipe.js').default} PhotoSwipe */
22

33
/**
44
* Handles scroll wheel.

src/js/slide/content.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { createElement, LOAD_STATE, setWidthHeight } from '../util/util.js';
22
import Placeholder from './placeholder.js';
33

4-
/** @typedef {import("./slide").default} Slide */
5-
/** @typedef {import("./slide").SlideData} SlideData */
6-
/** @typedef {import("../photoswipe").default} PhotoSwipe */
7-
/** @typedef {import("../util/util").LoadState} LoadState */
4+
/** @typedef {import('./slide.js').default} Slide */
5+
/** @typedef {import('./slide.js').SlideData} SlideData */
6+
/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
7+
/** @typedef {import('../util/util.js').LoadState} LoadState */
88

99
class Content {
1010
/**

src/js/slide/get-thumb-bounds.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/** @typedef {import("./slide").SlideData} SlideData */
2-
/** @typedef {import("../photoswipe").default} PhotoSwipe */
1+
/** @typedef {import('./slide.js').SlideData} SlideData */
2+
/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
33

44
/** @typedef {{ x: number; y: number; w: number; innerRect?: { w: number; h: number; x: number; y: number } }} Bounds */
55

src/js/slide/loader.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { getViewportSize, getPanAreaSize } from '../util/viewport-size.js';
22
import ZoomLevel from './zoom-level.js';
33

4-
/** @typedef {import("./content").default} Content */
5-
/** @typedef {import("./slide").default} Slide */
6-
/** @typedef {import("./slide").SlideData} SlideData */
7-
/** @typedef {import("../photoswipe").default} PhotoSwipe */
8-
/** @typedef {import("../lightbox/lightbox").default} PhotoSwipeLightbox */
4+
/** @typedef {import('./content.js').default} Content */
5+
/** @typedef {import('./slide.js').default} Slide */
6+
/** @typedef {import('./slide.js').SlideData} SlideData */
7+
/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
8+
/** @typedef {import('../lightbox/lightbox.js').default} PhotoSwipeLightbox */
99

1010
const MIN_SLIDES_TO_CACHE = 5;
1111

src/js/slide/pan-bounds.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import {
33
} from '../util/util.js';
44
import { parsePaddingOption } from '../util/viewport-size.js';
55

6-
/** @typedef {import("./slide").default} Slide */
6+
/** @typedef {import('./slide.js').default} Slide */
77
/** @typedef {{ x?: number; y?: number }} Point */
88
/** @typedef {'x' | 'y'} Axis */
99

src/js/slide/slide.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
/** @typedef {import("../photoswipe").default} PhotoSwipe */
2-
/** @typedef {import("../photoswipe").Point} Point */
1+
/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
2+
/** @typedef {import('../photoswipe.js').Point} Point */
33

44
/**
55
* @typedef {_SlideData & Record<string, any>} SlideData

src/js/slide/zoom-level.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
const MAX_IMAGE_WIDTH = 4000;
22

3-
/** @typedef {import("../photoswipe").default} PhotoSwipe */
4-
/** @typedef {import("../photoswipe").PhotoSwipeOptions} PhotoSwipeOptions */
5-
/** @typedef {import("../slide/slide").SlideData} SlideData */
3+
/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
4+
/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */
5+
/** @typedef {import('../slide/slide.js').SlideData} SlideData */
66

77
/** @typedef {'fit' | 'fill' | number | ((zoomLevelObject: ZoomLevel) => number)} ZoomLevelOption */
88

src/js/ui/button-arrow.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Backward and forward arrow buttons
33
*/
44

5-
/** @typedef {import("./ui-element").UIElementData} UIElementData */
6-
/** @typedef {import("../photoswipe").default} PhotoSwipe */
5+
/** @typedef {import('./ui-element.js').UIElementData} UIElementData */
6+
/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
77

88
/**
99
*

src/js/ui/button-close.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @type {import("./ui-element").UIElementData} UIElementData */
1+
/** @type {import('./ui-element.js').UIElementData} UIElementData */
22
const closeButton = {
33
name: 'close',
44
title: 'Close',

src/js/ui/button-zoom.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @type {import("./ui-element").UIElementData} UIElementData */
1+
/** @type {import('./ui-element.js').UIElementData} UIElementData */
22
const zoomButton = {
33
name: 'zoom',
44
title: 'Zoom',

src/js/ui/counter-indicator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @type {import("./ui-element").UIElementData} UIElementData */
1+
/** @type {import('./ui-element.js').UIElementData} UIElementData */
22
export const counterIndicator = {
33
name: 'counter',
44
order: 5,

src/js/ui/loading-indicator.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @type {import("./ui-element").UIElementData} UIElementData */
1+
/** @type {import('./ui-element.js').UIElementData} UIElementData */
22
export const loadingIndicator = {
33
name: 'preloader',
44
appendTo: 'bar',

src/js/ui/ui-element.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import { createElement } from '../util/util.js';
22

3-
/** @typedef {import("../photoswipe").default} PhotoSwipe */
3+
/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
44

55
/**
66
* @template T
7-
* @typedef {import("../types").Methods<T>} Methods<T>
7+
* @typedef {import('../types.js').Methods<T>} Methods<T>
88
*/
99

1010
/**

src/js/ui/ui.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import zoomButton from './button-zoom.js';
55
import { loadingIndicator } from './loading-indicator.js';
66
import { counterIndicator } from './counter-indicator.js';
77

8-
/** @typedef {import("../photoswipe").default} PhotoSwipe */
9-
/** @typedef {import("./ui-element").UIElementData} UIElementData */
8+
/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
9+
/** @typedef {import('./ui-element.js').UIElementData} UIElementData */
1010

1111
/**
1212
* Set special class on element when image is zoomed.

src/js/util/css-animation.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { setTransitionStyle, removeTransitionStyle } from './util.js';
22

33
const DEFAULT_EASING = 'cubic-bezier(.4,0,.22,1)';
44

5-
/** @typedef {import("./animations").AnimationProps} AnimationProps */
5+
/** @typedef {import('./animations.js').AnimationProps} AnimationProps */
66

77
/**
88
* Runs CSS transition.

src/js/util/spring-animation.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import SpringEaser from './spring-easer.js';
22

3-
/** @typedef {import("./animations").AnimationProps} AnimationProps */
3+
/** @typedef {import('./animations.js').AnimationProps} AnimationProps */
44

55
class SpringAnimation {
66
/**

src/js/util/util.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** @typedef {import("../photoswipe").Point} Point */
1+
/** @typedef {import('../photoswipe.js').Point} Point */
22

33
/** @typedef {undefined | null | false | '' | 0} Falsy */
44
/** @typedef {keyof HTMLElementTagNameMap} HTMLElementTagName */

src/js/util/viewport-size.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/** @typedef {import("../photoswipe").PhotoSwipeOptions} PhotoSwipeOptions */
2-
/** @typedef {import("../photoswipe").default} PhotoSwipe */
3-
/** @typedef {import("../slide/slide").SlideData} SlideData */
1+
/** @typedef {import('../photoswipe.js').PhotoSwipeOptions} PhotoSwipeOptions */
2+
/** @typedef {import('../photoswipe.js').default} PhotoSwipe */
3+
/** @typedef {import('../slide/slide.js').SlideData} SlideData */
44

55
/**
66
* @param {PhotoSwipeOptions} options

0 commit comments

Comments
 (0)