ngx-edge-slider 1.0.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 (38) hide show
  1. package/ngx-edge-slider-workspace/.editorconfig +16 -0
  2. package/ngx-edge-slider-workspace/.vscode/extensions.json +4 -0
  3. package/ngx-edge-slider-workspace/.vscode/launch.json +20 -0
  4. package/ngx-edge-slider-workspace/.vscode/tasks.json +42 -0
  5. package/ngx-edge-slider-workspace/README.md +27 -0
  6. package/ngx-edge-slider-workspace/angular.json +140 -0
  7. package/ngx-edge-slider-workspace/package-lock.json +13339 -0
  8. package/ngx-edge-slider-workspace/package.json +39 -0
  9. package/ngx-edge-slider-workspace/projects/ngx-edge-slider/README.md +24 -0
  10. package/ngx-edge-slider-workspace/projects/ngx-edge-slider/ng-package.json +7 -0
  11. package/ngx-edge-slider-workspace/projects/ngx-edge-slider/package.json +12 -0
  12. package/ngx-edge-slider-workspace/projects/ngx-edge-slider/src/lib/assets/icons/arrow-black.svg +3 -0
  13. package/ngx-edge-slider-workspace/projects/ngx-edge-slider/src/lib/assets/icons/arrow-gray.svg +3 -0
  14. package/ngx-edge-slider-workspace/projects/ngx-edge-slider/src/lib/ngx-edge-slider.component.html +78 -0
  15. package/ngx-edge-slider-workspace/projects/ngx-edge-slider/src/lib/ngx-edge-slider.component.scss +344 -0
  16. package/ngx-edge-slider-workspace/projects/ngx-edge-slider/src/lib/ngx-edge-slider.component.ts +610 -0
  17. package/ngx-edge-slider-workspace/projects/ngx-edge-slider/src/lib/ngx-edge-slider.interface.ts +34 -0
  18. package/ngx-edge-slider-workspace/projects/ngx-edge-slider/src/lib/ngx-edge-slider.module.ts +18 -0
  19. package/ngx-edge-slider-workspace/projects/ngx-edge-slider/src/lib/ngx-edge-slider.service.ts +9 -0
  20. package/ngx-edge-slider-workspace/projects/ngx-edge-slider/src/public-api.ts +7 -0
  21. package/ngx-edge-slider-workspace/projects/ngx-edge-slider/tsconfig.lib.json +14 -0
  22. package/ngx-edge-slider-workspace/projects/ngx-edge-slider/tsconfig.lib.prod.json +10 -0
  23. package/ngx-edge-slider-workspace/projects/ngx-edge-slider/tsconfig.spec.json +14 -0
  24. package/ngx-edge-slider-workspace/projects/test-app/src/app/app.component.html +11 -0
  25. package/ngx-edge-slider-workspace/projects/test-app/src/app/app.component.scss +0 -0
  26. package/ngx-edge-slider-workspace/projects/test-app/src/app/app.component.spec.ts +27 -0
  27. package/ngx-edge-slider-workspace/projects/test-app/src/app/app.component.ts +57 -0
  28. package/ngx-edge-slider-workspace/projects/test-app/src/app/app.module.ts +18 -0
  29. package/ngx-edge-slider-workspace/projects/test-app/src/assets/.gitkeep +0 -0
  30. package/ngx-edge-slider-workspace/projects/test-app/src/assets/slide2_desktop_1950x.webp +0 -0
  31. package/ngx-edge-slider-workspace/projects/test-app/src/favicon.ico +0 -0
  32. package/ngx-edge-slider-workspace/projects/test-app/src/index.html +13 -0
  33. package/ngx-edge-slider-workspace/projects/test-app/src/main.ts +7 -0
  34. package/ngx-edge-slider-workspace/projects/test-app/src/styles.scss +1 -0
  35. package/ngx-edge-slider-workspace/projects/test-app/tsconfig.app.json +14 -0
  36. package/ngx-edge-slider-workspace/projects/test-app/tsconfig.spec.json +14 -0
  37. package/ngx-edge-slider-workspace/tsconfig.json +39 -0
  38. package/package.json +24 -0
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "ngx-edge-slider-workspace",
3
+ "version": "0.0.0",
4
+ "scripts": {
5
+ "ng": "ng",
6
+ "start": "ng serve",
7
+ "build": "ng build",
8
+ "watch": "ng build --watch --configuration development",
9
+ "test": "ng test"
10
+ },
11
+ "private": true,
12
+ "dependencies": {
13
+ "@angular/animations": "^16.2.0",
14
+ "@angular/common": "^16.2.0",
15
+ "@angular/compiler": "^16.2.0",
16
+ "@angular/core": "^16.2.0",
17
+ "@angular/forms": "^16.2.0",
18
+ "@angular/platform-browser": "^16.2.0",
19
+ "@angular/platform-browser-dynamic": "^16.2.0",
20
+ "@angular/router": "^16.2.0",
21
+ "rxjs": "~7.8.0",
22
+ "tslib": "^2.3.0",
23
+ "zone.js": "~0.13.0"
24
+ },
25
+ "devDependencies": {
26
+ "@angular-devkit/build-angular": "^16.2.16",
27
+ "@angular/cli": "^16.2.10",
28
+ "@angular/compiler-cli": "^16.2.0",
29
+ "@types/jasmine": "~4.3.0",
30
+ "jasmine-core": "~4.6.0",
31
+ "karma": "~6.4.0",
32
+ "karma-chrome-launcher": "~3.2.0",
33
+ "karma-coverage": "~2.2.0",
34
+ "karma-jasmine": "~5.1.0",
35
+ "karma-jasmine-html-reporter": "~2.1.0",
36
+ "ng-packagr": "^16.2.0",
37
+ "typescript": "~5.1.3"
38
+ }
39
+ }
@@ -0,0 +1,24 @@
1
+ # NgxEdgeSlider
2
+
3
+ This library was generated with [Angular CLI](https://github.com/angular/angular-cli) version 16.2.0.
4
+
5
+ ## Code scaffolding
6
+
7
+ Run `ng generate component component-name --project ngx-edge-slider` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module --project ngx-edge-slider`.
8
+ > Note: Don't forget to add `--project ngx-edge-slider` or else it will be added to the default project in your `angular.json` file.
9
+
10
+ ## Build
11
+
12
+ Run `ng build ngx-edge-slider` to build the project. The build artifacts will be stored in the `dist/` directory.
13
+
14
+ ## Publishing
15
+
16
+ After building your library with `ng build ngx-edge-slider`, go to the dist folder `cd dist/ngx-edge-slider` and run `npm publish`.
17
+
18
+ ## Running unit tests
19
+
20
+ Run `ng test ngx-edge-slider` to execute the unit tests via [Karma](https://karma-runner.github.io).
21
+
22
+ ## Further help
23
+
24
+ To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.
@@ -0,0 +1,7 @@
1
+ {
2
+ "$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
3
+ "dest": "../../dist/ngx-edge-slider",
4
+ "lib": {
5
+ "entryFile": "src/public-api.ts"
6
+ }
7
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "ngx-edge-slider",
3
+ "version": "0.0.1",
4
+ "peerDependencies": {
5
+ "@angular/common": "^16.2.0",
6
+ "@angular/core": "^16.2.0"
7
+ },
8
+ "dependencies": {
9
+ "tslib": "^2.3.0"
10
+ },
11
+ "sideEffects": false
12
+ }
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 3.5 23.71 17">
2
+ <path fill="#212121" fill-rule="evenodd" d="M15.354 3.646a.5.5 0 0 0-.708.708l7.147 7.146H.5a.5.5 0 0 0 0 1h21.293l-7.147 7.146a.5.5 0 0 0 .708.708l8-8 .353-.354-.353-.354-8-8Z" clip-rule="evenodd"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 3.5 23.71 17">
2
+ <path fill="#B3B3B3" fill-rule="evenodd" d="M15.354 3.646a.5.5 0 0 0-.708.708l7.147 7.146H.5a.5.5 0 0 0 0 1h21.293l-7.147 7.146a.5.5 0 0 0 .708.708l8-8 .353-.354-.353-.354-8-8Z" clip-rule="evenodd"/>
3
+ </svg>
@@ -0,0 +1,78 @@
1
+ <!-- Navigation Buttons -->
2
+ <div class="slider__controls margin" *ngIf="config.slides?.length > 1 && config.navEnabled && config.navPosition !== 'centered' || config.paginationEnabled && config.paginationPosition == 'thumbs-up' || config.title?.length">
3
+ <div *ngIf="config.title?.length" class="slider-header">{{ config.title }}</div>
4
+
5
+ <div class="slider-buttons-container" >
6
+ <div class="slider-button left" *ngIf="config.navEnabled" [class.disabled]="!canClickPrevious" title="Previous" (click)="onPreviousClick()">
7
+ </div>
8
+ <div class="slider-button right" *ngIf="config.navEnabled" [class.disabled]="!canClickNext" title="Next" (click)="onNextClick()">
9
+ </div>
10
+
11
+ <div *ngIf=" config.paginationEnabled && config.paginationPosition == 'thumbs-up'" class="thumbs">
12
+ <div class="thumb-dots">
13
+ <div *ngFor="let dot of pager.visibleDots; let i = index">
14
+ <span class="thumb-dot"
15
+ [class.active]="dot === pager.currentPage"
16
+ [class.inactive]="dot !== pager.currentPage" >
17
+ </span>
18
+ </div>
19
+ </div>
20
+ </div>
21
+ </div>
22
+ </div>
23
+
24
+ <div class="slider" [class.slider--nav-static]="config.navEnabled && !config.navHoverable" [class.slider--nav-hoverable]="config.navEnabled && config.navHoverable" [class.slider-draggable]="config.draggable" [class.slider-vertical]="config.vertical" *ngIf="config.slides?.length > 0">
25
+
26
+ <!-- Slide Wrapper -->
27
+ <div class="slider__wrapper" [style.transform]="this.translateStyle">
28
+
29
+ <div *ngFor="let slide of config.slides; let i = index; trackBy: trackBySlideId"
30
+ class="slide"
31
+ (click)="handleOnSlideClick(i)"
32
+ [class.slide-draggable]="isDragStarted"
33
+ [ngClass]="{'slide--current': selectedSlide === i}"
34
+ [style.width]="config.slideWidth + '%'" >
35
+
36
+ <div class="slide-content">
37
+ <div class="drag-handle"
38
+ (mousedown)="onStart($event)"
39
+ (touchstart)="onStart($event)"
40
+ (mousemove)="onMove($event)"
41
+ (touchmove)="onMove($event)"
42
+ (mousemove)="onThrottledMove($event)"
43
+ (touchmove)="onThrottledMove($event)"
44
+ (mouseup)="onEnd($event)"
45
+ (touchend)="onEnd($event)"
46
+ (mouseleave)="onLeave()"
47
+ (touchcancel)="onLeave()">
48
+
49
+ <ng-container *ngTemplateOutlet="slideTemplate; context: { slide: slide, index: i, sliding: slideChanging }" ></ng-container>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ </div>
54
+
55
+ </div>
56
+
57
+
58
+ <div class="slider__bottom_controls" *ngIf="config.slides?.length > 1 && config.navEnabled && config.navPosition == 'centered'">
59
+ <div (click)="onPreviousClick()" [class.disabled]="!canClickPrevious" class="slider-arrow-prev"></div>
60
+ <div (click)="onNextClick()" [class.disabled]="!canClickNext" class="slider-arrow-next"></div>
61
+ </div>
62
+
63
+ <div *ngIf="config.paginationEnabled && config.paginationPosition == 'thumbs-bottom'" class="thumbs">
64
+ <div class="thumb-dots">
65
+ <div *ngFor="let dot of pager.visibleDots; let i = index">
66
+ <span
67
+ class="thumb-dot"
68
+ [class.active]="dot === pager.currentPage"
69
+ [class.inactive]="dot !== pager.currentPage" >
70
+ </span>
71
+ </div>
72
+ </div>
73
+ </div>
74
+
75
+ <!--
76
+ 'slide--next': !isPreviousSlide(i) && isNextSlide(i) && !isCurrentSlide(i),
77
+ 'slide--previous': isPreviousSlide(i) && !isNextSlide(i) && !isCurrentSlide(i)
78
+ -->
@@ -0,0 +1,344 @@
1
+ $base-duration: 1000ms;
2
+ $base-ease: cubic-bezier(0.25, 0.46, 0.45, 0.84);
3
+ $color-accent: #1D1F2F;
4
+
5
+ :host {
6
+ position: relative;
7
+ display: block;
8
+ margin-left: auto;
9
+ margin-right: auto;
10
+ z-index: 1;
11
+ }
12
+
13
+ .overflow-visible {
14
+ overflow: visible;
15
+ }
16
+
17
+ /* Default Hidden State */
18
+ .slider + .slider__bottom_controls {
19
+ opacity: 0;
20
+ visibility: hidden;
21
+ transition: opacity 0.3s ease, visibility 0.3s ease;
22
+ }
23
+
24
+ /* Hover on .slider or .slider__bottom_controls */
25
+ .slider:hover + .slider__bottom_controls,
26
+ .slider + .slider__bottom_controls:hover {
27
+ opacity: 1;
28
+ visibility: visible;
29
+ transition: opacity 0.2s ease-out;
30
+ }
31
+
32
+ /* Always-visible State */
33
+
34
+ .slider.slider--nav-static + .slider__bottom_controls {
35
+ opacity: 1;
36
+ visibility: visible;
37
+
38
+ .slider-arrow-next,
39
+ .slider-arrow-prev {
40
+ &.disabled {
41
+ opacity: 0;
42
+ visibility: hidden;
43
+ }
44
+ }
45
+ }
46
+
47
+ /* Hover-enabled State */
48
+ .slider.slider--nav-hoverable:hover + .slider__bottom_controls {
49
+ opacity: 1;
50
+ visibility: visible;
51
+ }
52
+
53
+ .slider {
54
+ width: 100%;
55
+ height: 100%;
56
+ margin-left: auto;
57
+ margin-right: auto;
58
+ position: relative;
59
+ list-style: none;
60
+ overflow: hidden;
61
+
62
+ /* Fix of Webkit flickering */
63
+ z-index: 1;
64
+ display: block;
65
+
66
+ &.slider-vertical {
67
+ .slider__wrapper {
68
+ flex-direction: column;
69
+ height: 100%;
70
+ width: 100%;
71
+ transition: transform $base-duration $base-ease;
72
+ }
73
+
74
+ .slide {
75
+ height: calc(100% / slidesPerViewAdjusted);
76
+ width: 100%;
77
+ flex-shrink: 0;
78
+ transition: transform 0.3s ease;
79
+ }
80
+
81
+ .thumbs {
82
+ flex-direction: column;
83
+ align-items: center;
84
+ margin: 10px 0;
85
+ }
86
+
87
+ .slider__controls {
88
+ flex-direction: column;
89
+ justify-content: center;
90
+ }
91
+ }
92
+
93
+ @media (max-width: 1023px) {
94
+ .slider__bottom_controls {
95
+ .slider-arrow-next,
96
+ .slider-arrow-prev {
97
+ background: rgba(255, 255, 255, 0.9) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='4.51 0.01 10.99 19.97'%3E%3Cpath fill='%23000' d='m4.508 18.968 1.006 1.006 9.983-9.984L5.514.005 4.508 1.011l8.984 8.984-8.984 8.973Z'/%3E%3C/svg%3E") no-repeat center center/11px 18px;
98
+ }
99
+ }
100
+
101
+ .slider.slider-vertical {
102
+ .slider__wrapper {
103
+ height: auto;
104
+ margin: 16px auto;
105
+ }
106
+ }
107
+ }
108
+ }
109
+
110
+ .slider__wrapper {
111
+ position: relative;
112
+ width: 100%;
113
+ height: 100%;
114
+ z-index: 1;
115
+ display: flex;
116
+ box-sizing: content-box;
117
+ will-change: transform;
118
+ transition: transform $base-duration $base-ease;
119
+ transform: translate3d(0, 0, 0); /* GPU acceleration */
120
+ }
121
+
122
+ .slider__wrapper.no-translate {
123
+ transform: none !important;
124
+ }
125
+
126
+ .slide {
127
+ flex-shrink: 0;
128
+ width: 100%;
129
+ height: 100%;
130
+ position: relative;
131
+ transition: transform 0.3s ease;
132
+
133
+ /* &.slide-draggable {
134
+ cursor: grab;
135
+
136
+ img, a, div, button, p, span {
137
+ pointer-events: auto;
138
+ }
139
+ }*/
140
+
141
+ /*img {
142
+ width: 100%;
143
+ height: 100%;
144
+ object-fit: cover;
145
+ display: block;
146
+ }*/
147
+ }
148
+
149
+ .slide-content {
150
+ position: relative;
151
+ width: 100%;
152
+ height: 100%;
153
+
154
+ .drag-handle {
155
+ width: 100%;
156
+ height: 100%;
157
+ cursor: grab;
158
+ z-index: 10;
159
+ pointer-events: all;
160
+ }
161
+ }
162
+
163
+ ::ng-deep .slide-content img {
164
+ width: 100%;
165
+ height: 100%;
166
+ }
167
+
168
+ .slide__image-wrapper {
169
+ background-color: $color-accent;
170
+ border-radius: 1%;
171
+ height: 100%;
172
+ left: 0;
173
+ overflow: hidden;
174
+ position: absolute;
175
+ top: 0;
176
+ transition: transform calc(#{$base-duration} / 4) $base-ease;
177
+ width: 100%;
178
+ }
179
+
180
+ .slide__image {
181
+ height: 100%;
182
+ width: 100%;
183
+ left: 0;
184
+ top: 0;
185
+ object-fit: cover;
186
+ position: absolute;
187
+ }
188
+
189
+ .slider__controls {
190
+ position: relative;
191
+ z-index: initial;
192
+ align-items: center;
193
+ justify-content: space-between;
194
+ display: flex;
195
+
196
+ &.margin {
197
+ margin: 96px 10px 32px 10px;
198
+ }
199
+
200
+ .slider-header {
201
+ font-family: FixelText, sans-serif;
202
+ font-weight: 500;
203
+ font-size: 26px;
204
+ line-height: 40px;
205
+ color: #212121;
206
+ text-align: center;
207
+ margin: 0;
208
+ flex: 1;
209
+ }
210
+
211
+ .slider-buttons-container {
212
+ display: flex;
213
+ gap: 45px;
214
+ margin-left: auto;
215
+ }
216
+
217
+ .slider-button {
218
+ height: 28px;
219
+ width: 28px;
220
+ transition: opacity 0.2s ease-in-out;
221
+ background: url("assets/icons/arrow-black.svg") no-repeat center center;
222
+ cursor: pointer;
223
+
224
+ &.disabled {
225
+ background: url("assets/icons/arrow-gray.svg") no-repeat center center;
226
+ cursor: not-allowed;
227
+ }
228
+
229
+ &.left {
230
+ transform: rotate(180deg);
231
+ }
232
+ }
233
+
234
+ @media (max-width: 768px) {
235
+ flex-direction: row;
236
+ justify-content: space-between;
237
+
238
+ &.margin {
239
+ margin: 48px 15px 16px 10px;
240
+ }
241
+
242
+ .slider-header {
243
+ font-size: 20px;
244
+ line-height: 32px;
245
+ text-align: left;
246
+ padding-left: 16px;
247
+ }
248
+
249
+ .slider-buttons-container {
250
+ gap: 25px;
251
+ margin-left: 0;
252
+
253
+ .slider-button {
254
+ height: 20px;
255
+ width: 20px;
256
+ }
257
+ }
258
+ }
259
+ }
260
+
261
+ .thumbs {
262
+ display: flex;
263
+ justify-content: center;
264
+ align-items: center;
265
+ transition: transform .2s ease-in-out;
266
+
267
+ .slider__controls.thumbs-top {
268
+ flex-direction: column-reverse;
269
+ }
270
+
271
+ .slider__controls.thumbs-bottom {
272
+ flex-direction: column;
273
+ width: 100%;
274
+ height: 20px;
275
+ }
276
+
277
+ .thumb-dots {
278
+ display: flex;
279
+ align-items: center;
280
+ gap: 7px;
281
+ }
282
+
283
+ .thumb-dot {
284
+ display: inline-block;
285
+ width: 4px;
286
+ height: 4px;
287
+ margin: 0 0 0 8px;
288
+ border-radius: 50%;
289
+ background: #b3b3b3;
290
+
291
+ &.active {
292
+ background: #212121;
293
+ border: 1px solid #212121;
294
+ }
295
+
296
+ &:hover {
297
+ background: #212121;
298
+ border: 1px solid #212121;
299
+ }
300
+
301
+ &.hidden {
302
+ opacity: 0;
303
+ pointer-events: none;
304
+ }
305
+ }
306
+ }
307
+
308
+ .slider__bottom_controls {
309
+ display: block;
310
+ opacity: 0;
311
+ visibility: hidden;
312
+ }
313
+
314
+ .slider-arrow-next,
315
+ .slider-arrow-prev {
316
+ position: absolute;
317
+ top: calc(50% - 21px);
318
+ height: 42px;
319
+ width: 42px;
320
+ display: block;
321
+ background: rgba(255, 255, 255, 0.9) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='4.51 0.01 10.99 19.97'%3E%3Cpath fill='%23000' d='m4.508 18.968 1.006 1.006 9.983-9.984L5.514.005 4.508 1.011l8.984 8.984-8.984 8.973Z'/%3E%3C/svg%3E") no-repeat center center/11px 18px;
322
+ z-index: 9;
323
+ pointer-events: all;
324
+ cursor: pointer;
325
+ }
326
+
327
+ .slider-arrow-next {
328
+ right: 10px;
329
+ }
330
+
331
+ .slider-arrow-prev {
332
+ left: 10px;
333
+ transform:rotate(180deg)
334
+ }
335
+
336
+ @media (max-width: 1023px) {
337
+ .slider-arrow-prev {
338
+ left: 0;
339
+ }
340
+
341
+ .slider-arrow-next {
342
+ right: 0;
343
+ }
344
+ }