@dpouris/gswap 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +6 -3
- package/examples/example-1/index.html +0 -13
- package/examples/example-1/public/assets/1.jpg +0 -0
- package/examples/example-1/public/assets/2.jpg +0 -0
- package/examples/example-1/public/assets/3.webp +0 -0
- package/examples/example-1/script.js +0 -29
- package/index.d.ts +0 -1
- package/index.js +0 -10
- package/src/index.ts +0 -1
- package/src/main.d.ts +0 -11
- package/src/main.js +0 -177
- package/src/main.ts +0 -213
- package/tsconfig.json +0 -102
- package/types/GallerySwapTypes.d.ts +0 -14
- package/types/GallerySwapTypes.js +0 -2
- package/types/GallerySwapTypes.ts +0 -15
package/package.json
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
{
|
2
2
|
"name": "@dpouris/gswap",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.7",
|
4
4
|
"description": "A library for swapping between images in a gallery",
|
5
5
|
"main": "./dist/main.js",
|
6
6
|
"types": "./dist/main.d.ts",
|
7
|
+
"files": [
|
8
|
+
"./README.md",
|
9
|
+
"./dist"
|
10
|
+
],
|
7
11
|
"directories": {
|
8
|
-
"example": "examples"
|
9
|
-
"gswap": "dist"
|
12
|
+
"example": "examples"
|
10
13
|
},
|
11
14
|
"scripts": {
|
12
15
|
"test": "echo \"Error: no test specified\" && exit 1"
|
@@ -1,13 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang="en">
|
3
|
-
<head>
|
4
|
-
<meta charset="UTF-8" />
|
5
|
-
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
7
|
-
<script src="./script.js" defer></script>
|
8
|
-
<title>Document</title>
|
9
|
-
</head>
|
10
|
-
<body>
|
11
|
-
<div id="gallery"></div>
|
12
|
-
</body>
|
13
|
-
</html>
|
Binary file
|
Binary file
|
Binary file
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import { GSwap } from "@dpouris/gswap";
|
2
|
-
|
3
|
-
const gallery = new GSwap(
|
4
|
-
document.getElementById("gallery"),
|
5
|
-
["./1.jpg", "./2.jpg", "./3.webp"],
|
6
|
-
{
|
7
|
-
animation: "fade",
|
8
|
-
animationDuration: "300",
|
9
|
-
navigation: true,
|
10
|
-
repeat: true,
|
11
|
-
imgDimensions: { height: 300, width: 300 },
|
12
|
-
}
|
13
|
-
);
|
14
|
-
|
15
|
-
// const stackBtn = document.createElement("button");
|
16
|
-
// const prevBtn = document.createElement("button");
|
17
|
-
// const nextBtn = document.createElement("button");
|
18
|
-
|
19
|
-
// stackBtn.onclick = gallery.stackImages;
|
20
|
-
// prevBtn.onclick = gallery.prev;
|
21
|
-
// nextBtn.onclick = gallery.next;
|
22
|
-
|
23
|
-
// // stackBtn.innerText = "Stack";
|
24
|
-
// prevBtn.innerText = "Prev";
|
25
|
-
// nextBtn.innerText = "Next";
|
26
|
-
|
27
|
-
// // document.body.appendChild(stackBtn);
|
28
|
-
// document.body.appendChild(prevBtn);
|
29
|
-
// document.body.appendChild(nextBtn);
|
package/index.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export { GSwap as GSwap } from "./src/main";
|
package/index.js
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.GSwap = void 0;
|
4
|
-
var main_1 = require("./src/main");
|
5
|
-
Object.defineProperty(exports, "GSwap", {
|
6
|
-
enumerable: true,
|
7
|
-
get: function () {
|
8
|
-
return main_1.GSwap;
|
9
|
-
},
|
10
|
-
});
|
package/src/index.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export { GSwap as GSwap } from "./main";
|
package/src/main.d.ts
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
import type { Options } from "../types/GallerySwapTypes";
|
2
|
-
export declare class GSwap {
|
3
|
-
#private;
|
4
|
-
containerElem: HTMLDivElement;
|
5
|
-
images: string[];
|
6
|
-
options: Options;
|
7
|
-
constructor(containerElem: HTMLDivElement, images: string[], options: Options);
|
8
|
-
stackImages: () => void;
|
9
|
-
next: () => void;
|
10
|
-
prev: () => void;
|
11
|
-
}
|
package/src/main.js
DELETED
@@ -1,177 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
3
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
4
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
5
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
6
|
-
};
|
7
|
-
var _GSwap_instances, _GSwap_currentImg, _GSwap_createGSwapElement, _GSwap_createImageElements, _GSwap_createNavigation, _GSwap_appendElementsOnContainer, _GSwap_shiftImagesToTheRight, _GSwap_shiftImagesToTheLeft, _GSwap_findPrevActiveElem, _GSwap_findNextActiveElement;
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
9
|
-
exports.GSwap = void 0;
|
10
|
-
class GSwap {
|
11
|
-
constructor(containerElem, images, options) {
|
12
|
-
_GSwap_instances.add(this);
|
13
|
-
_GSwap_currentImg.set(this, 0);
|
14
|
-
_GSwap_createNavigation.set(this, () => {
|
15
|
-
const nav = document.createElement("nav");
|
16
|
-
nav.classList.add("gallery-swap-nav");
|
17
|
-
const navLeft = document.createElement("button");
|
18
|
-
navLeft.onclick = this.prev;
|
19
|
-
navLeft.innerHTML = "→";
|
20
|
-
navLeft.classList.add("gallery-swap-nav-left");
|
21
|
-
const navRight = document.createElement("button");
|
22
|
-
navRight.onclick = this.next;
|
23
|
-
navRight.innerHTML = "←";
|
24
|
-
navRight.classList.add("gallery-swap-nav-right");
|
25
|
-
if (this.options.navigation === "forwardOnly") {
|
26
|
-
nav.appendChild(navRight);
|
27
|
-
return nav;
|
28
|
-
}
|
29
|
-
if (this.options.navigation === "backOnly") {
|
30
|
-
nav.appendChild(navLeft);
|
31
|
-
return nav;
|
32
|
-
}
|
33
|
-
nav.appendChild(navLeft);
|
34
|
-
nav.appendChild(navRight);
|
35
|
-
return nav;
|
36
|
-
});
|
37
|
-
_GSwap_shiftImagesToTheRight.set(this, () => {
|
38
|
-
const last = this.containerElem.children[0].lastElementChild;
|
39
|
-
this.containerElem.children[0].insertAdjacentHTML("afterbegin", last.outerHTML);
|
40
|
-
last.remove();
|
41
|
-
});
|
42
|
-
_GSwap_shiftImagesToTheLeft.set(this, () => {
|
43
|
-
const first = this.containerElem.children[0]
|
44
|
-
.firstElementChild;
|
45
|
-
this.containerElem.children[0].insertAdjacentHTML("beforeend", first.outerHTML);
|
46
|
-
first.style.opacity = "0";
|
47
|
-
first.remove();
|
48
|
-
// first.remove();
|
49
|
-
});
|
50
|
-
_GSwap_findPrevActiveElem.set(this, () => {
|
51
|
-
this.containerElem.children[0].childNodes.forEach((image) => {
|
52
|
-
const imgElem = image;
|
53
|
-
if (imgElem.classList.contains("active")) {
|
54
|
-
imgElem.classList.remove("active");
|
55
|
-
}
|
56
|
-
});
|
57
|
-
const activeElem = this.containerElem.children[0]
|
58
|
-
.lastElementChild;
|
59
|
-
activeElem.style.opacity = "0";
|
60
|
-
setTimeout(() => {
|
61
|
-
activeElem.style.opacity = "1";
|
62
|
-
}, this.options.animationDuration);
|
63
|
-
activeElem.classList.add("active");
|
64
|
-
});
|
65
|
-
_GSwap_findNextActiveElement.set(this, () => {
|
66
|
-
this.containerElem.children[0].childNodes.forEach((image) => {
|
67
|
-
const imgElem = image;
|
68
|
-
if (imgElem.classList.contains("active")) {
|
69
|
-
imgElem.classList.remove("active");
|
70
|
-
imgElem.style.opacity = "0";
|
71
|
-
setTimeout(() => {
|
72
|
-
imgElem.style.opacity = "1";
|
73
|
-
}, this.options.animationDuration);
|
74
|
-
}
|
75
|
-
});
|
76
|
-
const activeElem = this.containerElem.children[0].lastElementChild;
|
77
|
-
activeElem.classList.add("active");
|
78
|
-
});
|
79
|
-
this.stackImages = () => {
|
80
|
-
let directionLeft;
|
81
|
-
let directionTop;
|
82
|
-
switch (this.options.direction) {
|
83
|
-
case "left":
|
84
|
-
directionLeft = 20;
|
85
|
-
directionTop = 20;
|
86
|
-
break;
|
87
|
-
case "right":
|
88
|
-
directionLeft = -20;
|
89
|
-
directionTop = 20;
|
90
|
-
break;
|
91
|
-
case "top":
|
92
|
-
directionLeft = 0;
|
93
|
-
directionTop = 20;
|
94
|
-
break;
|
95
|
-
case "bottom":
|
96
|
-
directionLeft = 0;
|
97
|
-
directionTop = -20;
|
98
|
-
break;
|
99
|
-
}
|
100
|
-
let counter = 0;
|
101
|
-
this.containerElem.children[0].childNodes.forEach((image) => {
|
102
|
-
image.style.position = "absolute";
|
103
|
-
image.style.opacity = "1";
|
104
|
-
image.style.top =
|
105
|
-
(counter * directionTop).toString() + "px";
|
106
|
-
image.style.left =
|
107
|
-
(counter * directionLeft).toString() + "px";
|
108
|
-
counter++;
|
109
|
-
});
|
110
|
-
};
|
111
|
-
this.next = () => {
|
112
|
-
__classPrivateFieldGet(this, _GSwap_shiftImagesToTheRight, "f").call(this);
|
113
|
-
this.stackImages();
|
114
|
-
__classPrivateFieldGet(this, _GSwap_findNextActiveElement, "f").call(this);
|
115
|
-
};
|
116
|
-
this.prev = () => {
|
117
|
-
__classPrivateFieldGet(this, _GSwap_shiftImagesToTheLeft, "f").call(this);
|
118
|
-
this.stackImages();
|
119
|
-
__classPrivateFieldGet(this, _GSwap_findPrevActiveElem, "f").call(this);
|
120
|
-
};
|
121
|
-
this.containerElem = containerElem;
|
122
|
-
this.images = images;
|
123
|
-
this.options = options;
|
124
|
-
this.options.imgDimensions = this.options
|
125
|
-
.imgDimensions.hasOwnProperty("height")
|
126
|
-
.hasOwnProperty("width")
|
127
|
-
? this.options.imgDimensions
|
128
|
-
: { width: 300, height: 300 };
|
129
|
-
this.options.direction = this.options.direction;
|
130
|
-
this.options.animationDuration =
|
131
|
-
this.options.animationDuration === undefined
|
132
|
-
? 300
|
133
|
-
: this.options.animationDuration;
|
134
|
-
this.options.direction =
|
135
|
-
this.options.direction === undefined ? "left" : this.options.direction;
|
136
|
-
this.options.navigation =
|
137
|
-
this.options.navigation === undefined ? true : this.options.navigation;
|
138
|
-
__classPrivateFieldGet(this, _GSwap_instances, "m", _GSwap_appendElementsOnContainer).call(this);
|
139
|
-
this.stackImages();
|
140
|
-
}
|
141
|
-
}
|
142
|
-
exports.GSwap = GSwap;
|
143
|
-
_GSwap_currentImg = new WeakMap(), _GSwap_createNavigation = new WeakMap(), _GSwap_shiftImagesToTheRight = new WeakMap(), _GSwap_shiftImagesToTheLeft = new WeakMap(), _GSwap_findPrevActiveElem = new WeakMap(), _GSwap_findNextActiveElement = new WeakMap(), _GSwap_instances = new WeakSet(), _GSwap_createGSwapElement = function _GSwap_createGSwapElement() {
|
144
|
-
const GSElement = document.createElement("div");
|
145
|
-
GSElement.classList.add("gallery-swap");
|
146
|
-
// GSElement.style.transition = `all ${this.options.animationDuration} ${this.options.animation}`;
|
147
|
-
GSElement.style.height = this.options.imgDimensions.height * 2 + "px";
|
148
|
-
GSElement.style.width = this.options.imgDimensions.width * 2 + "px";
|
149
|
-
GSElement.style.position = "relative";
|
150
|
-
// GSElement.style.animation = this.options.animation;
|
151
|
-
// GSElement.style.animationDuration = this.options.animationDuration;
|
152
|
-
// const imageContainer = document.createElement("div");
|
153
|
-
// Place images inside div container
|
154
|
-
const images = __classPrivateFieldGet(this, _GSwap_instances, "m", _GSwap_createImageElements).call(this);
|
155
|
-
images.forEach((image) => {
|
156
|
-
GSElement.appendChild(image);
|
157
|
-
});
|
158
|
-
return GSElement;
|
159
|
-
}, _GSwap_createImageElements = function _GSwap_createImageElements() {
|
160
|
-
return this.images.map((image) => {
|
161
|
-
const imgElement = document.createElement("img");
|
162
|
-
if (image === this.images[this.images.length - 1]) {
|
163
|
-
imgElement.classList.add("active");
|
164
|
-
}
|
165
|
-
imgElement.src = image;
|
166
|
-
imgElement.width = this.options.imgDimensions.width;
|
167
|
-
imgElement.height = this.options.imgDimensions.height;
|
168
|
-
imgElement.style.transition = `all ${this.options.animationDuration}ms ease-in-out`;
|
169
|
-
return imgElement;
|
170
|
-
});
|
171
|
-
}, _GSwap_appendElementsOnContainer = function _GSwap_appendElementsOnContainer() {
|
172
|
-
this.containerElem.innerHTML = "";
|
173
|
-
this.containerElem.appendChild(__classPrivateFieldGet(this, _GSwap_instances, "m", _GSwap_createGSwapElement).call(this));
|
174
|
-
if (this.options.navigation === true) {
|
175
|
-
this.containerElem.appendChild(__classPrivateFieldGet(this, _GSwap_createNavigation, "f").call(this));
|
176
|
-
}
|
177
|
-
};
|
package/src/main.ts
DELETED
@@ -1,213 +0,0 @@
|
|
1
|
-
import type { Options } from "../types/GallerySwapTypes";
|
2
|
-
|
3
|
-
export class GSwap {
|
4
|
-
containerElem: HTMLDivElement;
|
5
|
-
images: string[];
|
6
|
-
options: Options;
|
7
|
-
|
8
|
-
#currentImg: number = 0;
|
9
|
-
|
10
|
-
constructor(
|
11
|
-
containerElem: HTMLDivElement,
|
12
|
-
images: string[],
|
13
|
-
options: Options
|
14
|
-
) {
|
15
|
-
this.containerElem = containerElem;
|
16
|
-
this.images = images;
|
17
|
-
this.options = options;
|
18
|
-
|
19
|
-
this.options.imgDimensions = this.options
|
20
|
-
.imgDimensions!.hasOwnProperty("height")
|
21
|
-
.hasOwnProperty("width")
|
22
|
-
? this.options.imgDimensions
|
23
|
-
: { width: 300, height: 300 };
|
24
|
-
this.options.direction = this.options.direction;
|
25
|
-
this.options.animationDuration =
|
26
|
-
this.options.animationDuration === undefined
|
27
|
-
? 300
|
28
|
-
: this.options.animationDuration;
|
29
|
-
this.options.direction =
|
30
|
-
this.options.direction === undefined ? "left" : this.options.direction;
|
31
|
-
this.options.navigation =
|
32
|
-
this.options.navigation === undefined ? true : this.options.navigation;
|
33
|
-
|
34
|
-
this.#appendElementsOnContainer();
|
35
|
-
|
36
|
-
this.stackImages();
|
37
|
-
}
|
38
|
-
|
39
|
-
#createGSwapElement() {
|
40
|
-
const GSElement = document.createElement("div");
|
41
|
-
GSElement.classList.add("gallery-swap");
|
42
|
-
// GSElement.style.transition = `all ${this.options.animationDuration} ${this.options.animation}`;
|
43
|
-
GSElement.style.height = this.options.imgDimensions!.height * 2 + "px";
|
44
|
-
GSElement.style.width = this.options.imgDimensions!.width * 2 + "px";
|
45
|
-
GSElement.style.position = "relative";
|
46
|
-
// GSElement.style.animation = this.options.animation;
|
47
|
-
// GSElement.style.animationDuration = this.options.animationDuration;
|
48
|
-
|
49
|
-
// const imageContainer = document.createElement("div");
|
50
|
-
|
51
|
-
// Place images inside div container
|
52
|
-
const images = this.#createImageElements();
|
53
|
-
images.forEach((image) => {
|
54
|
-
GSElement.appendChild(image);
|
55
|
-
});
|
56
|
-
return GSElement;
|
57
|
-
}
|
58
|
-
|
59
|
-
#createImageElements() {
|
60
|
-
return this.images.map((image) => {
|
61
|
-
const imgElement = document.createElement("img");
|
62
|
-
if (image === this.images[this.images.length - 1]) {
|
63
|
-
imgElement.classList.add("active");
|
64
|
-
}
|
65
|
-
imgElement.src = image;
|
66
|
-
imgElement.width = this.options.imgDimensions!.width;
|
67
|
-
imgElement.height = this.options.imgDimensions!.height;
|
68
|
-
imgElement.style.transition = `all ${this.options.animationDuration}ms ease-in-out`;
|
69
|
-
return imgElement;
|
70
|
-
});
|
71
|
-
}
|
72
|
-
|
73
|
-
#createNavigation = () => {
|
74
|
-
const nav = document.createElement("nav");
|
75
|
-
nav.classList.add("gallery-swap-nav");
|
76
|
-
|
77
|
-
const navLeft = document.createElement("button");
|
78
|
-
navLeft.onclick = this.prev;
|
79
|
-
|
80
|
-
navLeft.innerHTML = "→";
|
81
|
-
navLeft.classList.add("gallery-swap-nav-left");
|
82
|
-
|
83
|
-
const navRight = document.createElement("button");
|
84
|
-
navRight.onclick = this.next;
|
85
|
-
navRight.innerHTML = "←";
|
86
|
-
navRight.classList.add("gallery-swap-nav-right");
|
87
|
-
|
88
|
-
if (this.options.navigation === "forwardOnly") {
|
89
|
-
nav.appendChild(navRight);
|
90
|
-
return nav;
|
91
|
-
}
|
92
|
-
if (this.options.navigation === "backOnly") {
|
93
|
-
nav.appendChild(navLeft);
|
94
|
-
return nav;
|
95
|
-
}
|
96
|
-
|
97
|
-
nav.appendChild(navLeft);
|
98
|
-
nav.appendChild(navRight);
|
99
|
-
|
100
|
-
return nav;
|
101
|
-
};
|
102
|
-
|
103
|
-
#appendElementsOnContainer() {
|
104
|
-
this.containerElem.innerHTML = "";
|
105
|
-
this.containerElem.appendChild(this.#createGSwapElement());
|
106
|
-
if (this.options.navigation === true) {
|
107
|
-
this.containerElem.appendChild(this.#createNavigation());
|
108
|
-
}
|
109
|
-
}
|
110
|
-
|
111
|
-
#shiftImagesToTheRight = () => {
|
112
|
-
const last = this.containerElem.children[0].lastElementChild!;
|
113
|
-
|
114
|
-
this.containerElem.children[0].insertAdjacentHTML(
|
115
|
-
"afterbegin",
|
116
|
-
last.outerHTML
|
117
|
-
);
|
118
|
-
|
119
|
-
last.remove();
|
120
|
-
};
|
121
|
-
#shiftImagesToTheLeft = () => {
|
122
|
-
const first = this.containerElem.children[0]
|
123
|
-
.firstElementChild! as HTMLImageElement;
|
124
|
-
this.containerElem.children[0].insertAdjacentHTML(
|
125
|
-
"beforeend",
|
126
|
-
first.outerHTML
|
127
|
-
);
|
128
|
-
first.style.opacity = "0";
|
129
|
-
|
130
|
-
first.remove();
|
131
|
-
|
132
|
-
// first.remove();
|
133
|
-
};
|
134
|
-
|
135
|
-
#findPrevActiveElem = () => {
|
136
|
-
this.containerElem.children[0].childNodes.forEach((image) => {
|
137
|
-
const imgElem = image as HTMLImageElement;
|
138
|
-
if (imgElem.classList.contains("active")) {
|
139
|
-
imgElem.classList.remove("active");
|
140
|
-
}
|
141
|
-
});
|
142
|
-
const activeElem = this.containerElem.children[0]
|
143
|
-
.lastElementChild! as HTMLElement;
|
144
|
-
|
145
|
-
activeElem.style.opacity = "0";
|
146
|
-
setTimeout(() => {
|
147
|
-
activeElem.style.opacity = "1";
|
148
|
-
}, this.options.animationDuration);
|
149
|
-
|
150
|
-
activeElem.classList.add("active");
|
151
|
-
};
|
152
|
-
|
153
|
-
#findNextActiveElement = () => {
|
154
|
-
this.containerElem.children[0].childNodes.forEach((image) => {
|
155
|
-
const imgElem = image as HTMLImageElement;
|
156
|
-
if (imgElem.classList.contains("active")) {
|
157
|
-
(imgElem as HTMLImageElement).classList.remove("active");
|
158
|
-
imgElem.style.opacity = "0";
|
159
|
-
setTimeout(() => {
|
160
|
-
imgElem.style.opacity = "1";
|
161
|
-
}, this.options.animationDuration);
|
162
|
-
}
|
163
|
-
});
|
164
|
-
const activeElem = this.containerElem.children[0].lastElementChild!;
|
165
|
-
|
166
|
-
activeElem.classList.add("active");
|
167
|
-
};
|
168
|
-
|
169
|
-
stackImages = () => {
|
170
|
-
let directionLeft: number;
|
171
|
-
let directionTop: number;
|
172
|
-
switch (this.options.direction) {
|
173
|
-
case "left":
|
174
|
-
directionLeft = 20;
|
175
|
-
directionTop = 20;
|
176
|
-
break;
|
177
|
-
case "right":
|
178
|
-
directionLeft = -20;
|
179
|
-
directionTop = 20;
|
180
|
-
break;
|
181
|
-
case "top":
|
182
|
-
directionLeft = 0;
|
183
|
-
directionTop = 20;
|
184
|
-
break;
|
185
|
-
case "bottom":
|
186
|
-
directionLeft = 0;
|
187
|
-
directionTop = -20;
|
188
|
-
break;
|
189
|
-
}
|
190
|
-
let counter = 0;
|
191
|
-
this.containerElem.children[0].childNodes.forEach((image) => {
|
192
|
-
(image as HTMLImageElement).style.position = "absolute";
|
193
|
-
(image as HTMLImageElement).style.opacity = "1";
|
194
|
-
(image as HTMLImageElement).style.top =
|
195
|
-
(counter * directionTop).toString() + "px";
|
196
|
-
(image as HTMLImageElement).style.left =
|
197
|
-
(counter * directionLeft).toString() + "px";
|
198
|
-
counter++;
|
199
|
-
});
|
200
|
-
};
|
201
|
-
|
202
|
-
next = () => {
|
203
|
-
this.#shiftImagesToTheRight();
|
204
|
-
this.stackImages();
|
205
|
-
this.#findNextActiveElement();
|
206
|
-
};
|
207
|
-
|
208
|
-
prev = () => {
|
209
|
-
this.#shiftImagesToTheLeft();
|
210
|
-
this.stackImages();
|
211
|
-
this.#findPrevActiveElem();
|
212
|
-
};
|
213
|
-
}
|
package/tsconfig.json
DELETED
@@ -1,102 +0,0 @@
|
|
1
|
-
{
|
2
|
-
"compilerOptions": {
|
3
|
-
/* Visit https://aka.ms/tsconfig.json to read more about this file */
|
4
|
-
|
5
|
-
/* Projects */
|
6
|
-
// "incremental": true, /* Enable incremental compilation */
|
7
|
-
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
8
|
-
// "tsBuildInfoFile": "./", /* Specify the folder for .tsbuildinfo incremental compilation files. */
|
9
|
-
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects */
|
10
|
-
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
11
|
-
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
12
|
-
|
13
|
-
/* Language and Environment */
|
14
|
-
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
15
|
-
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
16
|
-
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
17
|
-
// "experimentalDecorators": true, /* Enable experimental support for TC39 stage 2 draft decorators. */
|
18
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
19
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h' */
|
20
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
21
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.` */
|
22
|
-
// "reactNamespace": "", /* Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit. */
|
23
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
24
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
25
|
-
|
26
|
-
/* Modules */
|
27
|
-
"module": "commonjs" /* Specify what module code is generated. */,
|
28
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
29
|
-
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
30
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
31
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
32
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
33
|
-
// "typeRoots": [], /* Specify multiple folders that act like `./node_modules/@types`. */
|
34
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
35
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
36
|
-
// "resolveJsonModule": true, /* Enable importing .json files */
|
37
|
-
// "noResolve": true, /* Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project. */
|
38
|
-
|
39
|
-
/* JavaScript Support */
|
40
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
41
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
42
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
43
|
-
|
44
|
-
/* Emit */
|
45
|
-
"declaration": true /* Generate .d.ts files from TypeScript and JavaScript files in your project. */,
|
46
|
-
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
47
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
48
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
49
|
-
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If `declaration` is true, also designates a file that bundles all .d.ts output. */
|
50
|
-
// "outDir": "./dist" /* Specify an output folder for all emitted files. */,
|
51
|
-
// "removeComments": true, /* Disable emitting comments. */
|
52
|
-
// "noEmit": true, /* Disable emitting files from a compilation. */
|
53
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
54
|
-
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types */
|
55
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
56
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
57
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
58
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
59
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
60
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
61
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
62
|
-
// "stripInternal": true, /* Disable emitting declarations that have `@internal` in their JSDoc comments. */
|
63
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like `__extends` in compiled output. */
|
64
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
65
|
-
// "preserveConstEnums": true, /* Disable erasing `const enum` declarations in generated code. */
|
66
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
67
|
-
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
68
|
-
|
69
|
-
/* Interop Constraints */
|
70
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
71
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
72
|
-
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */,
|
73
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
74
|
-
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
75
|
-
|
76
|
-
/* Type Checking */
|
77
|
-
"strict": true /* Enable all strict type-checking options. */,
|
78
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied `any` type.. */
|
79
|
-
// "strictNullChecks": true, /* When type checking, take into account `null` and `undefined`. */
|
80
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
81
|
-
// "strictBindCallApply": true, /* Check that the arguments for `bind`, `call`, and `apply` methods match the original function. */
|
82
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
83
|
-
// "noImplicitThis": true, /* Enable error reporting when `this` is given the type `any`. */
|
84
|
-
// "useUnknownInCatchVariables": true, /* Type catch clause variables as 'unknown' instead of 'any'. */
|
85
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
86
|
-
// "noUnusedLocals": true, /* Enable error reporting when a local variables aren't read. */
|
87
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read */
|
88
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
89
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
90
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
91
|
-
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
|
92
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
93
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type */
|
94
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
95
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
96
|
-
|
97
|
-
/* Completeness */
|
98
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
99
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
100
|
-
},
|
101
|
-
"include": ["./src/**/*.ts", "index.d.ts"]
|
102
|
-
}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
export interface GallerySwap {
|
2
|
-
container: HTMLDivElement;
|
3
|
-
}
|
4
|
-
export declare type Options = {
|
5
|
-
animation?: string;
|
6
|
-
animationDuration?: number;
|
7
|
-
navigation?: boolean | "forwardOnly" | "backOnly";
|
8
|
-
repeat?: boolean;
|
9
|
-
direction?: "left" | "right" | "top" | "bottom";
|
10
|
-
imgDimensions?: {
|
11
|
-
height: number;
|
12
|
-
width: number;
|
13
|
-
};
|
14
|
-
};
|
@@ -1,15 +0,0 @@
|
|
1
|
-
export interface GallerySwap {
|
2
|
-
container: HTMLDivElement;
|
3
|
-
}
|
4
|
-
|
5
|
-
export type Options = {
|
6
|
-
animation?: string;
|
7
|
-
animationDuration?: number;
|
8
|
-
navigation?: boolean | "forwardOnly" | "backOnly";
|
9
|
-
repeat?: boolean;
|
10
|
-
direction?: "left" | "right" | "top" | "bottom";
|
11
|
-
imgDimensions?: {
|
12
|
-
height: number;
|
13
|
-
width: number;
|
14
|
-
};
|
15
|
-
};
|