@mintplayer/ng-swiper 15.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -0
- package/esm2020/index.mjs +4 -0
- package/esm2020/lib/directives/index.mjs +3 -0
- package/esm2020/lib/directives/swipe/swipe.directive.mjs +93 -0
- package/esm2020/lib/directives/swipe-container/swipe-container.directive.mjs +212 -0
- package/esm2020/lib/interfaces/index.mjs +4 -0
- package/esm2020/lib/interfaces/last-touch.mjs +2 -0
- package/esm2020/lib/interfaces/point.mjs +2 -0
- package/esm2020/lib/interfaces/start-touch.mjs +2 -0
- package/esm2020/lib/swiper.module.mjs +20 -0
- package/esm2020/mintplayer-ng-swiper.mjs +5 -0
- package/fesm2015/mintplayer-ng-swiper.mjs +330 -0
- package/fesm2015/mintplayer-ng-swiper.mjs.map +1 -0
- package/fesm2020/mintplayer-ng-swiper.mjs +321 -0
- package/fesm2020/mintplayer-ng-swiper.mjs.map +1 -0
- package/index.d.ts +3 -0
- package/lib/directives/index.d.ts +2 -0
- package/lib/directives/swipe/swipe.directive.d.ts +20 -0
- package/lib/directives/swipe-container/swipe-container.directive.d.ts +47 -0
- package/lib/interfaces/index.d.ts +3 -0
- package/lib/interfaces/last-touch.d.ts +5 -0
- package/lib/interfaces/point.d.ts +4 -0
- package/lib/interfaces/start-touch.d.ts +5 -0
- package/lib/swiper.module.d.ts +10 -0
- package/package.json +35 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { EventEmitter, Directive, Inject, HostBinding, ContentChildren, forwardRef, Input, Output, HostListener, NgModule } from '@angular/core';
|
|
3
|
+
import { DOCUMENT, CommonModule } from '@angular/common';
|
|
4
|
+
import { ObserversModule } from '@angular/cdk/observers';
|
|
5
|
+
import { BehaviorSubject, Subject, combineLatest, map, takeUntil, filter, mergeMap, take } from 'rxjs';
|
|
6
|
+
import * as i1 from '@angular/animations';
|
|
7
|
+
import { style, animate } from '@angular/animations';
|
|
8
|
+
|
|
9
|
+
class BsSwipeContainerDirective {
|
|
10
|
+
constructor(element, animationBuilder, document) {
|
|
11
|
+
this.animationBuilder = animationBuilder;
|
|
12
|
+
this.offsetLeft = null;
|
|
13
|
+
this.offsetRight = null;
|
|
14
|
+
this.offsetTop = null;
|
|
15
|
+
this.offsetBottom = null;
|
|
16
|
+
this.minimumOffset = 50;
|
|
17
|
+
this.imageIndexChange = new EventEmitter();
|
|
18
|
+
this.isViewInited$ = new BehaviorSubject(false);
|
|
19
|
+
this.destroyed$ = new Subject();
|
|
20
|
+
this.startTouch$ = new BehaviorSubject(null);
|
|
21
|
+
this.lastTouch$ = new BehaviorSubject(null);
|
|
22
|
+
this.swipes$ = new BehaviorSubject(null);
|
|
23
|
+
this.imageIndex$ = new BehaviorSubject(0);
|
|
24
|
+
this.containerElement = element;
|
|
25
|
+
this.document = document;
|
|
26
|
+
this.offset$ = combineLatest([this.startTouch$, this.lastTouch$, this.imageIndex$, this.isViewInited$])
|
|
27
|
+
.pipe(map(([startTouch, lastTouch, imageIndex, isViewInited]) => {
|
|
28
|
+
if (!isViewInited) {
|
|
29
|
+
return (-imageIndex * 100);
|
|
30
|
+
}
|
|
31
|
+
else if (!!startTouch && !!lastTouch) {
|
|
32
|
+
return (-imageIndex * 100 + (lastTouch.position.x - startTouch.position.x) / this.containerElement.nativeElement.clientWidth * 100);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
return (-imageIndex * 100);
|
|
36
|
+
}
|
|
37
|
+
}));
|
|
38
|
+
this.padLeft$ = this.swipes$.pipe(map(swipes => {
|
|
39
|
+
if (!swipes) {
|
|
40
|
+
return 0;
|
|
41
|
+
}
|
|
42
|
+
let count = 0;
|
|
43
|
+
for (const s of swipes) {
|
|
44
|
+
if (!s.offside) {
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
count++;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return count;
|
|
52
|
+
}));
|
|
53
|
+
this.padRight$ = this.swipes$.pipe(map(swipes => {
|
|
54
|
+
if (!swipes) {
|
|
55
|
+
return 0;
|
|
56
|
+
}
|
|
57
|
+
let count = 0;
|
|
58
|
+
for (const s of swipes.toArray().reverse()) {
|
|
59
|
+
if (!s.offside) {
|
|
60
|
+
break;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
count++;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return count;
|
|
67
|
+
}));
|
|
68
|
+
this.offsetLeft$ = combineLatest([this.offset$, this.padLeft$])
|
|
69
|
+
.pipe(map(([offset, padLeft]) => {
|
|
70
|
+
return offset - padLeft * 100;
|
|
71
|
+
}));
|
|
72
|
+
this.offsetRight$ = combineLatest([this.offset$, this.padLeft$, this.padRight$])
|
|
73
|
+
.pipe(map(([offset, padLeft, padRight]) => {
|
|
74
|
+
return -(offset - padLeft * 100) - (padRight - 1) * 100;
|
|
75
|
+
}));
|
|
76
|
+
this.offsetLeft$
|
|
77
|
+
.pipe(takeUntil(this.destroyed$))
|
|
78
|
+
.subscribe((offsetLeft) => this.offsetLeft = offsetLeft);
|
|
79
|
+
this.offsetRight$
|
|
80
|
+
.pipe(takeUntil(this.destroyed$))
|
|
81
|
+
.subscribe((offsetRight) => this.offsetRight = offsetRight);
|
|
82
|
+
this.imageIndex$
|
|
83
|
+
.pipe(takeUntil(this.destroyed$))
|
|
84
|
+
.subscribe((imageIndex) => this.imageIndexChange.emit(imageIndex));
|
|
85
|
+
this.actualSwipes$ = this.swipes$
|
|
86
|
+
.pipe(map(swipes => {
|
|
87
|
+
if (swipes) {
|
|
88
|
+
return swipes.filter(swipe => !swipe.offside);
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
return [];
|
|
92
|
+
}
|
|
93
|
+
}));
|
|
94
|
+
this.slideHeights$ = this.actualSwipes$
|
|
95
|
+
.pipe(filter(swipes => !!swipes))
|
|
96
|
+
// .pipe(map(swipes => <QueryList<BsSwipeDirective>>swipes))
|
|
97
|
+
.pipe(mergeMap(swipes => combineLatest(swipes.map(swipe => swipe.slideHeight$))));
|
|
98
|
+
this.currentSlideHeight$ = combineLatest([this.slideHeights$, this.imageIndex$])
|
|
99
|
+
.pipe(map(([slideHeights, imageIndex]) => {
|
|
100
|
+
const maxHeight = Math.max(...slideHeights);
|
|
101
|
+
const currHeight = slideHeights[imageIndex] ?? maxHeight;
|
|
102
|
+
return maxHeight - (maxHeight - currHeight) /* / 2*/;
|
|
103
|
+
}));
|
|
104
|
+
}
|
|
105
|
+
set swipes(value) {
|
|
106
|
+
setTimeout(() => this.swipes$.next(value));
|
|
107
|
+
}
|
|
108
|
+
//#region ImageIndex
|
|
109
|
+
get imageIndex() {
|
|
110
|
+
return this.imageIndex$.value;
|
|
111
|
+
}
|
|
112
|
+
set imageIndex(value) {
|
|
113
|
+
this.imageIndex$.next(value);
|
|
114
|
+
}
|
|
115
|
+
ngAfterViewInit() {
|
|
116
|
+
this.isViewInited$.next(true);
|
|
117
|
+
}
|
|
118
|
+
ngOnDestroy() {
|
|
119
|
+
this.destroyed$.next(true);
|
|
120
|
+
}
|
|
121
|
+
animateToIndexByDx(dx) {
|
|
122
|
+
combineLatest([this.imageIndex$, this.actualSwipes$]).pipe(take(1))
|
|
123
|
+
.subscribe(([imageIndex, actualSwipes]) => {
|
|
124
|
+
const direction = dx > 0 ? 'left' : 'right';
|
|
125
|
+
let newIndex;
|
|
126
|
+
if (Math.abs(dx) < this.minimumOffset) {
|
|
127
|
+
newIndex = imageIndex;
|
|
128
|
+
}
|
|
129
|
+
else {
|
|
130
|
+
newIndex = imageIndex + (direction === 'right' ? 1 : -1);
|
|
131
|
+
}
|
|
132
|
+
this.animateToIndex(imageIndex, newIndex, dx, actualSwipes?.length ?? 1);
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
animateToIndex(oldIndex, newIndex, dx, totalSlides) {
|
|
136
|
+
this.pendingAnimation = this.animationBuilder.build([
|
|
137
|
+
style({ 'margin-left': (-(oldIndex + 1) * this.containerElement.nativeElement.clientWidth + dx) + 'px', 'margin-right': ((oldIndex + 1) * this.containerElement.nativeElement.clientWidth - dx) + 'px' }),
|
|
138
|
+
animate('500ms ease', style({ 'margin-left': (-(newIndex + 1) * this.containerElement.nativeElement.clientWidth) + 'px', 'margin-right': ((newIndex + 1) * this.containerElement.nativeElement.clientWidth) + 'px' })),
|
|
139
|
+
]).create(this.containerElement.nativeElement);
|
|
140
|
+
this.pendingAnimation.onDone(() => {
|
|
141
|
+
// Correct the image index
|
|
142
|
+
if (newIndex === -1) {
|
|
143
|
+
this.imageIndex$.next(totalSlides - 1);
|
|
144
|
+
}
|
|
145
|
+
else if (newIndex === totalSlides) {
|
|
146
|
+
this.imageIndex$.next(0);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
this.imageIndex$.next(newIndex);
|
|
150
|
+
}
|
|
151
|
+
this.startTouch$.next(null);
|
|
152
|
+
this.lastTouch$.next(null);
|
|
153
|
+
this.pendingAnimation?.destroy();
|
|
154
|
+
this.pendingAnimation = undefined;
|
|
155
|
+
});
|
|
156
|
+
this.pendingAnimation.play();
|
|
157
|
+
}
|
|
158
|
+
onSwipe(dx) {
|
|
159
|
+
this.animateToIndexByDx(dx);
|
|
160
|
+
}
|
|
161
|
+
previous() {
|
|
162
|
+
this.pendingAnimation?.finish();
|
|
163
|
+
combineLatest([this.actualSwipes$, this.imageIndex$]).pipe(take(1)).subscribe(([actualSwipes, imageIndex]) => {
|
|
164
|
+
setTimeout(() => this.animateToIndex(imageIndex, imageIndex - 1, 0, actualSwipes?.length ?? 1), 20);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
next() {
|
|
168
|
+
this.pendingAnimation?.finish();
|
|
169
|
+
combineLatest([this.actualSwipes$, this.imageIndex$]).pipe(take(1)).subscribe(([actualSwipes, imageIndex]) => {
|
|
170
|
+
setTimeout(() => this.animateToIndex(imageIndex, imageIndex + 1, 0, actualSwipes?.length ?? 1), 20);
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
goto(index) {
|
|
174
|
+
combineLatest([this.actualSwipes$, this.imageIndex$]).pipe(take(1)).subscribe(([actualSwipes, imageIndex]) => {
|
|
175
|
+
this.pendingAnimation?.finish();
|
|
176
|
+
setTimeout(() => this.animateToIndex(imageIndex, index, 0, actualSwipes?.length ?? 1), 20);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
BsSwipeContainerDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: BsSwipeContainerDirective, deps: [{ token: i0.ElementRef }, { token: i1.AnimationBuilder }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive });
|
|
181
|
+
BsSwipeContainerDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.3", type: BsSwipeContainerDirective, selector: "[bsSwipeContainer]", inputs: { minimumOffset: "minimumOffset", imageIndex: "imageIndex" }, outputs: { imageIndexChange: "imageIndexChange" }, host: { properties: { "style.margin-left.%": "this.offsetLeft", "style.margin-right.%": "this.offsetRight", "style.margin-top.%": "this.offsetTop", "style.margin-bottom.%": "this.offsetBottom" } }, queries: [{ propertyName: "swipes", predicate: i0.forwardRef(function () { return BsSwipeDirective; }) }], exportAs: ["bsSwipeContainer"], ngImport: i0 });
|
|
182
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: BsSwipeContainerDirective, decorators: [{
|
|
183
|
+
type: Directive,
|
|
184
|
+
args: [{
|
|
185
|
+
selector: '[bsSwipeContainer]',
|
|
186
|
+
exportAs: 'bsSwipeContainer'
|
|
187
|
+
}]
|
|
188
|
+
}], ctorParameters: function () { return [{ type: i0.ElementRef }, { type: i1.AnimationBuilder }, { type: undefined, decorators: [{
|
|
189
|
+
type: Inject,
|
|
190
|
+
args: [DOCUMENT]
|
|
191
|
+
}] }]; }, propDecorators: { offsetLeft: [{
|
|
192
|
+
type: HostBinding,
|
|
193
|
+
args: ['style.margin-left.%']
|
|
194
|
+
}], offsetRight: [{
|
|
195
|
+
type: HostBinding,
|
|
196
|
+
args: ['style.margin-right.%']
|
|
197
|
+
}], offsetTop: [{
|
|
198
|
+
type: HostBinding,
|
|
199
|
+
args: ['style.margin-top.%']
|
|
200
|
+
}], offsetBottom: [{
|
|
201
|
+
type: HostBinding,
|
|
202
|
+
args: ['style.margin-bottom.%']
|
|
203
|
+
}], swipes: [{
|
|
204
|
+
type: ContentChildren,
|
|
205
|
+
args: [forwardRef(() => BsSwipeDirective)]
|
|
206
|
+
}], minimumOffset: [{
|
|
207
|
+
type: Input
|
|
208
|
+
}], imageIndex: [{
|
|
209
|
+
type: Input
|
|
210
|
+
}], imageIndexChange: [{
|
|
211
|
+
type: Output
|
|
212
|
+
}] } });
|
|
213
|
+
|
|
214
|
+
class BsSwipeDirective {
|
|
215
|
+
constructor(container, element) {
|
|
216
|
+
this.container = container;
|
|
217
|
+
this.slideHeight$ = new BehaviorSubject(0);
|
|
218
|
+
//#region Offside
|
|
219
|
+
this.offside = false;
|
|
220
|
+
//#endregion
|
|
221
|
+
this.alignTopClass = true;
|
|
222
|
+
this.element = element;
|
|
223
|
+
}
|
|
224
|
+
onTouchStart(ev) {
|
|
225
|
+
if (ev.touches.length === 1) {
|
|
226
|
+
ev.preventDefault();
|
|
227
|
+
this.container.pendingAnimation?.finish();
|
|
228
|
+
setTimeout(() => {
|
|
229
|
+
this.container.startTouch$.next({
|
|
230
|
+
position: {
|
|
231
|
+
x: ev.touches[0].clientX,
|
|
232
|
+
y: ev.touches[0].clientY,
|
|
233
|
+
},
|
|
234
|
+
timestamp: Date.now(),
|
|
235
|
+
});
|
|
236
|
+
this.container.lastTouch$.next({
|
|
237
|
+
position: {
|
|
238
|
+
x: ev.touches[0].clientX,
|
|
239
|
+
y: ev.touches[0].clientY,
|
|
240
|
+
},
|
|
241
|
+
isTouching: true,
|
|
242
|
+
});
|
|
243
|
+
}, 20);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
onTouchMove(ev) {
|
|
247
|
+
this.container.lastTouch$.next({
|
|
248
|
+
position: {
|
|
249
|
+
x: ev.touches[0].clientX,
|
|
250
|
+
y: ev.touches[0].clientY,
|
|
251
|
+
},
|
|
252
|
+
isTouching: true,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
onTouchEnd(ev) {
|
|
256
|
+
combineLatest([this.container.startTouch$, this.container.lastTouch$])
|
|
257
|
+
.pipe(filter(([startTouch, lastTouch]) => !!startTouch && !!lastTouch))
|
|
258
|
+
.pipe(take(1))
|
|
259
|
+
.subscribe(([startTouch, lastTouch]) => {
|
|
260
|
+
if (!!startTouch && !!lastTouch) {
|
|
261
|
+
const dx = lastTouch.position.x - startTouch.position.x;
|
|
262
|
+
this.container.onSwipe(dx);
|
|
263
|
+
}
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
ngAfterViewInit() {
|
|
267
|
+
this.observer = new ResizeObserver((entries) => {
|
|
268
|
+
this.slideHeight$.next(entries[0].contentRect.height);
|
|
269
|
+
});
|
|
270
|
+
this.observer.observe(this.element.nativeElement);
|
|
271
|
+
}
|
|
272
|
+
ngOnDestroy() {
|
|
273
|
+
if (this.observer) {
|
|
274
|
+
this.observer.unobserve(this.element.nativeElement);
|
|
275
|
+
this.observer.disconnect();
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
BsSwipeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: BsSwipeDirective, deps: [{ token: BsSwipeContainerDirective }, { token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
|
|
280
|
+
BsSwipeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.3", type: BsSwipeDirective, selector: "[bsSwipe]", inputs: { offside: "offside" }, host: { listeners: { "touchstart": "onTouchStart($event)", "touchmove": "onTouchMove($event)", "touchend": "onTouchEnd($event)" }, properties: { "class.align-top": "this.alignTopClass" } }, ngImport: i0 });
|
|
281
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: BsSwipeDirective, decorators: [{
|
|
282
|
+
type: Directive,
|
|
283
|
+
args: [{
|
|
284
|
+
selector: '[bsSwipe]'
|
|
285
|
+
}]
|
|
286
|
+
}], ctorParameters: function () { return [{ type: BsSwipeContainerDirective }, { type: i0.ElementRef }]; }, propDecorators: { offside: [{
|
|
287
|
+
type: Input
|
|
288
|
+
}], alignTopClass: [{
|
|
289
|
+
type: HostBinding,
|
|
290
|
+
args: ['class.align-top']
|
|
291
|
+
}], onTouchStart: [{
|
|
292
|
+
type: HostListener,
|
|
293
|
+
args: ['touchstart', ['$event']]
|
|
294
|
+
}], onTouchMove: [{
|
|
295
|
+
type: HostListener,
|
|
296
|
+
args: ['touchmove', ['$event']]
|
|
297
|
+
}], onTouchEnd: [{
|
|
298
|
+
type: HostListener,
|
|
299
|
+
args: ['touchend', ['$event']]
|
|
300
|
+
}] } });
|
|
301
|
+
|
|
302
|
+
class BsSwiperModule {
|
|
303
|
+
}
|
|
304
|
+
BsSwiperModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: BsSwiperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
305
|
+
BsSwiperModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "15.2.3", ngImport: i0, type: BsSwiperModule, declarations: [BsSwipeDirective, BsSwipeContainerDirective], imports: [CommonModule, ObserversModule], exports: [BsSwipeDirective, BsSwipeContainerDirective] });
|
|
306
|
+
BsSwiperModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: BsSwiperModule, imports: [CommonModule, ObserversModule] });
|
|
307
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.3", ngImport: i0, type: BsSwiperModule, decorators: [{
|
|
308
|
+
type: NgModule,
|
|
309
|
+
args: [{
|
|
310
|
+
imports: [CommonModule, ObserversModule],
|
|
311
|
+
declarations: [BsSwipeDirective, BsSwipeContainerDirective],
|
|
312
|
+
exports: [BsSwipeDirective, BsSwipeContainerDirective],
|
|
313
|
+
}]
|
|
314
|
+
}] });
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Generated bundle index. Do not edit.
|
|
318
|
+
*/
|
|
319
|
+
|
|
320
|
+
export { BsSwipeContainerDirective, BsSwipeDirective, BsSwiperModule };
|
|
321
|
+
//# sourceMappingURL=mintplayer-ng-swiper.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mintplayer-ng-swiper.mjs","sources":["../../../../libs/mintplayer-ng-swiper/src/lib/directives/swipe-container/swipe-container.directive.ts","../../../../libs/mintplayer-ng-swiper/src/lib/directives/swipe/swipe.directive.ts","../../../../libs/mintplayer-ng-swiper/src/lib/swiper.module.ts","../../../../libs/mintplayer-ng-swiper/src/mintplayer-ng-swiper.ts"],"sourcesContent":["import { animate, AnimationBuilder, AnimationPlayer, style } from '@angular/animations';\nimport { DOCUMENT } from '@angular/common';\nimport { AfterViewInit, ContentChildren, Directive, ElementRef, EventEmitter, forwardRef, HostBinding, Inject, Input, OnDestroy, Output, QueryList } from '@angular/core';\nimport { BehaviorSubject, combineLatest, filter, map, mergeMap, Observable, Subject, take, takeUntil, takeWhile } from 'rxjs';\nimport { LastTouch } from '../../interfaces/last-touch';\nimport { StartTouch } from '../../interfaces/start-touch';\nimport { BsSwipeDirective } from '../swipe/swipe.directive';\n\n@Directive({\n selector: '[bsSwipeContainer]',\n exportAs: 'bsSwipeContainer'\n})\nexport class BsSwipeContainerDirective implements AfterViewInit, OnDestroy {\n\n constructor(element: ElementRef, private animationBuilder: AnimationBuilder, @Inject(DOCUMENT) document: any) {\n this.containerElement = element;\n this.document = <Document>document;\n this.offset$ = combineLatest([this.startTouch$, this.lastTouch$, this.imageIndex$, this.isViewInited$])\n .pipe(map(([startTouch, lastTouch, imageIndex, isViewInited]) => {\n if (!isViewInited) {\n return (-imageIndex * 100);\n } else if (!!startTouch && !!lastTouch) {\n return (-imageIndex * 100 + (lastTouch.position.x - startTouch.position.x) / this.containerElement.nativeElement.clientWidth * 100);\n } else {\n return (-imageIndex * 100);\n }\n }));\n\n this.padLeft$ = this.swipes$.pipe(map(swipes => {\n if (!swipes) {\n return 0;\n }\n\n let count = 0;\n for (const s of swipes) {\n if (!s.offside) {\n break;\n } else {\n count++;\n }\n }\n return count;\n }));\n\n this.padRight$ = this.swipes$.pipe(map(swipes => {\n if (!swipes) {\n return 0;\n }\n\n let count = 0;\n for (const s of swipes.toArray().reverse()) {\n if (!s.offside) {\n break;\n } else {\n count++;\n }\n }\n return count;\n }));\n\n this.offsetLeft$ = combineLatest([this.offset$, this.padLeft$])\n .pipe(map(([offset, padLeft]) => {\n return offset - padLeft * 100;\n }));\n this.offsetRight$ = combineLatest([this.offset$, this.padLeft$, this.padRight$])\n .pipe(map(([offset, padLeft, padRight]) => {\n return -(offset - padLeft * 100) - (padRight - 1) * 100;\n }));\n this.offsetLeft$\n .pipe(takeUntil(this.destroyed$))\n .subscribe((offsetLeft) => this.offsetLeft = offsetLeft);\n this.offsetRight$\n .pipe(takeUntil(this.destroyed$))\n .subscribe((offsetRight) => this.offsetRight = offsetRight);\n this.imageIndex$\n .pipe(takeUntil(this.destroyed$))\n .subscribe((imageIndex) => this.imageIndexChange.emit(imageIndex));\n\n this.actualSwipes$ = this.swipes$\n .pipe(map(swipes => {\n if (swipes) {\n return swipes.filter(swipe => !swipe.offside);\n } else {\n return [];\n }\n }));\n\n this.slideHeights$ = this.actualSwipes$\n .pipe(filter(swipes => !!swipes))\n // .pipe(map(swipes => <QueryList<BsSwipeDirective>>swipes))\n .pipe(mergeMap(swipes => combineLatest(swipes.map(swipe => swipe.slideHeight$))));\n\n this.currentSlideHeight$ = combineLatest([this.slideHeights$, this.imageIndex$])\n .pipe(map(([slideHeights, imageIndex]) => {\n const maxHeight = Math.max(...slideHeights);\n const currHeight: number = slideHeights[imageIndex] ?? maxHeight;\n return maxHeight - (maxHeight - currHeight)/* / 2*/;\n }));\n }\n\n @HostBinding('style.margin-left.%') offsetLeft: number | null = null;\n @HostBinding('style.margin-right.%') offsetRight: number | null = null;\n @HostBinding('style.margin-top.%') offsetTop: number | null = null;\n @HostBinding('style.margin-bottom.%') offsetBottom: number | null = null;\n @ContentChildren(forwardRef(() => BsSwipeDirective)) set swipes(value: QueryList<BsSwipeDirective>) {\n setTimeout(() => this.swipes$.next(value));\n }\n @Input() minimumOffset = 50;\n\n //#region ImageIndex\n public get imageIndex() {\n return this.imageIndex$.value;\n }\n @Input() public set imageIndex(value: number) {\n this.imageIndex$.next(value);\n }\n @Output() imageIndexChange = new EventEmitter<number>();\n //#endregion\n \n actualSwipes$: Observable<BsSwipeDirective[]>;\n isViewInited$ = new BehaviorSubject<boolean>(false);\n destroyed$ = new Subject();\n startTouch$ = new BehaviorSubject<StartTouch | null>(null);\n lastTouch$ = new BehaviorSubject<LastTouch | null>(null);\n swipes$ = new BehaviorSubject<QueryList<BsSwipeDirective> | null>(null);\n imageIndex$ = new BehaviorSubject<number>(0);\n slideHeights$: Observable<number[]>;\n currentSlideHeight$: Observable<number>;\n pendingAnimation?: AnimationPlayer;\n containerElement: ElementRef<HTMLDivElement>;\n document: Document;\n\n offset$: Observable<number>;\n offsetLeft$: Observable<number>;\n offsetRight$: Observable<number>;\n padLeft$: Observable<number>;\n padRight$: Observable<number>;\n\n ngAfterViewInit() {\n this.isViewInited$.next(true);\n }\n\n ngOnDestroy() {\n this.destroyed$.next(true);\n }\n\n animateToIndexByDx(dx: number) {\n combineLatest([this.imageIndex$, this.actualSwipes$]).pipe(take(1))\n .subscribe(([imageIndex, actualSwipes]) => {\n const direction = dx > 0 ? 'left' : 'right';\n \n let newIndex: number;\n if (Math.abs(dx) < this.minimumOffset) {\n newIndex = imageIndex;\n } else {\n newIndex = imageIndex + (direction === 'right' ? 1 : -1);\n }\n \n this.animateToIndex(imageIndex, newIndex, dx, actualSwipes?.length ?? 1);\n });\n }\n\n animateToIndex(oldIndex: number, newIndex: number, dx: number, totalSlides: number) {\n this.pendingAnimation = this.animationBuilder.build([\n style({ 'margin-left': (-(oldIndex + 1) * this.containerElement.nativeElement.clientWidth + dx) + 'px', 'margin-right': ((oldIndex + 1) * this.containerElement.nativeElement.clientWidth - dx) + 'px' }),\n animate('500ms ease', style({ 'margin-left': (-(newIndex + 1) * this.containerElement.nativeElement.clientWidth) + 'px', 'margin-right': ((newIndex + 1) * this.containerElement.nativeElement.clientWidth) + 'px' })),\n ]).create(this.containerElement.nativeElement);\n this.pendingAnimation.onDone(() => {\n // Correct the image index\n if (newIndex === -1) {\n this.imageIndex$.next(totalSlides - 1);\n } else if (newIndex === totalSlides) {\n this.imageIndex$.next(0);\n } else {\n this.imageIndex$.next(newIndex);\n }\n this.startTouch$.next(null);\n this.lastTouch$.next(null);\n this.pendingAnimation?.destroy();\n this.pendingAnimation = undefined;\n });\n this.pendingAnimation.play();\n }\n\n onSwipe(dx: number) {\n this.animateToIndexByDx(dx);\n }\n\n previous() {\n this.pendingAnimation?.finish();\n combineLatest([this.actualSwipes$, this.imageIndex$]).pipe(take(1)).subscribe(([actualSwipes, imageIndex]) => {\n setTimeout(() => this.animateToIndex(imageIndex, imageIndex - 1, 0, actualSwipes?.length ?? 1), 20);\n });\n }\n\n next() {\n this.pendingAnimation?.finish();\n combineLatest([this.actualSwipes$, this.imageIndex$]).pipe(take(1)).subscribe(([actualSwipes, imageIndex]) => {\n setTimeout(() => this.animateToIndex(imageIndex, imageIndex + 1, 0, actualSwipes?.length ?? 1), 20);\n });\n }\n\n goto(index: number) {\n combineLatest([this.actualSwipes$, this.imageIndex$]).pipe(take(1)).subscribe(([actualSwipes, imageIndex]) => {\n this.pendingAnimation?.finish();\n setTimeout(() => this.animateToIndex(imageIndex, index, 0, actualSwipes?.length ?? 1), 20);\n });\n }\n\n}\n","import { AfterViewInit, Directive, ElementRef, HostBinding, HostListener, Input, OnDestroy } from \"@angular/core\";\nimport { BehaviorSubject, combineLatest, filter, take } from \"rxjs\";\nimport { BsSwipeContainerDirective } from \"../swipe-container/swipe-container.directive\";\n\n@Directive({\n selector: '[bsSwipe]'\n})\nexport class BsSwipeDirective implements AfterViewInit, OnDestroy {\n\n constructor(private container: BsSwipeContainerDirective, element: ElementRef<HTMLElement>) {\n this.element = element;\n }\n\n element: ElementRef<HTMLElement>;\n observer?: ResizeObserver;\n public slideHeight$ = new BehaviorSubject<number>(0);\n\n //#region Offside\n @Input() public offside = false;\n //#endregion\n\n @HostBinding('class.align-top') alignTopClass = true;\n @HostListener('touchstart', ['$event'])\n onTouchStart(ev: TouchEvent) {\n if (ev.touches.length === 1) {\n ev.preventDefault();\n this.container.pendingAnimation?.finish();\n\n setTimeout(() => {\n this.container.startTouch$.next({\n position: {\n x: ev.touches[0].clientX,\n y: ev.touches[0].clientY,\n },\n timestamp: Date.now(),\n });\n this.container.lastTouch$.next({\n position: {\n x: ev.touches[0].clientX,\n y: ev.touches[0].clientY,\n },\n isTouching: true,\n });\n }, 20);\n }\n }\n\n @HostListener('touchmove', ['$event'])\n onTouchMove(ev: TouchEvent) {\n this.container.lastTouch$.next({\n position: {\n x: ev.touches[0].clientX,\n y: ev.touches[0].clientY,\n },\n isTouching: true,\n });\n }\n\n @HostListener('touchend', ['$event'])\n onTouchEnd(ev: TouchEvent) {\n combineLatest([this.container.startTouch$, this.container.lastTouch$])\n .pipe(filter(([startTouch, lastTouch]) => !!startTouch && !!lastTouch))\n .pipe(take(1))\n .subscribe(([startTouch, lastTouch]) => {\n if (!!startTouch && !!lastTouch) {\n const dx = lastTouch.position.x - startTouch.position.x;\n this.container.onSwipe(dx);\n }\n });\n }\n\n ngAfterViewInit() {\n this.observer = new ResizeObserver((entries) => {\n this.slideHeight$.next(entries[0].contentRect.height);\n });\n this.observer.observe(this.element.nativeElement);\n }\n\n ngOnDestroy() {\n if (this.observer) {\n this.observer.unobserve(this.element.nativeElement);\n this.observer.disconnect();\n }\n }\n\n}\n","import { NgModule } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { ObserversModule } from '@angular/cdk/observers';\nimport { BsSwipeDirective } from './directives/swipe/swipe.directive';\nimport { BsSwipeContainerDirective } from './directives/swipe-container/swipe-container.directive';\n\n@NgModule({\n imports: [CommonModule, ObserversModule],\n declarations: [BsSwipeDirective, BsSwipeContainerDirective],\n exports: [BsSwipeDirective, BsSwipeContainerDirective],\n})\nexport class BsSwiperModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1.BsSwipeContainerDirective"],"mappings":";;;;;;;;MAYa,yBAAyB,CAAA;AAEpC,IAAA,WAAA,CAAY,OAAmB,EAAU,gBAAkC,EAAoB,QAAa,EAAA;QAAnE,IAAgB,CAAA,gBAAA,GAAhB,gBAAgB,CAAkB;QAsFvC,IAAU,CAAA,UAAA,GAAkB,IAAI,CAAC;QAChC,IAAW,CAAA,WAAA,GAAkB,IAAI,CAAC;QACpC,IAAS,CAAA,SAAA,GAAkB,IAAI,CAAC;QAC7B,IAAY,CAAA,YAAA,GAAkB,IAAI,CAAC;QAIhE,IAAa,CAAA,aAAA,GAAG,EAAE,CAAC;AASlB,QAAA,IAAA,CAAA,gBAAgB,GAAG,IAAI,YAAY,EAAU,CAAC;AAIxD,QAAA,IAAA,CAAA,aAAa,GAAG,IAAI,eAAe,CAAU,KAAK,CAAC,CAAC;AACpD,QAAA,IAAA,CAAA,UAAU,GAAG,IAAI,OAAO,EAAE,CAAC;AAC3B,QAAA,IAAA,CAAA,WAAW,GAAG,IAAI,eAAe,CAAoB,IAAI,CAAC,CAAC;AAC3D,QAAA,IAAA,CAAA,UAAU,GAAG,IAAI,eAAe,CAAmB,IAAI,CAA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A,OAAA,EAAA,CAJf,YAAY,EAAE,eAAe,CAAA,EAAA,CAAA,CAAA;2FAI5B,cAAc,EAAA,UAAA,EAAA,CAAA;kBAL1B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACR,oBAAA,OAAO,EAAE,CAAC,YAAY,EAAE,eAAe,CAAC;AACxC,oBAAA,YAAY,EAAE,CAAC,gBAAgB,EAAE,yBAAyB,CAAC;AAC3D,oBAAA,OAAO,EAAE,CAAC,gBAAgB,EAAE,yBAAyB,CAAC;AACvD,iBAAA,CAAA;;;ACVD;;AAEG;;;;"}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { AfterViewInit, ElementRef, OnDestroy } from "@angular/core";
|
|
2
|
+
import { BehaviorSubject } from "rxjs";
|
|
3
|
+
import { BsSwipeContainerDirective } from "../swipe-container/swipe-container.directive";
|
|
4
|
+
import * as i0 from "@angular/core";
|
|
5
|
+
export declare class BsSwipeDirective implements AfterViewInit, OnDestroy {
|
|
6
|
+
private container;
|
|
7
|
+
constructor(container: BsSwipeContainerDirective, element: ElementRef<HTMLElement>);
|
|
8
|
+
element: ElementRef<HTMLElement>;
|
|
9
|
+
observer?: ResizeObserver;
|
|
10
|
+
slideHeight$: BehaviorSubject<number>;
|
|
11
|
+
offside: boolean;
|
|
12
|
+
alignTopClass: boolean;
|
|
13
|
+
onTouchStart(ev: TouchEvent): void;
|
|
14
|
+
onTouchMove(ev: TouchEvent): void;
|
|
15
|
+
onTouchEnd(ev: TouchEvent): void;
|
|
16
|
+
ngAfterViewInit(): void;
|
|
17
|
+
ngOnDestroy(): void;
|
|
18
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BsSwipeDirective, never>;
|
|
19
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BsSwipeDirective, "[bsSwipe]", never, { "offside": "offside"; }, {}, never, never, false, never>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AnimationBuilder, AnimationPlayer } from '@angular/animations';
|
|
2
|
+
import { AfterViewInit, ElementRef, EventEmitter, OnDestroy, QueryList } from '@angular/core';
|
|
3
|
+
import { BehaviorSubject, Observable, Subject } from 'rxjs';
|
|
4
|
+
import { LastTouch } from '../../interfaces/last-touch';
|
|
5
|
+
import { StartTouch } from '../../interfaces/start-touch';
|
|
6
|
+
import { BsSwipeDirective } from '../swipe/swipe.directive';
|
|
7
|
+
import * as i0 from "@angular/core";
|
|
8
|
+
export declare class BsSwipeContainerDirective implements AfterViewInit, OnDestroy {
|
|
9
|
+
private animationBuilder;
|
|
10
|
+
constructor(element: ElementRef, animationBuilder: AnimationBuilder, document: any);
|
|
11
|
+
offsetLeft: number | null;
|
|
12
|
+
offsetRight: number | null;
|
|
13
|
+
offsetTop: number | null;
|
|
14
|
+
offsetBottom: number | null;
|
|
15
|
+
set swipes(value: QueryList<BsSwipeDirective>);
|
|
16
|
+
minimumOffset: number;
|
|
17
|
+
get imageIndex(): number;
|
|
18
|
+
set imageIndex(value: number);
|
|
19
|
+
imageIndexChange: EventEmitter<number>;
|
|
20
|
+
actualSwipes$: Observable<BsSwipeDirective[]>;
|
|
21
|
+
isViewInited$: BehaviorSubject<boolean>;
|
|
22
|
+
destroyed$: Subject<unknown>;
|
|
23
|
+
startTouch$: BehaviorSubject<StartTouch | null>;
|
|
24
|
+
lastTouch$: BehaviorSubject<LastTouch | null>;
|
|
25
|
+
swipes$: BehaviorSubject<QueryList<BsSwipeDirective> | null>;
|
|
26
|
+
imageIndex$: BehaviorSubject<number>;
|
|
27
|
+
slideHeights$: Observable<number[]>;
|
|
28
|
+
currentSlideHeight$: Observable<number>;
|
|
29
|
+
pendingAnimation?: AnimationPlayer;
|
|
30
|
+
containerElement: ElementRef<HTMLDivElement>;
|
|
31
|
+
document: Document;
|
|
32
|
+
offset$: Observable<number>;
|
|
33
|
+
offsetLeft$: Observable<number>;
|
|
34
|
+
offsetRight$: Observable<number>;
|
|
35
|
+
padLeft$: Observable<number>;
|
|
36
|
+
padRight$: Observable<number>;
|
|
37
|
+
ngAfterViewInit(): void;
|
|
38
|
+
ngOnDestroy(): void;
|
|
39
|
+
animateToIndexByDx(dx: number): void;
|
|
40
|
+
animateToIndex(oldIndex: number, newIndex: number, dx: number, totalSlides: number): void;
|
|
41
|
+
onSwipe(dx: number): void;
|
|
42
|
+
previous(): void;
|
|
43
|
+
next(): void;
|
|
44
|
+
goto(index: number): void;
|
|
45
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BsSwipeContainerDirective, never>;
|
|
46
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<BsSwipeContainerDirective, "[bsSwipeContainer]", ["bsSwipeContainer"], { "minimumOffset": "minimumOffset"; "imageIndex": "imageIndex"; }, { "imageIndexChange": "imageIndexChange"; }, ["swipes"], never, false, never>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as i0 from "@angular/core";
|
|
2
|
+
import * as i1 from "./directives/swipe/swipe.directive";
|
|
3
|
+
import * as i2 from "./directives/swipe-container/swipe-container.directive";
|
|
4
|
+
import * as i3 from "@angular/common";
|
|
5
|
+
import * as i4 from "@angular/cdk/observers";
|
|
6
|
+
export declare class BsSwiperModule {
|
|
7
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<BsSwiperModule, never>;
|
|
8
|
+
static ɵmod: i0.ɵɵNgModuleDeclaration<BsSwiperModule, [typeof i1.BsSwipeDirective, typeof i2.BsSwipeContainerDirective], [typeof i3.CommonModule, typeof i4.ObserversModule], [typeof i1.BsSwipeDirective, typeof i2.BsSwipeContainerDirective]>;
|
|
9
|
+
static ɵinj: i0.ɵɵInjectorDeclaration<BsSwiperModule>;
|
|
10
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mintplayer/ng-swiper",
|
|
3
|
+
"version": "15.1.0",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@angular/common": "^15.0.0",
|
|
6
|
+
"@angular/core": "^15.0.0",
|
|
7
|
+
"@angular/animations": "^15.0.0",
|
|
8
|
+
"rxjs": "^7.8.0",
|
|
9
|
+
"@angular/platform-browser": "15.2.3",
|
|
10
|
+
"@angular/cdk": "15.2.3"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"tslib": "^2.3.0"
|
|
14
|
+
},
|
|
15
|
+
"module": "fesm2015/mintplayer-ng-swiper.mjs",
|
|
16
|
+
"es2020": "fesm2020/mintplayer-ng-swiper.mjs",
|
|
17
|
+
"esm2020": "esm2020/mintplayer-ng-swiper.mjs",
|
|
18
|
+
"fesm2020": "fesm2020/mintplayer-ng-swiper.mjs",
|
|
19
|
+
"fesm2015": "fesm2015/mintplayer-ng-swiper.mjs",
|
|
20
|
+
"typings": "index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
"./package.json": {
|
|
23
|
+
"default": "./package.json"
|
|
24
|
+
},
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./index.d.ts",
|
|
27
|
+
"esm2020": "./esm2020/mintplayer-ng-swiper.mjs",
|
|
28
|
+
"es2020": "./fesm2020/mintplayer-ng-swiper.mjs",
|
|
29
|
+
"es2015": "./fesm2015/mintplayer-ng-swiper.mjs",
|
|
30
|
+
"node": "./fesm2015/mintplayer-ng-swiper.mjs",
|
|
31
|
+
"default": "./fesm2020/mintplayer-ng-swiper.mjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"sideEffects": false
|
|
35
|
+
}
|