mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
chore(): create d.ts for Swiper
This commit is contained in:
33
gulpfile.js
33
gulpfile.js
@ -73,6 +73,7 @@ gulp.task('clean.build', function(done) {
|
|||||||
|
|
||||||
gulp.task('watch', function(done) {
|
gulp.task('watch', function(done) {
|
||||||
runSequence(
|
runSequence(
|
||||||
|
'copy.libs',
|
||||||
'build',
|
'build',
|
||||||
'serve',
|
'serve',
|
||||||
function() {
|
function() {
|
||||||
@ -134,6 +135,7 @@ gulp.task('clean', function(done) {
|
|||||||
function tsCompile(options, cacheName){
|
function tsCompile(options, cacheName){
|
||||||
return gulp.src([
|
return gulp.src([
|
||||||
'ionic/**/*.ts',
|
'ionic/**/*.ts',
|
||||||
|
'!ionic/**/*.d.ts',
|
||||||
'!ionic/components/*/test/**/*',
|
'!ionic/components/*/test/**/*',
|
||||||
'!ionic/util/test/*',
|
'!ionic/util/test/*',
|
||||||
'!ionic/config/test/*',
|
'!ionic/config/test/*',
|
||||||
@ -179,9 +181,14 @@ gulp.task('bundle.system', function(){
|
|||||||
var concat = require('gulp-concat');
|
var concat = require('gulp-concat');
|
||||||
var gulpif = require('gulp-if');
|
var gulpif = require('gulp-if');
|
||||||
var stripDebug = require('gulp-strip-debug');
|
var stripDebug = require('gulp-strip-debug');
|
||||||
|
var merge = require('merge2');
|
||||||
|
|
||||||
return tsCompile(tscOptionsEs6, 'system')
|
var tsResult = tsCompile(tscOptionsEs6, 'system')
|
||||||
.pipe(babel(babelOptions))
|
.pipe(babel(babelOptions));
|
||||||
|
|
||||||
|
var swiper = gulp.src('ionic/components/slides/swiper-widget.system.js');
|
||||||
|
|
||||||
|
return merge([tsResult, swiper])
|
||||||
.pipe(remember('system'))
|
.pipe(remember('system'))
|
||||||
.pipe(gulpif(IS_RELEASE, stripDebug()))
|
.pipe(gulpif(IS_RELEASE, stripDebug()))
|
||||||
.pipe(concat('ionic.system.js'))
|
.pipe(concat('ionic.system.js'))
|
||||||
@ -333,7 +340,7 @@ gulp.task('e2e.build', function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('e2e', ['e2e.build', 'bundle.system', 'copy.web-animations', 'sass', 'fonts']);
|
gulp.task('e2e', ['e2e.build', 'bundle.system', 'copy.libs', 'sass', 'fonts']);
|
||||||
|
|
||||||
gulp.task('sass', function() {
|
gulp.task('sass', function() {
|
||||||
var sass = require('gulp-sass');
|
var sass = require('gulp-sass');
|
||||||
@ -385,11 +392,18 @@ gulp.task('copy.scss', function() {
|
|||||||
.pipe(gulp.dest('dist'));
|
.pipe(gulp.dest('dist'));
|
||||||
})
|
})
|
||||||
|
|
||||||
gulp.task('copy.web-animations', function() {
|
gulp.task('copy.libs', function() {
|
||||||
return gulp.src([
|
var merge = require('merge2');
|
||||||
'scripts/resources/web-animations-js/web-animations.min.js'
|
var webAnimations = gulp.src('scripts/resources/web-animations-js/web-animations.min.js')
|
||||||
])
|
|
||||||
.pipe(gulp.dest('dist/js'));
|
.pipe(gulp.dest('dist/js'));
|
||||||
|
|
||||||
|
var libs = gulp.src([
|
||||||
|
'ionic/**/*.js',
|
||||||
|
'ionic/**/*.d.ts'
|
||||||
|
])
|
||||||
|
.pipe(gulp.dest('dist'));
|
||||||
|
|
||||||
|
return merge([webAnimations, libs]);
|
||||||
})
|
})
|
||||||
|
|
||||||
gulp.task('src.link', function(done) {
|
gulp.task('src.link', function(done) {
|
||||||
@ -401,7 +415,8 @@ gulp.task('src.link', function(done) {
|
|||||||
gulp.task('src', function(done){
|
gulp.task('src', function(done){
|
||||||
runSequence(
|
runSequence(
|
||||||
'clean',
|
'clean',
|
||||||
['bundle', 'sass', 'fonts', 'copy.scss', 'copy.web-animations'],
|
'copy.libs',
|
||||||
|
['bundle', 'sass', 'fonts', 'copy.scss'],
|
||||||
'transpile.typecheck',
|
'transpile.typecheck',
|
||||||
done
|
done
|
||||||
);
|
);
|
||||||
@ -533,7 +548,7 @@ gulp.task('sass.demos:components', function() {
|
|||||||
.pipe(gulp.dest('../ionic-site/docs/v2/demos/component-docs/'));
|
.pipe(gulp.dest('../ionic-site/docs/v2/demos/component-docs/'));
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('bundle.demos:api', ['build.demos', 'transpile.no-typecheck', 'copy.web-animations', 'sass', 'fonts'], function(done) {
|
gulp.task('bundle.demos:api', ['build.demos', 'transpile.no-typecheck', 'copy.libs', 'sass', 'fonts'], function(done) {
|
||||||
return buildDemoBundle({demo: 'api'}, done);
|
return buildDemoBundle({demo: 'api'}, done);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ export class Slides extends Ion {
|
|||||||
|
|
||||||
public rapidUpdate: Function;
|
public rapidUpdate: Function;
|
||||||
private showPager: boolean;
|
private showPager: boolean;
|
||||||
private slider: typeof Swiper;
|
private slider: Swiper;
|
||||||
private maxScale: number;
|
private maxScale: number;
|
||||||
private zoomElement: HTMLElement;
|
private zoomElement: HTMLElement;
|
||||||
private zoomGesture: Gesture;
|
private zoomGesture: Gesture;
|
||||||
@ -187,6 +187,7 @@ export class Slides extends Ion {
|
|||||||
};
|
};
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
|
debugger;
|
||||||
var swiper = new Swiper(this.getNativeElement().children[0], options);
|
var swiper = new Swiper(this.getNativeElement().children[0], options);
|
||||||
this.slider = swiper;
|
this.slider = swiper;
|
||||||
});
|
});
|
||||||
|
12
ionic/components/slides/swiper-widget.d.ts
vendored
Normal file
12
ionic/components/slides/swiper-widget.d.ts
vendored
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
export declare class Swiper {
|
||||||
|
constructor(container: HTMLElement, params: any);
|
||||||
|
slides: Array<HTMLElement>;
|
||||||
|
activeIndex: number;
|
||||||
|
isEnd: boolean;
|
||||||
|
isBeginning: boolean;
|
||||||
|
|
||||||
|
update();
|
||||||
|
slideNext();
|
||||||
|
slidePrev();
|
||||||
|
|
||||||
|
}
|
@ -17,7 +17,9 @@
|
|||||||
/*===========================
|
/*===========================
|
||||||
Swiper
|
Swiper
|
||||||
===========================*/
|
===========================*/
|
||||||
export function Swiper(container, params): void {
|
module.exports.Swiper = Swiper;
|
||||||
|
|
||||||
|
function Swiper(container, params) {
|
||||||
|
|
||||||
|
|
||||||
if (!(this instanceof Swiper)) return new Swiper(container, params);
|
if (!(this instanceof Swiper)) return new Swiper(container, params);
|
289
ionic/components/slides/swiper-widget.system.js
Normal file
289
ionic/components/slides/swiper-widget.system.js
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user