Selaa lähdekoodia

Change build system.

NaotoshiFujita 3 vuotta sitten
vanhempi
commit
44eeaa0ab3
51 muutettua tiedostoa jossa 977 lisäystä ja 2567 poistoa
  1. 142 677
      dist/js/splide.cjs.js
  2. 140 674
      dist/js/splide.esm.js
  3. 99 597
      dist/js/splide.js
  4. 0 0
      dist/js/splide.js.map
  5. 1 1
      dist/js/splide.min.js
  6. BIN
      dist/js/splide.min.js.gz
  7. 0 0
      dist/js/splide.min.js.map
  8. 2 0
      dist/types/build/default.d.ts
  9. 1 1
      dist/types/build/default.d.ts.map
  10. 0 2
      dist/types/build/default/default.d.ts
  11. 1 1
      dist/types/components/Clones/Clones.d.ts.map
  12. 1 1
      dist/types/components/Elements/Elements.d.ts.map
  13. 3 3
      dist/types/components/LazyLoad/LazyLoad.d.ts
  14. 1 1
      dist/types/components/LazyLoad/LazyLoad.d.ts.map
  15. 1 1
      dist/types/components/Slides/Slide.d.ts.map
  16. 5 5
      dist/types/constructors/EventBus/EventBus.d.ts
  17. 1 1
      dist/types/constructors/EventBus/EventBus.d.ts.map
  18. 1 1
      dist/types/constructors/Throttle/Throttle.d.ts.map
  19. 3 3
      dist/types/core/Splide/Splide.d.ts
  20. 1 1
      dist/types/core/Splide/Splide.d.ts.map
  21. 7 0
      dist/types/utils/error/error/error.d.ts
  22. 1 0
      dist/types/utils/error/error/error.d.ts.map
  23. 1 0
      dist/types/utils/index.d.ts
  24. 1 1
      dist/types/utils/index.d.ts.map
  25. 0 55
      gulp/build-css.js
  26. 0 134
      gulp/build-script.js
  27. 0 10
      gulp/develop.js
  28. 0 11
      gulpfile.js
  29. 286 304
      package-lock.json
  30. 22 26
      package.json
  31. 12 0
      scripts/build-all.js
  32. 52 0
      scripts/build-css.js
  33. 29 0
      scripts/build-module.js
  34. 55 0
      scripts/build-script.js
  35. 0 0
      scripts/constants/banner.js
  36. 8 0
      scripts/develop.js
  37. 35 0
      scripts/plugins/minify.js
  38. 1 0
      src/js/build/default.ts
  39. 0 1
      src/js/build/default/default.ts
  40. 1 2
      src/js/components/Clones/Clones.ts
  41. 1 2
      src/js/components/Elements/Elements.ts
  42. 24 24
      src/js/components/LazyLoad/LazyLoad.ts
  43. 1 1
      src/js/components/Pagination/Pagination.ts
  44. 2 1
      src/js/components/Slides/Slide.ts
  45. 1 1
      src/js/components/Slides/test/slide.test.ts
  46. 15 9
      src/js/constructors/EventBus/EventBus.ts
  47. 13 13
      src/js/core/Splide/Splide.ts
  48. 1 1
      src/js/test/php/examples/default.php
  49. 1 1
      src/js/test/php/examples/lazyLoad.php
  50. 1 0
      src/js/utils/index.ts
  51. 3 0
      tsconfig.json

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 142 - 677
dist/js/splide.cjs.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 140 - 674
dist/js/splide.esm.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 99 - 597
dist/js/splide.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/js/splide.js.map


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 1 - 1
dist/js/splide.min.js


BIN
dist/js/splide.min.js.gz


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
dist/js/splide.min.js.map


+ 2 - 0
dist/types/build/default.d.ts

@@ -0,0 +1,2 @@
+export { Splide as default } from '../core/Splide/Splide';
+//# sourceMappingURL=../../../src/js/build/default.d.ts.map

+ 1 - 1
dist/types/build/default/default.d.ts.map → dist/types/build/default.d.ts.map

@@ -1 +1 @@
-{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["default.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,0BAA0B,CAAC"}
+{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["default.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,uBAAuB,CAAC"}

+ 0 - 2
dist/types/build/default/default.d.ts

@@ -1,2 +0,0 @@
-export { Splide as default } from '../../core/Splide/Splide';
-//# sourceMappingURL=../../../../src/js/build/default/default.d.ts.map

+ 1 - 1
dist/types/components/Clones/Clones.d.ts.map

@@ -1 +1 @@
-{"version":3,"file":"Clones.d.ts","sourceRoot":"","sources":["Clones.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKjE;;;;GAIG;AACH,MAAM,WAAW,cAAe,SAAQ,aAAa;CACpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAI,cAAc,CA8HjG"}
+{"version":3,"file":"Clones.d.ts","sourceRoot":"","sources":["Clones.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAIjE;;;;GAIG;AACH,MAAM,WAAW,cAAe,SAAQ,aAAa;CACpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,MAAM,CAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAI,cAAc,CA8HjG"}

+ 1 - 1
dist/types/components/Elements/Elements.d.ts.map

@@ -1 +1 @@
-{"version":3,"file":"Elements.d.ts","sourceRoot":"","sources":["Elements.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKjE;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,EAAE,WAAW,C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AU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAI,iBAAiB,CA4ItG"}

+ 3 - 3
dist/types/components/LazyLoad/LazyLoad.d.ts

@@ -14,9 +14,9 @@ export interface LazyLoadComponent extends BaseComponent {
  * @since 3.0.0
  */
 export interface LazyLoadImagesData {
-    img: HTMLImageElement;
-    spinner: HTMLSpanElement;
-    Slide: SlideComponent;
+    _img: HTMLImageElement;
+    _spinner: HTMLSpanElement;
+    _Slide: SlideComponent;
     src: string | null;
     srcset: string | null;
 }

+ 1 - 1
dist/types/components/LazyLoad/LazyLoad.d.ts.map

@@ -1 +1 @@
-{"version":3,"file":"LazyLoad.d.ts","sourceRoot":"","sources":["LazyLoad.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAYjE,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAIjD;;;;GAIG;AACH,MAAM,WAAW,iBAAkB,SAAQ,aAAa;CACvD;AAED;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,gBAAgB,CAAC;IACtB,OAAO,EAAE,eAAe,CAAC;IACzB,KAAK,EAAE,cAAc,CAAC;IACtB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,GAAI,iBAAiB,CAsItG"}
+{"version":3,"file":"LazyLoad.d.ts","sourceRoot":"","sources":["LazyLoad.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,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E,KAAK,EAAE,WAAW,GAAI,cAAc,CAkM7G"}
+{"version":3,"file":"Slide.d.ts","sourceRoot":"","sources":["Slide.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAmB5C;;;;GAIG;AACH,MAAM,WAAY,cAAe,SAAQ,aAAa;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,WAAW,CAAC;IACnB,SAAS,EAAE,WAAW,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,YAAY,CAAC,EAAE,OAAO,GAAI,IAAI,CAAA;IAC1E,QAAQ,CAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAI,OAAO,CAAC;CACrD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,KAAK,CAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAI,cAAc,CAkM7G"}

+ 5 - 5
dist/types/constructors/EventBus/EventBus.d.ts

@@ -17,11 +17,11 @@ export interface EventBusObject {
  * @since 3.0.0
  */
 export interface EventHandler {
-    event: string;
-    callback: AnyFunction;
-    namespace: string;
-    priority: number;
-    key?: object;
+    _event: string;
+    _callback: AnyFunction;
+    _namespace: string;
+    _priority: number;
+    _key?: object;
 }
 /**
  * The type for a callback function of the EventBus.

+ 1 - 1
dist/types/constructors/EventBus/EventBus.d.ts.map

@@ -1 +1 @@
-{"version":3,"file":"EventBus.d.ts","sourceRoot":"","sources":["EventBus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C;;;;GAIG;AACH,MAAM,WAAW,cAAc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AAC;IAC3B,IAAI,CAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAI,IAAI,CAAC;IAC5C,OAAO,IAAI,IAAI,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,WAAW,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,oBAAY,gBAAgB,GAAG,WAAW,CAAC;AAE3C;;;;;;GAMG;AACH,wBAAgB,QAAQ,IAAI,cAAc,CAkGzC"}

+ 1 - 1
dist/types/constructors/Throttle/Throttle.d.ts.map

@@ -1 +1 @@
-{"version":3,"file":"Throttle.d.ts","sourceRoot":"","sources":["Throttle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,QAAQ;IACvE,CAAE,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,GAAI,IAAI,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,WAAW,EAC5C,IAAI,EAAE,CAAC,EACP,QAAQ,CAAC,EAAE,MAAM,GAChB,gBAAgB,CAAC,CAAC,CAAC,CAerB"}
+{"version":3,"file":"Throttle.d.ts","sourceRoot":"","sources":["Throttle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C;;;;GAIG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,WAAW,CAAE,SAAQ,QAAQ;IACvE,CAAE,GAAG,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,GAAI,IAAI,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,WAAW,EAC5C,IAAI,EAAE,CAAC,EACP,QAAQ,CAAC,EAAE,MAAM,GAChB,gBAAgB,CAAC,CAAC,CAAC,CAgBrB"}

+ 3 - 3
dist/types/core/Splide/Splide.d.ts

@@ -44,15 +44,15 @@ export declare class Splide {
     /**
      * The collection of options.
      */
-    private readonly opts;
+    private readonly _options;
     /**
      * The collection of extensions.
      */
-    private Extensions;
+    private _Extensions;
     /**
      * The Transition component.
      */
-    private Transition;
+    private _Transition;
     /**
      * The Splide constructor.
      *

+ 1 - 1
dist/types/core/Splide/Splide.d.ts.map

@@ -1 +1 @@
-{"version":3,"file":"Splide.d.ts","sourceRoot":"","sources":["Splide.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAM9D,OAAO,EAAY,gBAAgB,EAAE,cAAc,EAAS,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEpG,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAIxE;;;;GAIG;AACH,qBAAa,MAAM;IACjB;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAM;IAE9B;;OAEG;IACH,MAAM,CAAC,QAAQ,CAAC,MAAM;;;;;;MAAU;IAEhC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAc;IAE5C;;OAEG;IACH,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAoB;IAEnD;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAoB;IAE/C;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAM;IAEhC;;OAEG;IACH,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAe;IAEpC;;OAEG;IACH,OAAO,CAAC,UAAU,CAA4C;IAE9D;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iCnG;;;;;;;;;;;;;;;;;OAiBG;IACH,IAAI,CAAE,MAAM,EAAE,MAAM,GAAI,IAAI;IAM5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiCG;IACH,EAAE,CAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAI,IAAI;IAIpC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,EAAE,CAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAI,IAAI;IAKtD;;;;;;;;;;;;;;;;;;OAkBG;IACH,GAAG,CAAE,MAAM,EAAE,MAAM,GAAI,IAAI;IAK3B;;;;;;;OAOG;IACH,IAAI,CAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,GAAI,IAAI;IAK3C;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG,CAAE,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,KAAK,CAAC,MAAM,GAAG,WAAW,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,GAAI,IAAI;IAKvF;;;;;OAKG;IACH,MAAM,CAAE,OAAO,EAAE,YAAY,GAAI,IAAI;IAKrC;;;;;;OAMG;IACH,EAAE,CAAE,IAAI,EAAE,MAAM,GAAI,OAAO;IAI3B;;;;OAIG;IACH,OAAO,IAAI,IAAI;IAKf;;;;;;OAMG;IACH,OAAO,CAAE,UAAU,CAAC,EAAE,OAAO,GAAI,IAAI;IAoBrC;;;;OAIG;IACH,IAAI,OAAO,IAAI,OAAO,CAErB;IAED;;;;OAIG;IACH,IAAI,OAAO,CAAE,OAAO,EAAE,OAAO,EAO5B;IAED;;;;OAIG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;;OAIG;IACH,IAAI,KAAK,IAAI,MAAM,CAElB;CACF"}

+ 7 - 0
dist/types/utils/error/error/error.d.ts

@@ -0,0 +1,7 @@
+/**
+ * Displays the error message on the console.
+ *
+ * @param message - A message.
+ */
+export declare function error(message: string): void;
+//# sourceMappingURL=../../../../../src/js/utils/error/error/error.d.ts.map

+ 1 - 0
dist/types/utils/error/error/error.d.ts.map

@@ -0,0 +1 @@
+{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["error.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,wBAAgB,KAAK,CAAE,OAAO,EAAE,MAAM,GAAI,IAAI,CAE7C"}

+ 1 - 0
dist/types/utils/index.d.ts

@@ -5,5 +5,6 @@ export * from './error';
 export * from './function';
 export * from './math';
 export * from './object';
+export * from './string';
 export * from './type/type';
 //# sourceMappingURL=../../../src/js/utils/index.d.ts.map

+ 1 - 1
dist/types/utils/index.d.ts.map

@@ -1 +1 @@
-{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC"}

+ 0 - 55
gulp/build-css.js

@@ -1,55 +0,0 @@
-const { src, dest } = require( 'gulp' );
-const sass         = require( 'gulp-dart-sass' );
-const postcss      = require( 'gulp-postcss' );
-const cssnano      = require( 'cssnano' );
-const autoprefixer = require( 'autoprefixer' );
-const rename       = require( 'gulp-rename' );
-const through      = require( 'through2' );
-const fs           = require( 'fs' );
-const path         = require( 'path' );
-
-function buildCss() {
-	return src( [
-		'./src/css/core/index.scss',
-		'./src/css/themes/default/index.scss',
-		'./src/css/themes/sea-green/index.scss',
-		'./src/css/themes/skyblue/index.scss',
-	], { base: 'src' } )
-		.pipe( sass() )
-		.pipe( postcss( [
-			cssnano( { reduceIdents: false } ),
-			autoprefixer(),
-		] ) )
-		.pipe( rename( path => {
-			const fragments = path.dirname.split( '\\' );
-			const dirname   = fragments.slice( 0, -1 ).join( '\\' );
-
-			return {
-				dirname,
-				basename: `splide-${ fragments[ fragments.length - 1 ] }.min`,
-				extname : '.css',
-			};
-		} ) )
-		.pipe( dest( 'dist' ) )
-		.pipe( copy() );
-}
-
-function copy() {
-	return through( { objectMode: true }, ( file, encoding, cb ) => {
-		if ( file.path.includes( 'splide-default' ) ) {
-			const result    = path.parse( file.path );
-			const fragments = result.dir.split( '\\' );
-			const dirname   = fragments.slice( 0, -1 ).join( '\\' );
-
-			fs.copyFile( file.path, `${ dirname }\\splide.min.css`, error => {
-				if ( error ) {
-					throw error;
-				}
-			} );
-		}
-
-		cb( null, file );
-	} );
-}
-
-exports.buildCss = buildCss;

+ 0 - 134
gulp/build-script.js

@@ -1,134 +0,0 @@
-const { parallel, src, dest } = require( 'gulp' );
-const rollup           = require( 'rollup' ).rollup;
-const typescript       = require( 'rollup-plugin-typescript2' );
-const rename           = require( 'ts-transformer-properties-rename' ).default;
-const uglify           = require( 'rollup-plugin-uglify' ).uglify;
-const babel            = require( '@rollup/plugin-babel' );
-const resolve          = require( '@rollup/plugin-node-resolve' ).nodeResolve;
-const gzip             = require( 'gulp-gzip' );
-const path             = require( 'path' );
-const banner           = require( './constants/banner' );
-const { promises: fs } = require( 'fs' );
-
-
-function buildScript( type, minify ) {
-	const file  = buildFilename( type, minify );
-	const input = `./src/js/build/${ type }/${ type }.ts`;
-
-	const plugins = [
-		resolve(),
-		typescript( {
-      transformers: [
-        service => ( {
-          before: [
-            rename( service.getProgram(), { internalPrefix: '' } ),
-          ],
-          after : [],
-        } ),
-      ],
-    } ),
-		babel.getBabelOutputPlugin( {
-			configFile: path.resolve( __dirname, '../.babelrc' ),
-			allowAllFormats: true,
-		} ),
-	];
-
-	if ( minify ) {
-		plugins.push(
-			uglify( {
-				output: {
-					comments: /^!/,
-				},
-				mangle: {
-					properties: {
-						regex: /^_(private)_/,
-					},
-				},
-			} ),
-		);
-	}
-
-	return rollup( { input, plugins } )
-		.then( bundle => {
-			return bundle.write( {
-				banner,
-				file,
-				format   : 'umd',
-				name     : 'Splide',
-				sourcemap: ! minify,
-			} );
-		} ).then( () => {
-			if ( minify ) {
-				return src( file )
-					.pipe( gzip() )
-					.pipe( dest( './dist/js/' ) );
-			}
-		} );
-}
-
-function buildFilename( type, minify ) {
-	if ( type === 'default' ) {
-		return `./dist/js/splide${ minify ? '.min' : '' }.js`;
-	}
-
-	return `./dist/js/splide-${ type }${ minify ? '.min' : '' }.js`;
-}
-
-function buildModule( format, declaration ) {
-  const declarationDir = './dist/types';
-
-  const options = declaration ? {
-    check: false,
-    useTsconfigDeclarationDir: true,
-    tsconfigOverride: {
-      compilerOptions: {
-        declarationDir,
-        declaration   : true,
-        declarationMap: true,
-      },
-    },
-  } : {};
-
-  return ( declaration ? fs.rmdir( declarationDir, { recursive: true } ) : Promise.resolve() ).then( () => {
-    return rollup( {
-      input  : './src/js/index.ts',
-      plugins: [
-        resolve(),
-        typescript( options ),
-        babel.getBabelOutputPlugin( {
-          presets: [
-            [
-              '@babel/preset-env',
-              {
-                modules: false,
-                loose  : true,
-              }
-            ]
-          ],
-          allowAllFormats: true,
-        } ),
-      ]
-    } ).then( bundle => {
-      return bundle.write( {
-        banner,
-        file  : `./dist/js/splide.${ format }.js`,
-        format,
-        exports: 'named',
-      } );
-    } );
-  } )
-}
-
-exports.buildDevCode = function buildDevCode() {
-  return buildScript( 'default' );
-}
-
-exports.buildScript = parallel(
-	function jsDefault() { return buildScript( 'default' ) },
-	function jsMinified() { return buildScript( 'default', true ) },
-);
-
-exports.buildModule = parallel(
-	function moduleCjs() { return buildModule( 'cjs' ) },
-	function moduleEsm() { return buildModule( 'esm', true ) },
-);

+ 0 - 10
gulp/develop.js

@@ -1,10 +0,0 @@
-const { watch } = require( 'gulp' );
-const { buildDevCode } = require( './build-script' );
-const { buildCss } = require( './build-css' );
-
-function develop() {
-  watch( [ 'src/js/**/*.ts', '!src/js/**/*.test.ts' ], buildDevCode );
-  watch( [ 'src/css/**/*.scss' ], buildCss );
-}
-
-exports.develop = develop;

+ 0 - 11
gulpfile.js

@@ -1,11 +0,0 @@
-const { parallel } = require( 'gulp' );
-const { develop } = require( './gulp/develop' );
-const { buildCss } = require( './gulp/build-css' );
-const { buildScript, buildModule } = require( './gulp/build-script' );
-
-
-exports[ 'develop' ]      = develop;
-exports[ 'build:js' ]     = buildScript;
-exports[ 'build:module' ] = buildModule;
-exports[ 'build:css' ]    = buildCss;
-exports[ 'build:all' ]    = parallel( buildScript, buildModule, buildCss );

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 286 - 304
package-lock.json


+ 22 - 26
package.json

@@ -24,45 +24,41 @@
     "url": "https://github.com/Splidejs/splide/issues"
   },
   "devDependencies": {
-    "@babel/core": "^7.15.0",
-    "@babel/preset-env": "^7.15.0",
+    "@babel/core": "^7.15.5",
+    "@babel/preset-env": "^7.15.6",
     "@rollup/plugin-babel": "^5.3.0",
     "@rollup/plugin-node-resolve": "^13.0.4",
     "@types/jest": "^27.0.1",
-    "@typescript-eslint/eslint-plugin": "^4.29.1",
-    "@typescript-eslint/parser": "^4.29.1",
-    "autoprefixer": "^10.3.1",
-    "babel-jest": "^27.0.6",
+    "@typescript-eslint/eslint-plugin": "^4.31.0",
+    "@typescript-eslint/parser": "^4.31.0",
+    "autoprefixer": "^10.3.4",
+    "babel-jest": "^27.1.1",
     "babel-loader": "^8.2.2",
-    "cssnano": "^5.0.7",
+    "cssnano": "^5.0.8",
+    "esbuild": "^0.12.26",
     "eslint": "^7.32.0",
-    "gulp": "^4.0.2",
-    "gulp-dart-sass": "^1.0.2",
-    "gulp-gzip": "^1.4.2",
-    "gulp-postcss": "^9.0.0",
-    "gulp-rename": "^2.0.0",
-    "gulp-rollup": "^2.17.0",
-    "jest": "^27.0.6",
+    "glob-watcher": "^5.0.5",
+    "jest": "^27.1.1",
     "postcss": "^8.3.6",
-    "rollup": "^2.56.2",
-    "rollup-plugin-typescript2": "^0.30.0",
-    "rollup-plugin-uglify": "^6.0.4",
+    "rollup": "^2.56.3",
+    "rollup-plugin-esbuild": "^4.5.0",
+    "sass": "^1.39.2",
     "stylelint": "^13.13.1",
     "stylelint-config-sass-guidelines": "^8.0.0",
     "stylelint-order": "^4.1.0",
     "stylelint-scss": "^3.20.1",
-    "through2": "^4.0.2",
-    "ts-jest": "^27.0.4",
-    "ts-transformer-properties-rename": "^0.11.0",
+    "ts-jest": "^27.0.5",
     "tslib": "^2.3.1",
-    "typescript": "^4.3.5"
+    "typescript": "^4.4.2",
+    "uglify-js": "^3.14.2"
   },
   "scripts": {
-    "develop": "gulp develop",
-    "build:js": "gulp build:js",
-    "build:module": "gulp build:module",
-    "build:css": "gulp build:css",
-    "build:all": "gulp build:all",
+    "develop": "node scripts/develop.js",
+    "build:js": "node scripts/build-script.js",
+    "build:module": "node scripts/build-module.js",
+    "build:types": "tsc --emitDeclarationOnly",
+    "build:css": "node scripts/build-css.js",
+    "build:all": "node scripts/build-all.js && npm run build:types",
     "jest": "jest --clearCache && jest",
     "eslint": "eslint src",
     "stylelint": "npx stylelint --fix ./src/css/**/*.scss"

+ 12 - 0
scripts/build-all.js

@@ -0,0 +1,12 @@
+const { buildJs, buildMin } = require( './build-script' );
+const { buildEsm, buildCjs } = require( './build-module' );
+const { buildCss } = require( './build-css' );
+
+
+Promise.all( [
+  buildJs(),
+  buildMin(),
+  buildEsm(),
+  buildCjs(),
+  buildCss(),
+] ).catch( e => console.error( e ) );

+ 52 - 0
scripts/build-css.js

@@ -0,0 +1,52 @@
+const sass         = require( 'sass' );
+const fs           = require( 'fs' ).promises;
+const path         = require( 'path' );
+const postcss      = require( 'postcss' );
+const cssnano      = require( 'cssnano' );
+const autoprefixer = require( 'autoprefixer' );
+const name         = 'splide';
+
+const files = [
+  './src/css/core/index.scss',
+  './src/css/themes/default/index.scss',
+  './src/css/themes/sea-green/index.scss',
+  './src/css/themes/skyblue/index.scss',
+];
+
+function buildCss( file ) {
+  const result  = sass.renderSync( { file, outputStyle: 'compressed' } );
+  const outFile = rename( file );
+
+  return postcss( [
+    cssnano( { reduceIdents: false } ),
+    autoprefixer(),
+  ] )
+    .process( result.css, { from: undefined } )
+    .then( result => {
+      result.warnings().forEach( warn => {
+        console.warn( warn.toString() );
+      } );
+
+      return fs.writeFile( outFile, result.css ).then( () => result );
+    } )
+    .then( result => {
+      if ( outFile.includes( 'splide-default' ) ) {
+        const dir = path.dirname( outFile ).split( '/' ).slice( 0, -1 ).join( '/' );
+        return fs.writeFile( `${ dir }/${ name }.min.css`, result.css ).then( () => result );
+      }
+    } );
+}
+
+function rename( file ) {
+  file = file.replace( './src/', '' );
+
+  const fragments = path.dirname( file ).split( '/' );
+  const dirname   = fragments.slice( 0, -1 ).join( '/' );
+  return `./dist/${ dirname }/${ name }-${ fragments[ fragments.length - 1 ] }.min.css`;
+}
+
+Promise.all( files.map( buildCss ) ).catch( e => console.error( e ) );
+
+exports.buildCss = () => {
+  files.forEach( buildCss );
+};

+ 29 - 0
scripts/build-module.js

@@ -0,0 +1,29 @@
+const rollup  = require( 'rollup' ).rollup;
+const resolve = require( '@rollup/plugin-node-resolve' ).nodeResolve;
+const esbuild = require( 'rollup-plugin-esbuild' );
+const banner  = require( './constants/banner' );
+const name    = 'splide';
+
+
+function buildModule( type ) {
+  return rollup( {
+    input: './src/js/index.ts',
+    plugins: [
+      resolve(),
+      esbuild(),
+    ]
+  } ).then( bundle => {
+    return bundle.write( {
+      banner,
+      file     : `./dist/js/${ name }.${ type }.js`,
+      format   : type,
+      sourcemap: false,
+      exports  : 'named',
+    } );
+  } );
+}
+
+Promise.all( [ buildModule( 'cjs' ), buildModule( 'esm' ) ] ).catch( e => console.error( e ) );
+
+exports.buildCjs = () => buildModule( 'cjs' );
+exports.buildEsm = () => buildModule( 'esm' );

+ 55 - 0
scripts/build-script.js

@@ -0,0 +1,55 @@
+const rollup   = require( 'rollup' ).rollup;
+const esbuild  = require( 'rollup-plugin-esbuild' );
+const babel    = require( '@rollup/plugin-babel' );
+const resolve  = require( '@rollup/plugin-node-resolve' ).nodeResolve;
+const path     = require( 'path' );
+const minify   = require( './plugins/minify' ).minify;
+const banner   = require( './constants/banner' );
+const fs       = require( 'fs' ).promises;
+const zlib     = require( 'zlib' );
+const name     = 'splide';
+
+
+function buildScript( compress ) {
+  const file = `./dist/js/${ name }${ compress ? '.min' : '' }.js`;
+
+  return rollup( {
+    input: './src/js/build/default.ts',
+    plugins: [
+      resolve(),
+      esbuild( { minify: false } ),
+      babel.getBabelOutputPlugin( {
+        configFile: path.resolve( __dirname, '../.babelrc' ),
+        allowAllFormats: true,
+      } ),
+      compress ? minify() : false,
+    ]
+  } ).then( bundle => {
+    return bundle.write( {
+      banner,
+      file,
+      format   : 'umd',
+      name     : 'Splide',
+      sourcemap: ! compress,
+    } );
+  } ).then( () => {
+    if ( compress ) {
+      return fs.readFile( file ).then( content => {
+        return new Promise( ( resolve, reject ) => {
+          zlib.gzip( content, ( err, binary ) => {
+            if ( err ) {
+              return reject( err );
+            }
+
+            fs.writeFile( `${ file }.gz`, binary ).then( resolve, reject );
+          } );
+        } );
+      } );
+    }
+  } );
+}
+
+Promise.all( [ buildScript(), buildScript( true ) ] ).catch( e => console.error( e ) )
+
+exports.buildJs  = () => buildScript();
+exports.buildMin = () => buildScript( true );

+ 0 - 0
gulp/constants/banner.js → scripts/constants/banner.js


+ 8 - 0
scripts/develop.js

@@ -0,0 +1,8 @@
+const watch = require( 'glob-watcher' );
+const { buildJs } = require( './build-script' );
+
+watch( [ './src/js/**/*.ts', '!*.test.ts' ], async () => {
+  console.log( 'Building...' );
+  await buildJs();
+  console.log( 'Finished' );
+} );

+ 35 - 0
scripts/plugins/minify.js

@@ -0,0 +1,35 @@
+const uglify = require( 'uglify-js' );
+
+const DEFAULTS = {
+  minify: {
+    sourceMap: false,
+    output: {
+      comments: /^!/,
+    },
+    toplevel: true,
+    mangle: {
+      properties: {
+        regex: /^_/,
+      },
+    },
+  },
+};
+
+function minify( pluginOptions = {} ) {
+  pluginOptions = { ...DEFAULTS, ...pluginOptions };
+
+  return {
+    name: 'minify',
+    renderChunk( code ) {
+      const result = uglify.minify( code, pluginOptions.minify );
+
+      if ( result.error ) {
+        throw new Error( result.error );
+      }
+
+      return result.code;
+    },
+  }
+}
+
+exports.minify = minify;

+ 1 - 0
src/js/build/default.ts

@@ -0,0 +1 @@
+export { Splide as default } from '../core/Splide/Splide';

+ 0 - 1
src/js/build/default/default.ts

@@ -1 +0,0 @@
-export { Splide as default } from '../../core/Splide/Splide';

+ 1 - 2
src/js/components/Clones/Clones.ts

@@ -3,8 +3,7 @@ import { LOOP } from '../../constants/types';
 import { EventInterface } from '../../constructors';
 import { Splide } from '../../core/Splide/Splide';
 import { BaseComponent, Components, Options } from '../../types';
-import { addClass, append, before, ceil, empty, push, rect, remove } from '../../utils';
-import { pad } from '../../utils/string';
+import { addClass, append, before, ceil, empty, pad, push, rect, remove } from '../../utils';
 
 
 /**

+ 1 - 2
src/js/components/Elements/Elements.ts

@@ -20,8 +20,7 @@ import { PROJECT_CODE } from '../../constants/project';
 import { EventInterface } from '../../constructors';
 import { Splide } from '../../core/Splide/Splide';
 import { BaseComponent, Components, Options } from '../../types';
-import { addClass, assert, assign, child, children, empty, push, query, removeClass } from '../../utils';
-import { uniqueId } from '../../utils/string';
+import { addClass, assert, assign, child, children, empty, push, query, removeClass, uniqueId } from '../../utils';
 
 
 /**

+ 24 - 24
src/js/components/LazyLoad/LazyLoad.ts

@@ -39,9 +39,9 @@ export interface LazyLoadComponent extends BaseComponent {
  * @since 3.0.0
  */
 export interface LazyLoadImagesData {
-  img: HTMLImageElement;
-  spinner: HTMLSpanElement;
-  Slide: SlideComponent;
+  _img: HTMLImageElement;
+  _spinner: HTMLSpanElement;
+  _Slide: SlideComponent;
   src: string | null;
   srcset: string | null;
 }
@@ -91,16 +91,16 @@ export function LazyLoad( Splide: Splide, Components: Components, options: Optio
    * Finds images that contain specific data attributes.
    */
   function init() {
-    Components.Slides.forEach( Slide => {
-      queryAll<HTMLImageElement>( Slide.slide, IMAGE_SELECTOR ).forEach( img => {
-        const src    = getAttribute( img, SRC_DATA_ATTRIBUTE );
-        const srcset = getAttribute( img, SRCSET_DATA_ATTRIBUTE );
-
-        if ( src !== img.src || srcset !== img.srcset ) {
-          const spinner = create( 'span', options.classes.spinner, img.parentElement );
-          setAttribute( spinner, ROLE, 'presentation' );
-          images.push( { img, Slide, src, srcset, spinner } );
-          display( img, 'none' );
+    Components.Slides.forEach( _Slide => {
+      queryAll<HTMLImageElement>( _Slide.slide, IMAGE_SELECTOR ).forEach( _img => {
+        const src    = getAttribute( _img, SRC_DATA_ATTRIBUTE );
+        const srcset = getAttribute( _img, SRCSET_DATA_ATTRIBUTE );
+
+        if ( src !== _img.src || srcset !== _img.srcset ) {
+          const _spinner = create( 'span', options.classes.spinner, _img.parentElement );
+          setAttribute( _spinner, ROLE, 'presentation' );
+          images.push( { _img, _Slide, src, srcset, _spinner } );
+          display( _img, 'none' );
         }
       } );
     } );
@@ -124,7 +124,7 @@ export function LazyLoad( Splide: Splide, Components: Components, options: Optio
    */
   function observe(): void {
     images = images.filter( data => {
-      if ( data.Slide.isWithin( Splide.index, options.perPage * ( ( options.preloadPages || 1 ) + 1 ) ) ) {
+      if ( data._Slide.isWithin( Splide.index, options.perPage * ( ( options.preloadPages || 1 ) + 1 ) ) ) {
         return load( data );
       }
 
@@ -142,15 +142,15 @@ export function LazyLoad( Splide: Splide, Components: Components, options: Optio
    * @param data - A LazyLoadImagesData object.
    */
   function load( data: LazyLoadImagesData ): void {
-    const { img } = data;
+    const { _img } = data;
 
-    addClass( data.Slide.slide, CLASS_LOADING );
-    bind( img, 'load error', e => { onLoad( data, e.type === 'error' ) } );
+    addClass( data._Slide.slide, CLASS_LOADING );
+    bind( _img, 'load error', e => { onLoad( data, e.type === 'error' ) } );
 
     [ 'src', 'srcset' ].forEach( name => {
       if ( data[ name ] ) {
-        setAttribute( img, name, data[ name ] );
-        removeAttribute( img, name === 'src' ? SRC_DATA_ATTRIBUTE : SRCSET_DATA_ATTRIBUTE );
+        setAttribute( _img, name, data[ name ] );
+        removeAttribute( _img, name === 'src' ? SRC_DATA_ATTRIBUTE : SRCSET_DATA_ATTRIBUTE );
       }
     } );
   }
@@ -162,14 +162,14 @@ export function LazyLoad( Splide: Splide, Components: Components, options: Optio
    * @param error - `true` if this method is called on error.
    */
   function onLoad( data: LazyLoadImagesData, error: boolean ): void {
-    const { Slide } = data;
+    const { _Slide } = data;
 
-    removeClass( Slide.slide, CLASS_LOADING );
+    removeClass( _Slide.slide, CLASS_LOADING );
 
     if ( ! error ) {
-      remove( data.spinner );
-      display( data.img, '' );
-      emit( EVENT_LAZYLOAD_LOADED, data.img, Slide );
+      remove( data._spinner );
+      display( data._img, '' );
+      emit( EVENT_LAZYLOAD_LOADED, data._img, _Slide );
       emit( EVENT_RESIZE );
     }
 

+ 1 - 1
src/js/components/Pagination/Pagination.ts

@@ -11,7 +11,7 @@ import { Splide } from '../../core/Splide/Splide';
 import { EventInterface } from '../../constructors';
 import { BaseComponent, Components, Options } from '../../types';
 import { addClass, ceil, create, empty, remove, removeAttribute, removeClass, setAttribute } from '../../utils';
-import { format } from '../../utils/string';
+import { format } from '../../utils';
 
 
 /**

+ 2 - 1
src/js/components/Slides/Slide.ts

@@ -38,16 +38,17 @@ import {
   ceil,
   child,
   floor,
+  format,
   hasClass,
   isHTMLButtonElement,
   min,
+  pad,
   rect,
   removeAttribute,
   removeClass,
   setAttribute,
   toggleClass,
 } from '../../utils';
-import { format, pad } from '../../utils/string';
 
 
 /**

+ 1 - 1
src/js/components/Slides/test/slide.test.ts

@@ -7,7 +7,7 @@ import {
   EVENT_VISIBLE,
 } from '../../../constants/events';
 import { fire, init, keydown } from '../../../test';
-import { format } from '../../../utils/string';
+import { format } from '../../../utils';
 import { SlideComponent } from '../Slide';
 
 

+ 15 - 9
src/js/constructors/EventBus/EventBus.ts

@@ -21,11 +21,11 @@ export interface EventBusObject {
  * @since 3.0.0
  */
 export interface EventHandler {
-  event: string;
-  callback: AnyFunction;
-  namespace: string;
-  priority: number;
-  key?: object;
+  _event: string;
+  _callback: AnyFunction;
+  _namespace: string;
+  _priority: number;
+  _key?: object;
 }
 
 /**
@@ -60,8 +60,14 @@ export function EventBus(): EventBusObject {
   function on( events: string | string[], callback: EventBusCallback, key?: object, priority = 10 ): void {
     forEachEvent( events, ( event, namespace ) => {
       handlers[ event ] = handlers[ event ] || [];
-      push( handlers[ event ], { event, callback, namespace, priority, key } )
-        .sort( ( handler1, handler2 ) => handler1.priority - handler2.priority );
+
+      push( handlers[ event ], {
+        _event    : event,
+        _callback : callback,
+        _namespace: namespace,
+        _priority : priority,
+        _key      : key,
+      } ).sort( ( handler1, handler2 ) => handler1._priority - handler2._priority );
     } );
   }
 
@@ -78,7 +84,7 @@ export function EventBus(): EventBusObject {
       const eventHandlers = handlers[ event ];
 
       handlers[ event ] = eventHandlers && eventHandlers.filter( handler => {
-        return handler.key ? handler.key !== key : handler.namespace !== namespace;
+        return handler._key ? handler._key !== key : handler._namespace !== namespace;
       } );
     } );
   }
@@ -103,7 +109,7 @@ export function EventBus(): EventBusObject {
   function emit( event: string ): void {
     ( handlers[ event ] || [] ).forEach( handler => {
       // eslint-disable-next-line prefer-rest-params, prefer-spread
-      handler.callback.apply( handler, slice( arguments, 1 ) );
+      handler._callback.apply( handler, slice( arguments, 1 ) );
     } );
   }
 

+ 13 - 13
src/js/core/Splide/Splide.ts

@@ -55,17 +55,17 @@ export class Splide {
   /**
    * The collection of options.
    */
-  private readonly opts: Options = {};
+  private readonly _options: Options = {};
 
   /**
    * The collection of extensions.
    */
-  private Extensions: Record<string, ComponentConstructor> = {};
+  private _Extensions: Record<string, ComponentConstructor> = {};
 
   /**
    * The Transition component.
    */
-  private Transition: ComponentConstructor;
+  private _Transition: ComponentConstructor;
 
   /**
    * The Splide constructor.
@@ -80,7 +80,7 @@ export class Splide {
     this.root = root;
 
     merge( DEFAULTS, Splide.defaults );
-    merge( merge( this.opts, DEFAULTS ), options || {} );
+    merge( merge( this._options, DEFAULTS ), options || {} );
   }
 
   /**
@@ -94,14 +94,14 @@ export class Splide {
   mount( Extensions?: Record<string, ComponentConstructor>, Transition?: ComponentConstructor ): this {
     this.state.set( CREATED );
 
-    this.Transition = Transition || this.Transition || ( this.is( FADE ) ? Fade : Slide );
-    this.Extensions = Extensions || this.Extensions;
+    this._Transition = Transition || this._Transition || ( this.is( FADE ) ? Fade : Slide );
+    this._Extensions = Extensions || this._Extensions;
 
-    const Constructors = assign( {}, ComponentConstructors, this.Extensions, { Transition: this.Transition } );
+    const Constructors = assign( {}, ComponentConstructors, this._Extensions, { Transition: this._Transition } );
     const { Components } = this;
 
     forOwn( Constructors, ( Component, key ) => {
-      const component = Component( this, this.Components, this.opts );
+      const component = Component( this, this.Components, this._options );
       Components[ key ] = component;
       component.setup && component.setup();
     } );
@@ -294,7 +294,7 @@ export class Splide {
    * @return `true` if the type matches the current one, or otherwise `false`.
    */
   is( type: string ): boolean {
-    return this.opts.type === type;
+    return this._options.type === type;
   }
 
   /**
@@ -340,7 +340,7 @@ export class Splide {
    * @return An object with the latest options.
    */
   get options(): Options {
-    return this.opts;
+    return this._options;
   }
 
   /**
@@ -349,11 +349,11 @@ export class Splide {
    * @param options - An object with new options.
    */
   set options( options: Options ) {
-    const { opts } = this;
-    merge( opts, options );
+    const { _options } = this;
+    merge( _options, options );
 
     if ( ! this.state.is( CREATED ) ) {
-      this.emit( EVENT_UPDATED, opts );
+      this.emit( EVENT_UPDATED, _options );
     }
   }
 

+ 1 - 1
src/js/test/php/examples/default.php

@@ -14,7 +14,7 @@ $settings = get_settings();
 
   <link rel="stylesheet" href="../../../../../dist/css/themes/splide-<?php echo $settings['theme'] ?>.min.css">
   <link rel="stylesheet" href="../../assets/css/styles.css">
-  <script type="text/javascript" src="../../../../../dist/js/splide.js"></script>
+  <script type="text/javascript" src="../../../../../dist/js/splide.min.js"></script>
 
   <script>
     document.addEventListener( 'DOMContentLoaded', function () {

+ 1 - 1
src/js/test/php/examples/lazyLoad.php

@@ -12,7 +12,7 @@ $settings = get_settings();
 
   <link rel="stylesheet" href="../../../../../dist/css/themes/splide-<?php echo $settings['theme'] ?>.min.css">
   <link rel="stylesheet" href="../../assets/css/styles.css">
-  <script src="../../../../../dist/js/splide.js"></script>
+  <script src="../../../../../dist/js/splide.min.js"></script>
 
   <script>
     document.addEventListener( 'DOMContentLoaded', function () {

+ 1 - 0
src/js/utils/index.ts

@@ -5,4 +5,5 @@ export * from './error';
 export * from './function';
 export * from './math';
 export * from './object';
+export * from './string';
 export * from './type/type';

+ 3 - 0
tsconfig.json

@@ -10,6 +10,9 @@
     "noImplicitAny": true,
     "suppressImplicitAnyIndexErrors": true,
     "allowJs": false,
+    "declarationDir": "./dist/types",
+    "declaration"   : true,
+    "declarationMap": true,
     "lib": [
       "dom",
       "es6"

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä