@mintplayer/ng-swiper 17.0.0 → 18.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.
Files changed (44) hide show
  1. package/esm2022/index.mjs +2 -4
  2. package/esm2022/observe-size/index.mjs +3 -0
  3. package/esm2022/observe-size/mintplayer-ng-swiper-observe-size.mjs +5 -0
  4. package/esm2022/observe-size/src/observe-size.directive.mjs +51 -0
  5. package/esm2022/observe-size/src/size.mjs +2 -0
  6. package/esm2022/swiper/index.mjs +4 -0
  7. package/esm2022/swiper/mintplayer-ng-swiper-swiper.mjs +5 -0
  8. package/esm2022/swiper/src/directives/index.mjs +3 -0
  9. package/esm2022/swiper/src/directives/swipe/swipe.directive.mjs +106 -0
  10. package/esm2022/swiper/src/directives/swipe-container/swipe-container.directive.mjs +229 -0
  11. package/esm2022/swiper/src/interfaces/index.mjs +4 -0
  12. package/esm2022/swiper/src/interfaces/last-touch.mjs +2 -0
  13. package/esm2022/swiper/src/interfaces/point.mjs +2 -0
  14. package/esm2022/swiper/src/interfaces/start-touch.mjs +2 -0
  15. package/esm2022/swiper/src/swiper.module.mjs +19 -0
  16. package/fesm2022/mintplayer-ng-swiper-observe-size.mjs +58 -0
  17. package/fesm2022/mintplayer-ng-swiper-observe-size.mjs.map +1 -0
  18. package/fesm2022/mintplayer-ng-swiper-swiper.mjs +348 -0
  19. package/fesm2022/mintplayer-ng-swiper-swiper.mjs.map +1 -0
  20. package/fesm2022/mintplayer-ng-swiper.mjs +2 -343
  21. package/fesm2022/mintplayer-ng-swiper.mjs.map +1 -1
  22. package/index.d.ts +1 -3
  23. package/observe-size/index.d.ts +2 -0
  24. package/observe-size/src/observe-size.directive.d.ts +18 -0
  25. package/observe-size/src/size.d.ts +4 -0
  26. package/package.json +17 -5
  27. package/swiper/index.d.ts +3 -0
  28. package/swiper/src/directives/swipe/swipe.directive.d.ts +17 -0
  29. package/{lib → swiper/src}/directives/swipe-container/swipe-container.directive.d.ts +6 -3
  30. package/esm2022/lib/directives/index.mjs +0 -3
  31. package/esm2022/lib/directives/swipe/swipe.directive.mjs +0 -119
  32. package/esm2022/lib/directives/swipe-container/swipe-container.directive.mjs +0 -216
  33. package/esm2022/lib/interfaces/index.mjs +0 -4
  34. package/esm2022/lib/interfaces/last-touch.mjs +0 -2
  35. package/esm2022/lib/interfaces/point.mjs +0 -2
  36. package/esm2022/lib/interfaces/start-touch.mjs +0 -2
  37. package/esm2022/lib/swiper.module.mjs +0 -19
  38. package/lib/directives/swipe/swipe.directive.d.ts +0 -21
  39. /package/{lib → swiper/src}/directives/index.d.ts +0 -0
  40. /package/{lib → swiper/src}/interfaces/index.d.ts +0 -0
  41. /package/{lib → swiper/src}/interfaces/last-touch.d.ts +0 -0
  42. /package/{lib → swiper/src}/interfaces/point.d.ts +0 -0
  43. /package/{lib → swiper/src}/interfaces/start-touch.d.ts +0 -0
  44. /package/{lib → swiper/src}/swiper.module.d.ts +0 -0
@@ -1,349 +1,8 @@
1
- import * as i0 from '@angular/core';
2
- import { EventEmitter, Directive, Inject, HostBinding, ContentChildren, forwardRef, Input, Output, PLATFORM_ID, HostListener, NgModule } from '@angular/core';
3
- import { DOCUMENT, isPlatformServer, CommonModule } from '@angular/common';
4
- import { map, combineLatest, mergeMap, delay, filter, BehaviorSubject, take } from 'rxjs';
5
- import * as i1 from '@angular/animations';
6
- import { style, animate } from '@angular/animations';
7
- import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
8
-
9
- class BsSwipeContainerDirective {
10
- animationBuilder;
11
- constructor(element, animationBuilder, document) {
12
- this.animationBuilder = animationBuilder;
13
- this.containerElement = element;
14
- this.document = document;
15
- this.offset$ = combineLatest([this.startTouch$, this.lastTouch$, this.imageIndex$, this.isViewInited$])
16
- .pipe(map(([startTouch, lastTouch, imageIndex, isViewInited]) => {
17
- if (!isViewInited) {
18
- return (-imageIndex * 100);
19
- }
20
- else if (!!startTouch && !!lastTouch) {
21
- return (-imageIndex * 100 + (lastTouch.position.x - startTouch.position.x) / this.containerElement.nativeElement.clientWidth * 100);
22
- }
23
- else {
24
- return (-imageIndex * 100);
25
- }
26
- }));
27
- this.padLeft$ = this.swipes$.pipe(map(swipes => {
28
- if (!swipes) {
29
- return 0;
30
- }
31
- let count = 0;
32
- for (const s of swipes) {
33
- if (!s.offside) {
34
- break;
35
- }
36
- else {
37
- count++;
38
- }
39
- }
40
- return count;
41
- }));
42
- this.padRight$ = this.swipes$.pipe(map(swipes => {
43
- if (!swipes) {
44
- return 0;
45
- }
46
- let count = 0;
47
- for (const s of swipes.toArray().reverse()) {
48
- if (!s.offside) {
49
- break;
50
- }
51
- else {
52
- count++;
53
- }
54
- }
55
- return count;
56
- }));
57
- this.offsetLeft$ = combineLatest([this.offset$, this.padLeft$])
58
- .pipe(map(([offset, padLeft]) => offset - padLeft * 100));
59
- this.offsetRight$ = combineLatest([this.offset$, this.padLeft$, this.padRight$])
60
- .pipe(map(([offset, padLeft, padRight]) => -(offset - padLeft * 100) - (padRight - 1) * 100));
61
- this.offsetLeft$.pipe(takeUntilDestroyed())
62
- .subscribe(offsetLeft => this.offsetLeft = offsetLeft);
63
- this.offsetRight$.pipe(takeUntilDestroyed())
64
- .subscribe(offsetRight => this.offsetRight = offsetRight);
65
- this.imageIndex$.pipe(takeUntilDestroyed())
66
- .subscribe(imageIndex => this.imageIndexChange.emit(imageIndex));
67
- this.actualSwipes$ = this.swipes$
68
- .pipe(map(swipes => {
69
- if (swipes) {
70
- return swipes.filter(swipe => !swipe.offside);
71
- }
72
- else {
73
- return [];
74
- }
75
- }));
76
- this.slideHeights$ = this.actualSwipes$
77
- .pipe(delay(400), filter(swipes => !!swipes))
78
- // .pipe(map(swipes => <QueryList<BsSwipeDirective>>swipes))
79
- .pipe(mergeMap(swipes => combineLatest(swipes.map(swipe => swipe.slideHeight$))));
80
- this.currentSlideHeight$ = combineLatest([this.slideHeights$, this.imageIndex$])
81
- .pipe(map(([slideHeights, imageIndex]) => {
82
- const maxHeight = Math.max(...slideHeights);
83
- const currHeight = slideHeights[imageIndex] ?? maxHeight;
84
- return maxHeight - (maxHeight - currHeight) /* / 2*/;
85
- }));
86
- }
87
- offsetLeft = null;
88
- offsetRight = null;
89
- offsetTop = null;
90
- offsetBottom = null;
91
- set swipes(value) {
92
- setTimeout(() => this.swipes$.next(value));
93
- }
94
- minimumOffset = 50;
95
- //#region ImageIndex
96
- get imageIndex() {
97
- return this.imageIndex$.value;
98
- }
99
- set imageIndex(value) {
100
- this.imageIndex$.next(value);
101
- }
102
- imageIndexChange = new EventEmitter();
103
- //#endregion
104
- actualSwipes$;
105
- isViewInited$ = new BehaviorSubject(false);
106
- startTouch$ = new BehaviorSubject(null);
107
- lastTouch$ = new BehaviorSubject(null);
108
- swipes$ = new BehaviorSubject(null);
109
- imageIndex$ = new BehaviorSubject(0);
110
- slideHeights$;
111
- currentSlideHeight$;
112
- pendingAnimation;
113
- containerElement;
114
- document;
115
- offset$;
116
- offsetLeft$;
117
- offsetRight$;
118
- padLeft$;
119
- padRight$;
120
- ngAfterViewInit() {
121
- this.isViewInited$.next(true);
122
- }
123
- animateToIndexByDx(dx) {
124
- combineLatest([this.imageIndex$, this.actualSwipes$]).pipe(take(1))
125
- .subscribe(([imageIndex, actualSwipes]) => {
126
- const direction = dx > 0 ? 'left' : 'right';
127
- let newIndex;
128
- if (Math.abs(dx) < this.minimumOffset) {
129
- newIndex = imageIndex;
130
- }
131
- else {
132
- newIndex = imageIndex + (direction === 'right' ? 1 : -1);
133
- }
134
- this.animateToIndex(imageIndex, newIndex, dx, actualSwipes?.length ?? 1);
135
- });
136
- }
137
- animateToIndex(oldIndex, newIndex, dx, totalSlides) {
138
- this.pendingAnimation = this.animationBuilder.build([
139
- style({ 'margin-left': (-(oldIndex + 1) * this.containerElement.nativeElement.clientWidth + dx) + 'px', 'margin-right': ((oldIndex + 1) * this.containerElement.nativeElement.clientWidth - dx) + 'px' }),
140
- animate('500ms ease', style({ 'margin-left': (-(newIndex + 1) * this.containerElement.nativeElement.clientWidth) + 'px', 'margin-right': ((newIndex + 1) * this.containerElement.nativeElement.clientWidth) + 'px' })),
141
- ]).create(this.containerElement.nativeElement);
142
- this.pendingAnimation.onDone(() => {
143
- // Correct the image index
144
- if (newIndex === -1) {
145
- this.imageIndex$.next(totalSlides - 1);
146
- }
147
- else if (newIndex === totalSlides) {
148
- this.imageIndex$.next(0);
149
- }
150
- else {
151
- this.imageIndex$.next(newIndex);
152
- }
153
- this.startTouch$.next(null);
154
- this.lastTouch$.next(null);
155
- this.pendingAnimation?.destroy();
156
- this.pendingAnimation = undefined;
157
- });
158
- this.pendingAnimation.play();
159
- }
160
- onSwipe(dx) {
161
- this.animateToIndexByDx(dx);
162
- }
163
- previous() {
164
- this.gotoAnimate(-1, 'relative');
165
- }
166
- next() {
167
- this.gotoAnimate(1, 'relative');
168
- }
169
- goto(index) {
170
- this.gotoAnimate(index, 'absolute');
171
- }
172
- gotoAnimate(index, type) {
173
- this.pendingAnimation?.finish();
174
- setTimeout(() => {
175
- combineLatest([this.actualSwipes$, this.imageIndex$]).pipe(take(1)).subscribe(([actualSwipes, imageIndex]) => {
176
- this.pendingAnimation?.finish();
177
- const idx = (type === 'relative') ? imageIndex + index : index;
178
- this.animateToIndex(imageIndex, idx, 0, actualSwipes?.length ?? 1);
179
- });
180
- }, 20);
181
- }
182
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: BsSwipeContainerDirective, deps: [{ token: i0.ElementRef }, { token: i1.AnimationBuilder }, { token: DOCUMENT }], target: i0.ɵɵFactoryTarget.Directive });
183
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.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(() => BsSwipeDirective) }], exportAs: ["bsSwipeContainer"], ngImport: i0 });
184
- }
185
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: BsSwipeContainerDirective, decorators: [{
186
- type: Directive,
187
- args: [{
188
- selector: '[bsSwipeContainer]',
189
- exportAs: 'bsSwipeContainer'
190
- }]
191
- }], ctorParameters: () => [{ type: i0.ElementRef }, { type: i1.AnimationBuilder }, { type: undefined, decorators: [{
192
- type: Inject,
193
- args: [DOCUMENT]
194
- }] }], propDecorators: { offsetLeft: [{
195
- type: HostBinding,
196
- args: ['style.margin-left.%']
197
- }], offsetRight: [{
198
- type: HostBinding,
199
- args: ['style.margin-right.%']
200
- }], offsetTop: [{
201
- type: HostBinding,
202
- args: ['style.margin-top.%']
203
- }], offsetBottom: [{
204
- type: HostBinding,
205
- args: ['style.margin-bottom.%']
206
- }], swipes: [{
207
- type: ContentChildren,
208
- args: [forwardRef(() => BsSwipeDirective)]
209
- }], minimumOffset: [{
210
- type: Input
211
- }], imageIndex: [{
212
- type: Input
213
- }], imageIndexChange: [{
214
- type: Output
215
- }] } });
216
-
217
- class BsSwipeDirective {
218
- container;
219
- platformId;
220
- constructor(container, element, platformId) {
221
- this.container = container;
222
- this.platformId = platformId;
223
- this.element = element;
224
- }
225
- element;
226
- observer;
227
- slideHeight$ = new BehaviorSubject(0);
228
- //#region Offside
229
- offside = false;
230
- //#endregion
231
- classes = true;
232
- onTouchStart(ev) {
233
- if (ev.touches.length === 1) {
234
- ev.preventDefault();
235
- this.container.pendingAnimation?.finish();
236
- setTimeout(() => {
237
- this.container.startTouch$.next({
238
- position: {
239
- x: ev.touches[0].clientX,
240
- y: ev.touches[0].clientY,
241
- },
242
- timestamp: Date.now(),
243
- });
244
- this.container.lastTouch$.next({
245
- position: {
246
- x: ev.touches[0].clientX,
247
- y: ev.touches[0].clientY,
248
- },
249
- isTouching: true,
250
- });
251
- }, 20);
252
- }
253
- }
254
- onTouchMove(ev) {
255
- this.container.lastTouch$.next({
256
- position: {
257
- x: ev.touches[0].clientX,
258
- y: ev.touches[0].clientY,
259
- },
260
- isTouching: true,
261
- });
262
- }
263
- onTouchEnd(ev) {
264
- combineLatest([this.container.startTouch$, this.container.lastTouch$])
265
- .pipe(filter(([startTouch, lastTouch]) => !!startTouch && !!lastTouch))
266
- .pipe(take(1))
267
- .subscribe(([startTouch, lastTouch]) => {
268
- if (!!startTouch && !!lastTouch) {
269
- const dx = lastTouch.position.x - startTouch.position.x;
270
- this.container.onSwipe(dx);
271
- }
272
- });
273
- }
274
- ngAfterViewInit() {
275
- if (!isPlatformServer(this.platformId)) {
276
- this.observer = new ResizeObserver((entries) => {
277
- this.slideHeight$.next(entries[0].contentRect.height);
278
- });
279
- this.observer.observe(this.element.nativeElement);
280
- }
281
- }
282
- ngOnDestroy() {
283
- if (this.observer) {
284
- this.observer.unobserve(this.element.nativeElement);
285
- this.observer.disconnect();
286
- }
287
- }
288
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: BsSwipeDirective, deps: [{ token: BsSwipeContainerDirective }, { token: i0.ElementRef }, { token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Directive });
289
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "17.0.3", type: BsSwipeDirective, selector: "[bsSwipe]", inputs: { offside: "offside" }, host: { listeners: { "touchstart": "onTouchStart($event)", "touchmove": "onTouchMove($event)", "touchend": "onTouchEnd($event)" }, properties: { "class.align-top": "this.classes", "class.d-inline-block": "this.classes", "class.float-none": "this.classes", "class.w-100": "this.classes", "class.pe-auto": "this.classes", "class.me-0": "this.classes" } }, ngImport: i0 });
290
- }
291
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: BsSwipeDirective, decorators: [{
292
- type: Directive,
293
- args: [{
294
- selector: '[bsSwipe]'
295
- }]
296
- }], ctorParameters: () => [{ type: BsSwipeContainerDirective }, { type: i0.ElementRef }, { type: undefined, decorators: [{
297
- type: Inject,
298
- args: [PLATFORM_ID]
299
- }] }], propDecorators: { offside: [{
300
- type: Input
301
- }], classes: [{
302
- type: HostBinding,
303
- args: ['class.align-top']
304
- }, {
305
- type: HostBinding,
306
- args: ['class.d-inline-block']
307
- }, {
308
- type: HostBinding,
309
- args: ['class.float-none']
310
- }, {
311
- type: HostBinding,
312
- args: ['class.w-100']
313
- }, {
314
- type: HostBinding,
315
- args: ['class.pe-auto']
316
- }, {
317
- type: HostBinding,
318
- args: ['class.me-0']
319
- }], onTouchStart: [{
320
- type: HostListener,
321
- args: ['touchstart', ['$event']]
322
- }], onTouchMove: [{
323
- type: HostListener,
324
- args: ['touchmove', ['$event']]
325
- }], onTouchEnd: [{
326
- type: HostListener,
327
- args: ['touchend', ['$event']]
328
- }] } });
329
-
330
- class BsSwiperModule {
331
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: BsSwiperModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
332
- static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "17.0.3", ngImport: i0, type: BsSwiperModule, declarations: [BsSwipeDirective, BsSwipeContainerDirective], imports: [CommonModule], exports: [BsSwipeDirective, BsSwipeContainerDirective] });
333
- static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: BsSwiperModule, imports: [CommonModule] });
334
- }
335
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "17.0.3", ngImport: i0, type: BsSwiperModule, decorators: [{
336
- type: NgModule,
337
- args: [{
338
- imports: [CommonModule],
339
- declarations: [BsSwipeDirective, BsSwipeContainerDirective],
340
- exports: [BsSwipeDirective, BsSwipeContainerDirective],
341
- }]
342
- }] });
1
+ const libraryName = '@mintplayer/ng-swiper';
343
2
 
344
3
  /**
345
4
  * Generated bundle index. Do not edit.
346
5
  */
347
6
 
348
- export { BsSwipeContainerDirective, BsSwipeDirective, BsSwiperModule };
7
+ export { libraryName };
349
8
  //# sourceMappingURL=mintplayer-ng-swiper.mjs.map
@@ -1 +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, Output, QueryList } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { BehaviorSubject, combineLatest, delay, filter, map, mergeMap, Observable, take } 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 {\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]) => offset - padLeft * 100));\n this.offsetRight$ = combineLatest([this.offset$, this.padLeft$, this.padRight$])\n .pipe(map(([offset, padLeft, padRight]) => -(offset - padLeft * 100) - (padRight - 1) * 100));\n this.offsetLeft$.pipe(takeUntilDestroyed())\n .subscribe(offsetLeft => this.offsetLeft = offsetLeft);\n this.offsetRight$.pipe(takeUntilDestroyed())\n .subscribe(offsetRight => this.offsetRight = offsetRight);\n this.imageIndex$.pipe(takeUntilDestroyed())\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(delay(400), 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 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 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.gotoAnimate(-1, 'relative');\n }\n\n next() {\n this.gotoAnimate(1, 'relative');\n }\n\n goto(index: number) {\n this.gotoAnimate(index, 'absolute');\n }\n\n private gotoAnimate(index: number, type: 'absolute' | 'relative') {\n this.pendingAnimation?.finish();\n setTimeout(() => {\n combineLatest([this.actualSwipes$, this.imageIndex$]).pipe(take(1)).subscribe(([actualSwipes, imageIndex]) => {\n this.pendingAnimation?.finish();\n const idx = (type === 'relative') ? imageIndex + index : index;\n this.animateToIndex(imageIndex, idx, 0, actualSwipes?.length ?? 1);\n });\n }, 20);\n }\n\n}\n","import { AfterViewInit, Directive, ElementRef, HostBinding, HostListener, Inject, Input, OnDestroy, PLATFORM_ID } from \"@angular/core\";\nimport { BehaviorSubject, combineLatest, filter, take } from \"rxjs\";\nimport { BsSwipeContainerDirective } from \"../swipe-container/swipe-container.directive\";\nimport { isPlatformServer } from \"@angular/common\";\n\n@Directive({\n selector: '[bsSwipe]'\n})\nexport class BsSwipeDirective implements AfterViewInit, OnDestroy {\n\n constructor(private container: BsSwipeContainerDirective, element: ElementRef<HTMLElement>, @Inject(PLATFORM_ID) private platformId: any) {\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')\n @HostBinding('class.d-inline-block')\n @HostBinding('class.float-none')\n @HostBinding('class.w-100')\n @HostBinding('class.pe-auto')\n @HostBinding('class.me-0')\n classes = true;\n\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 if (!isPlatformServer(this.platformId)) {\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\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 { BsSwipeDirective } from './directives/swipe/swipe.directive';\nimport { BsSwipeContainerDirective } from './directives/swipe-container/swipe-container.directive';\n\n@NgModule({\n imports: [CommonModule],\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":[],"mappings":";;;;;;;;MAaa,yBAAyB,CAAA;AAEK,IAAA,gBAAA,CAAA;AAAzC,IAAA,WAAA,CAAY,OAAmB,EAAU,gBAAkC,EAAoB,QAAa,EAAA;QAAnE,IAAgB,CAAA,gBAAA,GAAhB,gBAAgB,CAAkB;AACzE,QAAA,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC;AAChC,QAAA,IAAI,CAAC,QAAQ,GAAa,QAAQ,CAAC;QACnC,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;AACpG,aAAA,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,CAAC,KAAI;YAC9D,IAAI,CAAC,YAAY,EAAE;AACjB,gBAAA,QAAQ,CAAC,UAAU,GAAG,GAAG,EAAE;AAC5B,aAAA;AAAM,iBAAA,IAAI,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC,SAAS,EAAE;AACtC,gBAAA,QAAQ,CAAC,UAAU,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,gBAAgB,CAAC,aAAa,CAAC,WAAW,GAAG,GAAG,EAAE;AACrI,aAAA;AAAM,iBAAA;AACL,gBAAA,QAAQ,CAAC,UAAU,GAAG,GAAG,EAAE;AAC5B,aAAA;SACF,CAAC,CAAC,CAAC;AAEJ,QAAA,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAG;YAC7C,IAAI,CA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yBAAyB,CAAC;AACvD,iBAAA,CAAA;;;ACTD;;AAEG;;;;"}
1
+ {"version":3,"file":"mintplayer-ng-swiper.mjs","sources":["../../../../libs/mintplayer-ng-swiper/src/index.ts","../../../../libs/mintplayer-ng-swiper/src/mintplayer-ng-swiper.ts"],"sourcesContent":["export const libraryName = '@mintplayer/ng-swiper';","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":"AAAO,MAAM,WAAW,GAAG;;ACA3B;;AAEG;;;;"}
package/index.d.ts CHANGED
@@ -1,3 +1 @@
1
- export * from './lib/swiper.module';
2
- export * from './lib/directives';
3
- export * from './lib/interfaces';
1
+ export declare const libraryName = "@mintplayer/ng-swiper";
@@ -0,0 +1,2 @@
1
+ export * from './src/size';
2
+ export * from './src/observe-size.directive';
@@ -0,0 +1,18 @@
1
+ import { AfterViewInit, ElementRef, NgZone, OnDestroy } from '@angular/core';
2
+ import { BehaviorSubject, Observable } from 'rxjs';
3
+ import { Size } from './size';
4
+ import * as i0 from "@angular/core";
5
+ export declare class BsObserveSizeDirective implements AfterViewInit, OnDestroy {
6
+ private element;
7
+ private platformId;
8
+ private zone;
9
+ constructor(element: ElementRef, platformId: any, zone: NgZone);
10
+ private observer?;
11
+ size$: BehaviorSubject<Size | undefined>;
12
+ width$: Observable<number | undefined>;
13
+ height$: Observable<number | undefined>;
14
+ ngAfterViewInit(): void;
15
+ ngOnDestroy(): void;
16
+ static ɵfac: i0.ɵɵFactoryDeclaration<BsObserveSizeDirective, never>;
17
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BsObserveSizeDirective, "[bsObserveSize]", ["bsObserveSize"], {}, {}, never, never, true, never>;
18
+ }
@@ -0,0 +1,4 @@
1
+ export interface Size {
2
+ width: number;
3
+ height: number;
4
+ }
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@mintplayer/ng-swiper",
3
3
  "private": false,
4
- "version": "17.0.0",
4
+ "version": "18.1.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/MintPlayer/mintplayer-ng-bootstrap",
8
8
  "directory": "libs/mintplayer-ng-swiper"
9
9
  },
10
10
  "peerDependencies": {
11
- "@angular/common": "^17.0.0",
12
- "@angular/core": "^17.0.0",
13
- "@angular/animations": "^17.0.0",
14
- "@angular/platform-browser": "^17.0.0",
11
+ "@angular/common": "^18.0.0",
12
+ "@angular/core": "^18.0.0",
13
+ "@angular/animations": "^18.0.0",
14
+ "@angular/platform-browser": "^18.0.0",
15
15
  "rxjs": "^7.5.0"
16
16
  },
17
17
  "dependencies": {
@@ -28,6 +28,18 @@
28
28
  "esm2022": "./esm2022/mintplayer-ng-swiper.mjs",
29
29
  "esm": "./esm2022/mintplayer-ng-swiper.mjs",
30
30
  "default": "./fesm2022/mintplayer-ng-swiper.mjs"
31
+ },
32
+ "./observe-size": {
33
+ "types": "./observe-size/index.d.ts",
34
+ "esm2022": "./esm2022/observe-size/mintplayer-ng-swiper-observe-size.mjs",
35
+ "esm": "./esm2022/observe-size/mintplayer-ng-swiper-observe-size.mjs",
36
+ "default": "./fesm2022/mintplayer-ng-swiper-observe-size.mjs"
37
+ },
38
+ "./swiper": {
39
+ "types": "./swiper/index.d.ts",
40
+ "esm2022": "./esm2022/swiper/mintplayer-ng-swiper-swiper.mjs",
41
+ "esm": "./esm2022/swiper/mintplayer-ng-swiper-swiper.mjs",
42
+ "default": "./fesm2022/mintplayer-ng-swiper-swiper.mjs"
31
43
  }
32
44
  },
33
45
  "sideEffects": false
@@ -0,0 +1,3 @@
1
+ export * from './src/directives';
2
+ export * from './src/interfaces';
3
+ export * from './src/swiper.module';
@@ -0,0 +1,17 @@
1
+ import { BsObserveSizeDirective } from "@mintplayer/ng-swiper/observe-size";
2
+ import { BsSwipeContainerDirective } from "../swipe-container/swipe-container.directive";
3
+ import * as i0 from "@angular/core";
4
+ import * as i1 from "@mintplayer/ng-swiper/observe-size";
5
+ export declare class BsSwipeDirective {
6
+ private container;
7
+ constructor(container: BsSwipeContainerDirective, observeSize: BsObserveSizeDirective);
8
+ observeSize: BsObserveSizeDirective;
9
+ offside: boolean;
10
+ classes: boolean;
11
+ hostClass?: string;
12
+ onTouchStart(ev: TouchEvent): void;
13
+ onTouchMove(ev: TouchEvent): void;
14
+ onTouchEnd(ev: TouchEvent): void;
15
+ static ɵfac: i0.ɵɵFactoryDeclaration<BsSwipeDirective, never>;
16
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BsSwipeDirective, "[bsSwipe]", never, { "offside": { "alias": "offside"; "required": false; }; }, {}, never, never, false, [{ directive: typeof i1.BsObserveSizeDirective; inputs: {}; outputs: {}; }]>;
17
+ }
@@ -1,13 +1,16 @@
1
1
  import { AnimationBuilder, AnimationPlayer } from '@angular/animations';
2
2
  import { AfterViewInit, ElementRef, EventEmitter, QueryList } from '@angular/core';
3
3
  import { BehaviorSubject, Observable } from 'rxjs';
4
+ import { BsObserveSizeDirective, Size } from '@mintplayer/ng-swiper/observe-size';
4
5
  import { LastTouch } from '../../interfaces/last-touch';
5
6
  import { StartTouch } from '../../interfaces/start-touch';
6
7
  import { BsSwipeDirective } from '../swipe/swipe.directive';
7
8
  import * as i0 from "@angular/core";
9
+ import * as i1 from "@mintplayer/ng-swiper/observe-size";
8
10
  export declare class BsSwipeContainerDirective implements AfterViewInit {
9
11
  private animationBuilder;
10
- constructor(element: ElementRef, animationBuilder: AnimationBuilder, document: any);
12
+ private observeSize;
13
+ constructor(element: ElementRef, animationBuilder: AnimationBuilder, document: any, observeSize: BsObserveSizeDirective);
11
14
  offsetLeft: number | null;
12
15
  offsetRight: number | null;
13
16
  offsetTop: number | null;
@@ -22,8 +25,8 @@ export declare class BsSwipeContainerDirective implements AfterViewInit {
22
25
  startTouch$: BehaviorSubject<StartTouch | null>;
23
26
  lastTouch$: BehaviorSubject<LastTouch | null>;
24
27
  swipes$: BehaviorSubject<QueryList<BsSwipeDirective> | null>;
28
+ slideSizes$: Observable<(Size | undefined)[]>;
25
29
  imageIndex$: BehaviorSubject<number>;
26
- slideHeights$: Observable<number[]>;
27
30
  currentSlideHeight$: Observable<number>;
28
31
  pendingAnimation?: AnimationPlayer;
29
32
  containerElement: ElementRef<HTMLDivElement>;
@@ -42,5 +45,5 @@ export declare class BsSwipeContainerDirective implements AfterViewInit {
42
45
  goto(index: number): void;
43
46
  private gotoAnimate;
44
47
  static ɵfac: i0.ɵɵFactoryDeclaration<BsSwipeContainerDirective, never>;
45
- static ɵdir: i0.ɵɵDirectiveDeclaration<BsSwipeContainerDirective, "[bsSwipeContainer]", ["bsSwipeContainer"], { "minimumOffset": { "alias": "minimumOffset"; "required": false; }; "imageIndex": { "alias": "imageIndex"; "required": false; }; }, { "imageIndexChange": "imageIndexChange"; }, ["swipes"], never, false, never>;
48
+ static ɵdir: i0.ɵɵDirectiveDeclaration<BsSwipeContainerDirective, "[bsSwipeContainer]", ["bsSwipeContainer"], { "minimumOffset": { "alias": "minimumOffset"; "required": false; }; "imageIndex": { "alias": "imageIndex"; "required": false; }; }, { "imageIndexChange": "imageIndexChange"; }, ["swipes"], never, false, [{ directive: typeof i1.BsObserveSizeDirective; inputs: {}; outputs: {}; }]>;
46
49
  }
@@ -1,3 +0,0 @@
1
- export * from './swipe/swipe.directive';
2
- export * from './swipe-container/swipe-container.directive';
3
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi9saWJzL21pbnRwbGF5ZXItbmctc3dpcGVyL3NyYy9saWIvZGlyZWN0aXZlcy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxjQUFjLHlCQUF5QixDQUFDO0FBQ3hDLGNBQWMsNkNBQTZDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJleHBvcnQgKiBmcm9tICcuL3N3aXBlL3N3aXBlLmRpcmVjdGl2ZSc7XG5leHBvcnQgKiBmcm9tICcuL3N3aXBlLWNvbnRhaW5lci9zd2lwZS1jb250YWluZXIuZGlyZWN0aXZlJzsiXX0=