Skip to content

Commit 9d3a259

Browse files
committed
perf(slides): tree-shake dependency
1 parent ea01900 commit 9d3a259

File tree

14 files changed

+219
-10285
lines changed

14 files changed

+219
-10285
lines changed

core/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"@stencil/sass": "0.1.0",
3434
"@stencil/utils": "latest",
3535
"@types/jest": "^23.3.1",
36+
"@types/swiper": "4.2.1",
3637
"agadoo": "^1.0.0",
3738
"autoprefixer": "^9.0.2",
3839
"chromedriver": "^2.38.3",
@@ -44,6 +45,7 @@
4445
"selenium-webdriver": "^3.6.0",
4546
"stylelint": "^9.4.0",
4647
"stylelint-order": "^0.8.1",
48+
"swiper": "4.3.5",
4749
"tslint": "^5.10.0",
4850
"tslint-ionic-rules": "0.0.19",
4951
"tslint-react": "^3.6.0",

core/src/components.d.ts

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4167,7 +4167,9 @@ export namespace Components {
41674167
}
41684168

41694169
interface IonSlide {}
4170-
interface IonSlideAttributes extends StencilHTMLAttributes {}
4170+
interface IonSlideAttributes extends StencilHTMLAttributes {
4171+
'onIonSlideChanged'?: (event: CustomEvent<void>) => void;
4172+
}
41714173

41724174
interface IonSlides {
41734175
/**
@@ -4193,15 +4195,19 @@ export namespace Components {
41934195
/**
41944196
* Lock or unlock the ability to slide to the next slides.
41954197
*/
4196-
'lockSwipeToNext': (shouldLockSwipeToNext: boolean) => void;
4198+
'lockSwipeToNext': (shouldLockSwipeToNext: boolean) => Promise<void>;
41974199
/**
41984200
* Lock or unlock the ability to slide to the previous slides.
41994201
*/
4200-
'lockSwipeToPrev': (shouldLockSwipeToPrev: boolean) => void;
4202+
'lockSwipeToPrev': (shouldLockSwipeToPrev: boolean) => Promise<void>;
42014203
/**
42024204
* Lock or unlock the ability to slide to change slides.
42034205
*/
4204-
'lockSwipes': (shouldLockSwipes: boolean) => void;
4206+
'lockSwipes': (shouldLockSwipes: boolean) => Promise<void>;
4207+
/**
4208+
* The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`.
4209+
*/
4210+
'mode': Mode;
42054211
/**
42064212
* Options to pass to the swiper instance. See http://idangero.us/swiper/api/ for valid options
42074213
*/
@@ -4217,93 +4223,97 @@ export namespace Components {
42174223
/**
42184224
* Transition to the next slide.
42194225
*/
4220-
'slideNext': (speed?: number | undefined, runCallbacks?: boolean | undefined) => void;
4226+
'slideNext': (speed: number, runCallbacks: boolean) => Promise<void>;
42214227
/**
42224228
* Transition to the previous slide.
42234229
*/
4224-
'slidePrev': (speed?: number | undefined, runCallbacks?: boolean | undefined) => void;
4230+
'slidePrev': (speed?: number | undefined, runCallbacks?: boolean | undefined) => Promise<void>;
42254231
/**
42264232
* Transition to the specified slide.
42274233
*/
4228-
'slideTo': (index: number, speed?: number | undefined, runCallbacks?: boolean | undefined) => void;
4234+
'slideTo': (index: number, speed?: number | undefined, runCallbacks?: boolean | undefined) => Promise<void>;
42294235
/**
42304236
* Start auto play.
42314237
*/
4232-
'startAutoplay': () => void;
4238+
'startAutoplay': () => Promise<void>;
42334239
/**
42344240
* Stop auto play.
42354241
*/
4236-
'stopAutoplay': () => void;
4242+
'stopAutoplay': () => Promise<void>;
42374243
/**
42384244
* Update the underlying slider implementation. Call this if you've added or removed child slides.
42394245
*/
4240-
'update': () => void;
4246+
'update': () => Promise<void>;
42414247
}
42424248
interface IonSlidesAttributes extends StencilHTMLAttributes {
4249+
/**
4250+
* The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`.
4251+
*/
4252+
'mode'?: Mode;
42434253
/**
42444254
* Emitted after the active slide has changed.
42454255
*/
4246-
'onIonSlideDidChange'?: (event: CustomEvent) => void;
4256+
'onIonSlideDidChange'?: (event: CustomEvent<void>) => void;
42474257
/**
42484258
* Emitted when the user double taps on the slide's container.
42494259
*/
4250-
'onIonSlideDoubleTap'?: (event: CustomEvent) => void;
4260+
'onIonSlideDoubleTap'?: (event: CustomEvent<void>) => void;
42514261
/**
42524262
* Emitted when the slider is actively being moved.
42534263
*/
4254-
'onIonSlideDrag'?: (event: CustomEvent) => void;
4264+
'onIonSlideDrag'?: (event: CustomEvent<void>) => void;
42554265
/**
42564266
* Emitted when the next slide has ended.
42574267
*/
4258-
'onIonSlideNextEnd'?: (event: CustomEvent) => void;
4268+
'onIonSlideNextEnd'?: (event: CustomEvent<void>) => void;
42594269
/**
42604270
* Emitted when the next slide has started.
42614271
*/
4262-
'onIonSlideNextStart'?: (event: CustomEvent) => void;
4272+
'onIonSlideNextStart'?: (event: CustomEvent<void>) => void;
42634273
/**
42644274
* Emitted when the previous slide has ended.
42654275
*/
4266-
'onIonSlidePrevEnd'?: (event: CustomEvent) => void;
4276+
'onIonSlidePrevEnd'?: (event: CustomEvent<void>) => void;
42674277
/**
42684278
* Emitted when the previous slide has started.
42694279
*/
4270-
'onIonSlidePrevStart'?: (event: CustomEvent) => void;
4280+
'onIonSlidePrevStart'?: (event: CustomEvent<void>) => void;
42714281
/**
42724282
* Emitted when the slider is at the last slide.
42734283
*/
4274-
'onIonSlideReachEnd'?: (event: CustomEvent) => void;
4284+
'onIonSlideReachEnd'?: (event: CustomEvent<void>) => void;
42754285
/**
42764286
* Emitted when the slider is at its initial position.
42774287
*/
4278-
'onIonSlideReachStart'?: (event: CustomEvent) => void;
4288+
'onIonSlideReachStart'?: (event: CustomEvent<void>) => void;
42794289
/**
42804290
* Emitted when the user taps/clicks on the slide's container.
42814291
*/
4282-
'onIonSlideTap'?: (event: CustomEvent) => void;
4292+
'onIonSlideTap'?: (event: CustomEvent<void>) => void;
42834293
/**
42844294
* Emitted when the user releases the touch.
42854295
*/
4286-
'onIonSlideTouchEnd'?: (event: CustomEvent) => void;
4296+
'onIonSlideTouchEnd'?: (event: CustomEvent<void>) => void;
42874297
/**
42884298
* Emitted when the user first touches the slider.
42894299
*/
4290-
'onIonSlideTouchStart'?: (event: CustomEvent) => void;
4300+
'onIonSlideTouchStart'?: (event: CustomEvent<void>) => void;
42914301
/**
42924302
* Emitted when the slide transition has ended.
42934303
*/
4294-
'onIonSlideTransitionEnd'?: (event: CustomEvent) => void;
4304+
'onIonSlideTransitionEnd'?: (event: CustomEvent<void>) => void;
42954305
/**
42964306
* Emitted when the slide transition has started.
42974307
*/
4298-
'onIonSlideTransitionStart'?: (event: CustomEvent) => void;
4308+
'onIonSlideTransitionStart'?: (event: CustomEvent<void>) => void;
42994309
/**
43004310
* Emitted before the active slide has changed.
43014311
*/
4302-
'onIonSlideWillChange'?: (event: CustomEvent) => void;
4312+
'onIonSlideWillChange'?: (event: CustomEvent<void>) => void;
43034313
/**
43044314
* Emitted after Swiper initialization
43054315
*/
4306-
'onIonSlidesDidLoad'?: (event: CustomEvent) => void;
4316+
'onIonSlidesDidLoad'?: (event: CustomEvent<void>) => void;
43074317
/**
43084318
* Options to pass to the swiper instance. See http://idangero.us/swiper/api/ for valid options
43094319
*/

core/src/components/slide/readme.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,13 @@ See the [Slides API Docs](../slides) for more usage information.
1010
<!-- Auto Generated Below -->
1111

1212

13+
## Events
14+
15+
| Event | Description |
16+
| ----------------- | ----------- |
17+
| `ionSlideChanged` | |
18+
19+
1320
----------------------------------------------
1421

1522
*Built with [StencilJS](https://stenciljs.com/)*

core/src/components/slide/slide.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
1-
import { Component } from '@stencil/core';
1+
import { Component, Event } from '@stencil/core';
2+
import { EventEmitter } from 'ionicons/dist/types/stencil.core';
23

34
@Component({
45
tag: 'ion-slide',
56
styleUrl: 'slide.scss'
67
})
78
export class Slide {
89

10+
@Event() ionSlideChanged!: EventEmitter<void>;
11+
12+
componentDidLoad() {
13+
this.ionSlideChanged.emit();
14+
}
15+
16+
componentDidUnload() {
17+
this.ionSlideChanged.emit();
18+
}
19+
920
hostData() {
1021
return {
1122
class: {
12-
'slide-zoom': true,
1323
'swiper-slide': true
1424
}
1525
};
1626
}
17-
1827
}

core/src/components/slides/readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Licensed under MIT
2323

2424
| Property | Attribute | Description | Type |
2525
| ----------- | ----------- | -------------------------------------------------------------------------------------------- | --------- |
26+
| `mode` | `mode` | The mode determines which platform styles to use. Possible values are: `"ios"` or `"md"`. | `Mode` |
2627
| `options` | -- | Options to pass to the swiper instance. See http://idangero.us/swiper/api/ for valid options | `any` |
2728
| `pager` | `pager` | If true, show the pagination. Defaults to `false`. | `boolean` |
2829
| `scrollbar` | `scrollbar` | If true, show the scrollbar. Defaults to `false`. | `boolean` |

core/src/components/slides/slides-vendor.scss

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/**
2-
* Swiper 4.2.6
2+
* Swiper 4.3.5
33
* Most modern mobile touch slider and framework with hardware accelerated transitions
44
* http://www.idangero.us/swiper/
55
*
66
* Copyright 2014-2018 Vladimir Kharlampidi
77
*
88
* Released under the MIT License
99
*
10-
* Released on: May 1, 2018
10+
* Released on: July 31, 2018
1111
*/
1212
.swiper-container {
1313
margin: 0 auto;
@@ -272,7 +272,8 @@
272272
height: 8px;
273273
display: inline-block;
274274
border-radius: 100%;
275-
background: rgba(0, 0, 0, .2);
275+
background: #000;
276+
opacity: 0.2;
276277
}
277278
button.swiper-pagination-bullet {
278279
border: none;
@@ -288,6 +289,7 @@ button.swiper-pagination-bullet {
288289
cursor: pointer;
289290
}
290291
.swiper-pagination-bullet-active {
292+
opacity: 1;
291293
background: #007aff;
292294
}
293295
.swiper-container-vertical > .swiper-pagination-bullets {
@@ -613,4 +615,4 @@ button.swiper-pagination-bullet {
613615
.swiper-container-coverflow .swiper-wrapper {
614616
/* Windows 8 IE 10 fix */
615617
-ms-perspective: 1200px;
616-
}
618+
}

core/src/components/slides/slides.ios.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// iOS Slides
55
// --------------------------------------------------
66

7-
:host {
7+
.slides-ios {
88
--bullet-background: #{$slides-ios-bullet-background};
99
--bullet-background-active: #{$slides-ios-bullet-background-active};
1010
--progress-bar-background: #{$slides-ios-progress-bar-background};

core/src/components/slides/slides.md.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Material Design Slides
55
// --------------------------------------------------
66

7-
:host {
7+
.slides-md {
88
--bullet-background: #{$slides-md-bullet-background};
99
--bullet-background-active: #{$slides-md-bullet-background-active};
1010
--progress-bar-background: #{$slides-md-progress-bar-background};

core/src/components/slides/slides.scss

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,16 @@
44
// Slides
55
// --------------------------------------------------
66

7-
:host {
7+
.slides {
88
/**
99
* @prop --bullet-background: Background of the pagination bullets
1010
* @prop --bullet-background-active: Background of the active pagination bullet
1111
*/
12-
13-
// TODO: document progress and scroll bar properties once they're working
14-
1512
display: block;
1613

1714
user-select: none;
1815
}
1916

20-
.swiper-container {
21-
height: 100%;
22-
}
23-
2417

2518
// Pagination Bullets
2619
// --------------------------------------------------

0 commit comments

Comments
 (0)