Переглянути джерело

Change the `Components` type to interface.

NaotoshiFujita 3 роки тому
батько
коміт
34675bc530

+ 1 - 1
dist/js/splide-renderer.min.js

@@ -1,6 +1,6 @@
 /*!
  * Splide.js
- * Version  : 3.5.2
+ * Version  : 3.5.3
  * License  : MIT
  * Copyright: 2021 Naotoshi Fujita
  */

+ 1 - 1
dist/js/splide.cjs.js

@@ -1,6 +1,6 @@
 /*!
  * Splide.js
- * Version  : 3.5.2
+ * Version  : 3.5.3
  * License  : MIT
  * Copyright: 2021 Naotoshi Fujita
  */

+ 1 - 1
dist/js/splide.esm.js

@@ -1,6 +1,6 @@
 /*!
  * Splide.js
- * Version  : 3.5.2
+ * Version  : 3.5.3
  * License  : MIT
  * Copyright: 2021 Naotoshi Fujita
  */

+ 1 - 1
dist/js/splide.js

@@ -4,7 +4,7 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
 
 /*!
  * Splide.js
- * Version  : 3.5.2
+ * Version  : 3.5.3
  * License  : MIT
  * Copyright: 2021 Naotoshi Fujita
  */

+ 1 - 1
dist/js/splide.min.js

@@ -1,7 +1,7 @@
 function xt(n,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(n,r.key,r)}}
 /*!
  * Splide.js
- * Version  : 3.5.2
+ * Version  : 3.5.3
  * License  : MIT
  * Copyright: 2021 Naotoshi Fujita
  */

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


+ 47 - 0
dist/types/types/components.d.ts

@@ -0,0 +1,47 @@
+import { ArrowsComponent } from '../components/Arrows/Arrows';
+import { AutoplayComponent } from '../components/Autoplay/Autoplay';
+import { ClonesComponent } from '../components/Clones/Clones';
+import { ControllerComponent } from '../components/Controller/Controller';
+import { CoverComponent } from '../components/Cover/Cover';
+import { DirectionComponent } from '../components/Direction/Direction';
+import { DragComponent } from '../components/Drag/Drag';
+import { ElementsComponent } from '../components/Elements/Elements';
+import { KeyboardComponent } from '../components/Keyboard/Keyboard';
+import { LayoutComponent } from '../components/Layout/Layout';
+import { LazyLoadComponent } from '../components/LazyLoad/LazyLoad';
+import { MoveComponent } from '../components/Move/Move';
+import { OptionsComponent } from '../components/Options/Options';
+import { PaginationComponent } from '../components/Pagination/Pagination';
+import { ScrollComponent } from '../components/Scroll/Scroll';
+import { SlidesComponent } from '../components/Slides/Slides';
+import { SyncComponent } from '../components/Sync/Sync';
+import { WheelComponent } from '../components/Wheel/Wheel';
+import { BaseComponent, TransitionComponent } from './general';
+/**
+ * The interface for components.
+ *
+ * @since 3.5.3
+ */
+export interface Components {
+    [key: string]: BaseComponent;
+    Options: OptionsComponent;
+    Direction: DirectionComponent;
+    Elements: ElementsComponent;
+    Slides: SlidesComponent;
+    Layout: LayoutComponent;
+    Clones: ClonesComponent;
+    Move: MoveComponent;
+    Controller: ControllerComponent;
+    Arrows: ArrowsComponent;
+    Autoplay: AutoplayComponent;
+    Cover: CoverComponent;
+    Scroll: ScrollComponent;
+    Drag: DragComponent;
+    Keyboard: KeyboardComponent;
+    LazyLoad: LazyLoadComponent;
+    Pagination: PaginationComponent;
+    Sync: SyncComponent;
+    Wheel: WheelComponent;
+    Transition: TransitionComponent;
+}
+//# sourceMappingURL=../../../src/js/types/components.d.ts.map

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

@@ -0,0 +1 @@
+{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MA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AU,EAAE,mBAAmB,CAAC;IAChC,IAAI,EAAE,aAAa,CAAC;IACpB,KAAK,EAAE,cAAc,CAAC;IACtB,UAAU,EAAE,mBAAmB,CAAC;CACjC"}

+ 1 - 11
dist/types/types/general.d.ts

@@ -1,5 +1,5 @@
-import * as CoreComponents from '../components';
 import { Splide } from '../core/Splide/Splide';
+import { Components } from './components';
 import { Options } from './options';
 /**
  * The type for any function.
@@ -32,16 +32,6 @@ export interface TransitionComponent extends BaseComponent {
     start(index: number, done: () => void): void;
     cancel(): void;
 }
-/**
- * The type for all component constructors.
- *
- * @since 3.0.0
- */
-export declare type Components = Record<string, BaseComponent> & Partial<{
-    [K in keyof typeof CoreComponents]: ReturnType<typeof CoreComponents[K]>;
-}> & {
-    Transition: TransitionComponent;
-};
 /**
  * The interface for info of a splide instance to sync with.
  *

+ 1 - 1
dist/types/types/general.d.ts.map

@@ -1 +1 @@
-{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["general.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;;;GAIG;AACH,oBAAY,WAAW,GAAG,CAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAM,GAAG,CAAC;AAEpD;;;;GAIG;AACH,oBAAY,oBAAoB,GAAG,CAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,KAAM,aAAa,CAAC;AAEjH;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,IAAI,IAAI,CAAC;IACf,KAAK,CAAC,IAAI,IAAI,CAAC;IACf,OAAO,CAAC,CAAE,UAAU,CAAC,EAAE,OAAO,GAAI,IAAI,CAAC;CACxC;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAoB,SAAQ,aAAa;IACxD,K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/C,MAAM,IAAI,IAAI,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}

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

@@ -1,3 +1,4 @@
+export * from './components';
 export * from './events';
 export * from './general';
 export * from './options';

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

@@ -1 +1 @@
-{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}
+{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC"}

+ 1 - 1
package-lock.json

@@ -1,6 +1,6 @@
 {
   "name": "@splidejs/splide",
-  "version": "3.5.2",
+  "version": "3.5.3",
   "lockfileVersion": 1,
   "requires": true,
   "dependencies": {

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "@splidejs/splide",
-  "version": "3.5.2",
+  "version": "3.5.3",
   "description": "Splide is a lightweight, flexible and accessible slider/carousel. No dependencies, no Lighthouse errors.",
   "author": "Naotoshi Fujita",
   "license": "MIT",

+ 0 - 10
src/js/test/php/examples/multiple.php

@@ -148,16 +148,6 @@ $settings = get_settings();
     }, { threshold: 0.8 } );
     observer.observe( elm );
   } );
-
-  // for ( let i = 0; i < elms.length; i++ ) {
-  //   const elm = elms[ i ];
-  //   const splide = new Splide( elm, { ...... } ).mount();
-  //   const Autoplay = splide.Components.Autoplay;
-  //   const observer = new IntersectionObserver( ( [ entry ] ) => {
-  //     entry.isIntersecting ? Autoplay.play() : Autoplay.pause();
-  //   } );
-  //   observer.observe( elm );
-  // }
 </script>
 
 </body>

+ 48 - 0
src/js/types/components.ts

@@ -0,0 +1,48 @@
+import { ArrowsComponent } from '../components/Arrows/Arrows';
+import { AutoplayComponent } from '../components/Autoplay/Autoplay';
+import { ClonesComponent } from '../components/Clones/Clones';
+import { ControllerComponent } from '../components/Controller/Controller';
+import { CoverComponent } from '../components/Cover/Cover';
+import { DirectionComponent } from '../components/Direction/Direction';
+import { DragComponent } from '../components/Drag/Drag';
+import { ElementsComponent } from '../components/Elements/Elements';
+import { KeyboardComponent } from '../components/Keyboard/Keyboard';
+import { LayoutComponent } from '../components/Layout/Layout';
+import { LazyLoadComponent } from '../components/LazyLoad/LazyLoad';
+import { MoveComponent } from '../components/Move/Move';
+import { OptionsComponent } from '../components/Options/Options';
+import { PaginationComponent } from '../components/Pagination/Pagination';
+import { ScrollComponent } from '../components/Scroll/Scroll';
+import { SlidesComponent } from '../components/Slides/Slides';
+import { SyncComponent } from '../components/Sync/Sync';
+import { WheelComponent } from '../components/Wheel/Wheel';
+import { BaseComponent, TransitionComponent } from './general';
+
+
+/**
+ * The interface for components.
+ *
+ * @since 3.5.3
+ */
+export interface Components {
+  [ key: string ]: BaseComponent;
+  Options: OptionsComponent;
+  Direction: DirectionComponent;
+  Elements: ElementsComponent;
+  Slides: SlidesComponent;
+  Layout: LayoutComponent;
+  Clones: ClonesComponent;
+  Move: MoveComponent;
+  Controller: ControllerComponent;
+  Arrows: ArrowsComponent;
+  Autoplay: AutoplayComponent;
+  Cover: CoverComponent;
+  Scroll: ScrollComponent;
+  Drag: DragComponent;
+  Keyboard: KeyboardComponent;
+  LazyLoad: LazyLoadComponent;
+  Pagination: PaginationComponent;
+  Sync: SyncComponent;
+  Wheel: WheelComponent;
+  Transition: TransitionComponent;
+}

+ 1 - 12
src/js/types/general.ts

@@ -1,5 +1,5 @@
-import * as CoreComponents from '../components';
 import { Splide } from '../core/Splide/Splide';
+import { Components } from './components';
 import { Options } from './options';
 
 
@@ -38,17 +38,6 @@ export interface TransitionComponent extends BaseComponent {
   cancel(): void;
 }
 
-/**
- * The type for all component constructors.
- *
- * @since 3.0.0
- */
-export type Components = Record<string, BaseComponent>
-  & Partial<{
-    [ K in keyof typeof CoreComponents ]: ReturnType<typeof CoreComponents[ K ]>;
-  }>
-  & { Transition: TransitionComponent }
-
 /**
  * The interface for info of a splide instance to sync with.
  *

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

@@ -1,3 +1,4 @@
+export * from './components';
 export * from './events';
 export * from './general';
 export * from './options';