فهرست منبع

Evaluate all components again when Splide is remounted.

NaotoshiFujita 5 سال پیش
والد
کامیت
716981d5ab
5فایلهای تغییر یافته به همراه44 افزوده شده و 26 حذف شده
  1. 15 9
      dist/js/splide.esm.js
  2. 15 9
      dist/js/splide.js
  3. 0 0
      dist/js/splide.min.js
  4. BIN
      dist/js/splide.min.js.gz
  5. 14 8
      src/js/splide.js

+ 15 - 9
dist/js/splide.esm.js

@@ -1494,6 +1494,9 @@ var splide_Splide = /*#__PURE__*/function () {
     this._o = merge(DEFAULTS, options);
     this._i = 0;
     this._c = Components;
+    this._e = {}; // Extensions
+
+    this._t = null; // Transition
   }
   /**
    * Compose and mount components.
@@ -1501,7 +1504,7 @@ var splide_Splide = /*#__PURE__*/function () {
    * @param {Object}   Extensions - Optional. Additional components.
    * @param {function} Transition - Optional. Set a custom transition component.
    *
-   * @return {Splide|null} - This instance or null if an exception occurred.
+   * @return {Splide|undefined} - This instance or undefined if an exception occurred.
    */
 
 
@@ -1511,14 +1514,16 @@ var splide_Splide = /*#__PURE__*/function () {
     var _this = this;
 
     if (Extensions === void 0) {
-      Extensions = {};
+      Extensions = this._e;
     }
 
     if (Transition === void 0) {
-      Transition = null;
+      Transition = this._t;
     }
 
-    this.Components = this.Components || compose(this, merge(this._c, Extensions), Transition);
+    this._e = Extensions;
+    this._t = Transition;
+    this.Components = compose(this, merge(this._c, Extensions), Transition);
 
     try {
       each(this.Components, function (component, key) {
@@ -1532,23 +1537,24 @@ var splide_Splide = /*#__PURE__*/function () {
       });
     } catch (e) {
       error_error(e.message);
-      return null;
+      return;
     }
 
-    this.State.set(MOUNTED);
+    var State = this.State;
+    State.set(MOUNTED);
     each(this.Components, function (component) {
       component.mounted && component.mounted();
     });
     this.emit('mounted');
-    this.State.set(IDLE);
+    State.set(IDLE);
     this.emit('ready');
     applyStyle(this.root, {
       visibility: 'visible'
     });
     this.on('move drag', function () {
-      return _this.State.set(MOVING);
+      return State.set(MOVING);
     }).on('moved dragged', function () {
-      return _this.State.set(IDLE);
+      return State.set(IDLE);
     });
     return this;
   }

+ 15 - 9
dist/js/splide.js

@@ -1484,6 +1484,9 @@ var splide_Splide = /*#__PURE__*/function () {
     this._o = merge(DEFAULTS, options);
     this._i = 0;
     this._c = Components;
+    this._e = {}; // Extensions
+
+    this._t = null; // Transition
   }
   /**
    * Compose and mount components.
@@ -1491,7 +1494,7 @@ var splide_Splide = /*#__PURE__*/function () {
    * @param {Object}   Extensions - Optional. Additional components.
    * @param {function} Transition - Optional. Set a custom transition component.
    *
-   * @return {Splide|null} - This instance or null if an exception occurred.
+   * @return {Splide|undefined} - This instance or undefined if an exception occurred.
    */
 
 
@@ -1501,14 +1504,16 @@ var splide_Splide = /*#__PURE__*/function () {
     var _this = this;
 
     if (Extensions === void 0) {
-      Extensions = {};
+      Extensions = this._e;
     }
 
     if (Transition === void 0) {
-      Transition = null;
+      Transition = this._t;
     }
 
-    this.Components = this.Components || compose(this, merge(this._c, Extensions), Transition);
+    this._e = Extensions;
+    this._t = Transition;
+    this.Components = compose(this, merge(this._c, Extensions), Transition);
 
     try {
       each(this.Components, function (component, key) {
@@ -1522,23 +1527,24 @@ var splide_Splide = /*#__PURE__*/function () {
       });
     } catch (e) {
       error_error(e.message);
-      return null;
+      return;
     }
 
-    this.State.set(MOUNTED);
+    var State = this.State;
+    State.set(MOUNTED);
     each(this.Components, function (component) {
       component.mounted && component.mounted();
     });
     this.emit('mounted');
-    this.State.set(IDLE);
+    State.set(IDLE);
     this.emit('ready');
     applyStyle(this.root, {
       visibility: 'visible'
     });
     this.on('move drag', function () {
-      return _this.State.set(MOVING);
+      return State.set(MOVING);
     }).on('moved dragged', function () {
-      return _this.State.set(IDLE);
+      return State.set(IDLE);
     });
     return this;
   }

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 0 - 0
dist/js/splide.min.js


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


+ 14 - 8
src/js/splide.js

@@ -41,6 +41,8 @@ export default class Splide {
 		this._o = merge( DEFAULTS, options );
 		this._i = 0;
 		this._c = Components;
+		this._e = {}; // Extensions
+		this._t = null; // Transition
 	}
 
 	/**
@@ -49,10 +51,13 @@ export default class Splide {
 	 * @param {Object}   Extensions - Optional. Additional components.
 	 * @param {function} Transition - Optional. Set a custom transition component.
 	 *
-	 * @return {Splide|null} - This instance or null if an exception occurred.
+	 * @return {Splide|undefined} - This instance or undefined if an exception occurred.
 	 */
-	mount( Extensions = {}, Transition = null ) {
-		this.Components = this.Components || compose( this, merge( this._c, Extensions ), Transition );
+	mount( Extensions = this._e, Transition = this._t ) {
+		this._e = Extensions;
+		this._t = Transition;
+
+		this.Components = compose( this, merge( this._c, Extensions ), Transition );
 
 		try {
 			each( this.Components, ( component, key ) => {
@@ -66,24 +71,25 @@ export default class Splide {
 			} );
 		} catch ( e ) {
 			error( e.message );
-			return null;
+			return;
 		}
 
-		this.State.set( STATES.MOUNTED );
+		const { State } = this;
+		State.set( STATES.MOUNTED );
 
 		each( this.Components, component => {
 			component.mounted && component.mounted();
 		} );
 
 		this.emit( 'mounted' );
-		this.State.set( STATES.IDLE );
+		State.set( STATES.IDLE );
 		this.emit( 'ready' );
 
 		applyStyle( this.root, { visibility: 'visible' } );
 
 		this
-			.on( 'move drag', () => this.State.set( STATES.MOVING ) )
-			.on( 'moved dragged', () => this.State.set( STATES.IDLE ) );
+			.on( 'move drag', () => State.set( STATES.MOVING ) )
+			.on( 'moved dragged', () => State.set( STATES.IDLE ) );
 
 		return this;
 	}

برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است