index.d.ts 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591
  1. /**
  2. * The interface for the Arrows component.
  3. *
  4. * @since 3.0.0
  5. */
  6. interface ArrowsComponent extends BaseComponent {
  7. arrows: {
  8. prev?: HTMLButtonElement;
  9. next?: HTMLButtonElement;
  10. };
  11. }
  12. /**
  13. * The interface for the Autoplay component.
  14. *
  15. * @since 3.0.0
  16. */
  17. interface AutoplayComponent extends BaseComponent {
  18. play(): void;
  19. pause(): void;
  20. isPaused(): boolean;
  21. }
  22. /**
  23. * The interface for the Clone component.
  24. *
  25. * @since 3.0.0
  26. */
  27. interface ClonesComponent extends BaseComponent {
  28. }
  29. /**
  30. * The interface for the Controller component.
  31. *
  32. * @since 3.0.0
  33. */
  34. interface ControllerComponent extends BaseComponent {
  35. go(control: number | string, allowSameIndex?: boolean, callback?: AnyFunction): void;
  36. scroll(destination: number, useIndex?: boolean, snap?: boolean, duration?: number, callback?: AnyFunction): void;
  37. getNext(destination?: boolean): number;
  38. getPrev(destination?: boolean): number;
  39. getAdjacent(prev: boolean, destination?: boolean): number;
  40. getEnd(): number;
  41. setIndex(index: number): void;
  42. getIndex(prev?: boolean): number;
  43. toIndex(page: number): number;
  44. toPage(index: number): number;
  45. toDest(position: number): number;
  46. hasFocus(): boolean;
  47. }
  48. /**
  49. * The interface for the Cover component.
  50. *
  51. * @since 3.0.0
  52. */
  53. interface CoverComponent extends BaseComponent {
  54. }
  55. /**
  56. * The interface for the Direction component.
  57. *
  58. * @since 3.0.0
  59. */
  60. interface DirectionComponent extends BaseComponent {
  61. resolve(prop: string, axisOnly?: boolean): string;
  62. orient(value: number): number;
  63. }
  64. /**
  65. * The interface for the Drag component.
  66. *
  67. * @since 3.0.0
  68. */
  69. interface DragComponent extends BaseComponent {
  70. disable(disabled: boolean): void;
  71. isDragging(): boolean;
  72. }
  73. /**
  74. * The interface for elements which the slider consists of.
  75. *
  76. * @since 3.0.0
  77. */
  78. interface ElementCollection {
  79. root: HTMLElement;
  80. slider: HTMLElement;
  81. track: HTMLElement;
  82. list: HTMLElement;
  83. slides: HTMLElement[];
  84. arrows: HTMLElement;
  85. prev: HTMLButtonElement;
  86. next: HTMLButtonElement;
  87. bar: HTMLElement;
  88. autoplay: HTMLElement;
  89. play: HTMLButtonElement;
  90. pause: HTMLButtonElement;
  91. }
  92. /**
  93. * The interface for the Elements component.
  94. *
  95. * @since 3.0.0
  96. */
  97. interface ElementsComponent extends BaseComponent, ElementCollection {
  98. }
  99. /**
  100. * The interface for the Keyboard component.
  101. *
  102. * @since 3.0.0
  103. */
  104. interface KeyboardComponent extends BaseComponent {
  105. disable(disabled: boolean): void;
  106. }
  107. /**
  108. * The interface for the Layout component.
  109. *
  110. * @since 3.0.0
  111. */
  112. interface LayoutComponent extends BaseComponent {
  113. listSize(): number;
  114. slideSize(index: number, withoutGap?: boolean): number;
  115. sliderSize(): number;
  116. totalSize(index?: number, withoutGap?: boolean): number;
  117. getPadding(right: boolean): number;
  118. }
  119. /**
  120. * The interface for the Slide sub component.
  121. *
  122. * @since 3.0.0
  123. */
  124. interface SlideComponent extends BaseComponent {
  125. index: number;
  126. slideIndex: number;
  127. slide: HTMLElement;
  128. container: HTMLElement;
  129. isClone: boolean;
  130. update(): void;
  131. style(prop: string, value: string | number, useContainer?: boolean): void;
  132. isWithin(from: number, distance: number): boolean;
  133. }
  134. /**
  135. * The interface for the LazyLoad component.
  136. *
  137. * @since 3.0.0
  138. */
  139. interface LazyLoadComponent extends BaseComponent {
  140. }
  141. /**
  142. * The interface for the Live component.
  143. *
  144. * @since 3.7.0
  145. */
  146. interface LiveComponent extends BaseComponent {
  147. disable(disabled: boolean): void;
  148. }
  149. /**
  150. * The interface for the Move component.
  151. *
  152. * @since 3.0.0
  153. */
  154. interface MoveComponent extends BaseComponent {
  155. move(dest: number, index: number, prev: number, callback?: AnyFunction): void;
  156. jump(index: number): void;
  157. translate(position: number, preventLoop?: boolean): void;
  158. shift(position: number, backwards: boolean): number;
  159. cancel(): void;
  160. toIndex(position: number): number;
  161. toPosition(index: number, trimming?: boolean): number;
  162. getPosition(): number;
  163. getLimit(max: boolean): number;
  164. isBusy(): boolean;
  165. exceededLimit(max?: boolean | undefined, position?: number): boolean;
  166. }
  167. /**
  168. * The interface for the Options component.
  169. *
  170. * @since 3.0.0
  171. */
  172. interface OptionsComponent extends BaseComponent {
  173. }
  174. /**
  175. * The interface for the Pagination component.
  176. *
  177. * @since 3.0.0
  178. */
  179. interface PaginationComponent extends BaseComponent {
  180. items: PaginationItem[];
  181. getAt(index: number): PaginationItem;
  182. update(): void;
  183. }
  184. /**
  185. * The interface for data of the pagination.
  186. *
  187. * @since 3.0.0
  188. */
  189. interface PaginationData {
  190. list: HTMLUListElement;
  191. items: PaginationItem[];
  192. }
  193. /**
  194. * The interface for each pagination item.
  195. *
  196. * @since 3.0.0
  197. */
  198. interface PaginationItem {
  199. li: HTMLLIElement;
  200. button: HTMLButtonElement;
  201. page: number;
  202. }
  203. /**
  204. * The interface for the Scroll component.
  205. *
  206. * @since 3.0.0
  207. */
  208. interface ScrollComponent extends BaseComponent {
  209. scroll(position: number, duration?: number, callback?: AnyFunction): void;
  210. cancel(): void;
  211. }
  212. /**
  213. * The interface for the Sync component.
  214. *
  215. * @since 3.0.0
  216. */
  217. interface SyncComponent extends BaseComponent {
  218. remount(): void;
  219. }
  220. /**
  221. * The interface for the Wheel component.
  222. *
  223. * @since 3.0.0
  224. */
  225. interface WheelComponent extends BaseComponent {
  226. }
  227. /**
  228. * The collection of i18n strings.
  229. *
  230. * @since 3.0.0
  231. */
  232. declare const I18N: {
  233. prev: string;
  234. next: string;
  235. first: string;
  236. last: string;
  237. slideX: string;
  238. pageX: string;
  239. play: string;
  240. pause: string;
  241. carousel: string;
  242. slide: string;
  243. slideLabel: string;
  244. };
  245. /**
  246. * The interface for options.
  247. *
  248. * @since 3.0.0
  249. */
  250. interface Options extends ResponsiveOptions {
  251. /**
  252. * The type of the slider.
  253. * - 'slide': A slider with the slide transition
  254. * - 'loop' : A carousel slider
  255. * - 'fade' : A slider with the fade transition. This does not support the perPage option.
  256. */
  257. type?: string;
  258. /**
  259. * The `role` attribute for the root element.
  260. * If the tag is `<section>`, this value will not be used. The default value is `'region'`.
  261. */
  262. role?: string;
  263. /**
  264. * Determines whether to disable any actions while the slider is transitioning.
  265. * Even if `false`, the slider forcibly waits for transition on the loop points.
  266. */
  267. waitForTransition?: boolean;
  268. /**
  269. * If `true`, the width of slides are determined by their width.
  270. * The `perPage` and `perMove` options should be `1`.
  271. */
  272. autoWidth?: boolean;
  273. /**
  274. * If `true`, the height of slides are determined by their height.
  275. * The `perPage` and `perMove` options should be `1`.
  276. */
  277. autoHeight?: boolean;
  278. /**
  279. * The start index.
  280. */
  281. start?: number;
  282. /**
  283. * Changes the arrow SVG path, like 'm7.61 0.807-2.12...'.
  284. */
  285. arrowPath?: string;
  286. /**
  287. * Determines whether to activate autoplay or not.
  288. * If `paused`, it will not begin when the slider becomes active.
  289. * You need to provided play/pause buttons or manually start it by `Autoplay#play()`.
  290. */
  291. autoplay?: boolean | 'pause';
  292. /**
  293. * The autoplay interval in milliseconds.
  294. */
  295. interval?: number;
  296. /**
  297. * Determines whether to pause autoplay on mouseover.
  298. */
  299. pauseOnHover?: boolean;
  300. /**
  301. * Determines whether to pause autoplay when the slider contains the active element (focused element).
  302. * This should be `true` for accessibility.
  303. */
  304. pauseOnFocus?: boolean;
  305. /**
  306. * Determines whether to reset the autoplay progress when it is requested to start again.
  307. */
  308. resetProgress?: boolean;
  309. /**
  310. * Enables lazy loading.
  311. * Provide the `src` by the `data-splide-lazy` or the `srcset` by the `data-splide-lazy-srcset`.
  312. * You may also provide `src` for the placeholder, but the value must be different with the data.
  313. *
  314. * - `false`: Disables lazy loading
  315. * - `'nearby'`: Starts loading only images around the active slide (page)
  316. * - `'sequential'`: Loads images sequentially
  317. */
  318. lazyLoad?: boolean | 'nearby' | 'sequential';
  319. /**
  320. * Determine how many pages (not slides) around the active slide should be loaded beforehand.
  321. * This only works when the `lazyLoad` option is `'nearby'`.
  322. */
  323. preloadPages?: number;
  324. /**
  325. * Determines whether to enable keyboard shortcuts or not.
  326. * - `true` or `'global'`: Listens to the `keydown` event of the document.
  327. * - 'focused': Listens to the `keydown` event of the slider root element with adding `tabindex="0"` to it.
  328. * - `false`: Disables keyboard shortcuts.
  329. */
  330. keyboard?: boolean | string;
  331. /**
  332. * Enables navigation by the mouse wheel.
  333. * The `waitForTransition` option should be `true`.
  334. */
  335. wheel?: boolean;
  336. /**
  337. * Determines whether to release the wheel event when the slider reaches the first or last slide.
  338. */
  339. releaseWheel?: boolean;
  340. /**
  341. * The direction of the slider.
  342. * - 'ltr': Left to right
  343. * - 'rtl': Right to left
  344. * - 'ttb': Top to bottom
  345. */
  346. direction?: 'ltr' | 'rtl' | 'ttb';
  347. /**
  348. * Converts the image `src` to the css `background-image` URL of the parent element.
  349. * This requires `fixedHeight` or `heightRatio` option.
  350. */
  351. cover?: boolean;
  352. /**
  353. * Determines whether to add `tabindex="0"` to visible slides or not.
  354. */
  355. slideFocus?: boolean;
  356. /**
  357. * If `true`, the slider makes slides clickable to navigate another slider.
  358. * Use `Splide#sync()` to sync multiple sliders.
  359. */
  360. isNavigation?: boolean;
  361. /**
  362. * Determines whether to trim spaces before/after the slider if the `focus` option is available.
  363. * - `true`: Trims spaces. The slider may stay on the same location even when requested to move.
  364. * - `'move'`: Trims spaces and focuses to move the slider when requested.
  365. */
  366. trimSpace?: boolean | 'move';
  367. /**
  368. * Updates the `is-active` status of slides just before moving the slider.
  369. */
  370. updateOnMove?: boolean;
  371. /**
  372. * If `min`, the media query for breakpoints will be `min-width`, or otherwise, `max-width`.
  373. */
  374. mediaQuery?: 'min' | 'max';
  375. /**
  376. * The selector to get focusable elements
  377. * where `tabindex="-1"` will be assigned when their ascendant slide is hidden.
  378. */
  379. focusableNodes?: string;
  380. /**
  381. * The selector for nodes that cannot be dragged.
  382. */
  383. noDrag?: string;
  384. /**
  385. * Enables the live region by `aria-live`.
  386. * If `true`, screen readers will read a content of each slide whenever slide changes.
  387. */
  388. live?: boolean;
  389. /**
  390. * Determines whether to use the Transition component or not.
  391. */
  392. useScroll?: boolean;
  393. /**
  394. * Options for specific breakpoints.
  395. *
  396. * @example
  397. * ```ts
  398. * {
  399. * 1000: {
  400. * perPage: 3,
  401. * gap : 20
  402. * },
  403. * 600: {
  404. * perPage: 1,
  405. * gap : 5,
  406. * },
  407. * }
  408. * ```
  409. */
  410. breakpoints?: Record<string | number, ResponsiveOptions>;
  411. /**
  412. * The collection of class names.
  413. */
  414. classes?: Record<string, string>;
  415. /**
  416. * The collection of i18n strings.
  417. */
  418. i18n?: Record<keyof typeof I18N | string, string>;
  419. }
  420. /**
  421. * The interface for options that can correspond with breakpoints.
  422. *
  423. * @since 3.0.0
  424. */
  425. interface ResponsiveOptions {
  426. /**
  427. * Accepts arbitrary properties for extensions, although it's not ideal typing.
  428. */
  429. [key: string]: any;
  430. /**
  431. * The transition speed in milliseconds.
  432. */
  433. speed?: number;
  434. /**
  435. * Determines whether to rewind the slider or not.
  436. */
  437. rewind?: boolean;
  438. /**
  439. * The transition speed on rewind in milliseconds.
  440. */
  441. rewindSpeed?: number;
  442. /**
  443. * Allows to rewind by drag.
  444. * The slider `type` must be `slide` (or `undefined`) and the `drag` option must be enabled.
  445. */
  446. rewindByDrag?: boolean;
  447. /**
  448. * Defines the slider max width, accepting the CSS format such as 10em, 80vw.
  449. */
  450. width?: number | string;
  451. /**
  452. * Defines the slider height, accepting the CSS format.
  453. */
  454. height?: number | string;
  455. /**
  456. * Fixes width of slides, accepting the CSS format.
  457. * The slider will ignore the `perPage` option if you provide this value.
  458. */
  459. fixedWidth?: number | string;
  460. /**
  461. * Fixes height of slides, accepting the CSS format.
  462. * The slider will ignore the `heightRatio` option if you provide this value.
  463. */
  464. fixedHeight?: number | string;
  465. /**
  466. * Determines height of slides by the ratio to the slider width.
  467. * For example, when the slider width is `1000` and the ratio is `0.5`, the height will be `500`.
  468. */
  469. heightRatio?: number;
  470. /**
  471. * Determines the number of slides to display in a page.
  472. */
  473. perPage?: number;
  474. /**
  475. * Determines the number of slides to move at once.
  476. */
  477. perMove?: number;
  478. /**
  479. * Determine the number of clones on each side of the slider.
  480. * In most cases, you don't need to provide this value.
  481. */
  482. clones?: number;
  483. /**
  484. * Determines whether to clone status classes for clones or not.
  485. */
  486. cloneStatus?: boolean;
  487. /**
  488. * Determines which slide should be active if there are multiple slides in a page.
  489. * Numbers and `'center'` are acceptable.
  490. */
  491. focus?: number | 'center';
  492. /**
  493. * The gap between slides. The CSS format is acceptable, such as `1em`.
  494. */
  495. gap?: number | string;
  496. /**
  497. * Sets padding left/right or top/bottom of the slider.
  498. * The CSS format is acceptable, such as `1em`.
  499. *
  500. * @example
  501. * ```ts
  502. * // By number
  503. * padding: 10,
  504. *
  505. * // By the CSS format
  506. * padding: '1rem',
  507. *
  508. * // Specifies each value for a horizontal slider
  509. * padding: { left: 10, right: 20 },
  510. * padding: { left: '1rem', right: '2rem' },
  511. *
  512. * // Specified each value for a vertical slider
  513. * padding: { top: 10, bottom: 20 },
  514. * ```
  515. */
  516. padding?: number | string | {
  517. left?: number | string;
  518. right?: number | string;
  519. } | {
  520. top?: number | string;
  521. bottom?: number | string;
  522. };
  523. /**
  524. * Determines whether to create/find arrows or not.
  525. */
  526. arrows?: boolean | 'slider';
  527. /**
  528. * Determines whether to create pagination (indicator dots) or not.
  529. */
  530. pagination?: boolean | 'slider';
  531. /**
  532. * The timing function for the CSS transition. For example, `linear`, ease or `cubic-bezier()`.
  533. */
  534. easing?: string;
  535. /**
  536. * The easing function for the drag free mode.
  537. * The default function is the `easeOutQuart` interpolation.
  538. */
  539. easingFunc?: (t: number) => number;
  540. /**
  541. * Allows to drag the slider by a mouse or swipe.
  542. * If `free`, the slider does not snap to a slide after drag.
  543. */
  544. drag?: boolean | 'free';
  545. /**
  546. * The required distance to start moving the slider by the touch action.
  547. * If you want to define the threshold for the mouse, provide an object.
  548. */
  549. dragMinThreshold?: number | {
  550. mouse: number;
  551. touch: number;
  552. };
  553. /**
  554. * Determine the power of "flick". The larger number this is, the farther the slider runs.
  555. * Around 500 is recommended.
  556. */
  557. flickPower?: number;
  558. /**
  559. * Limits the number of pages to move by "flick".
  560. */
  561. flickMaxPages?: number;
  562. /**
  563. * Destroys the slider.
  564. */
  565. destroy?: boolean | 'completely';
  566. }
  567. /**
  568. * The type for any function.
  569. *
  570. * @since 3.0.0
  571. */
  572. declare type AnyFunction = (...args: any[]) => any;
  573. /**
  574. * The type for a component.
  575. *
  576. * @since 3.0.0
  577. */
  578. declare type ComponentConstructor = (Splide: Splide, Components: Components, options: Options) => BaseComponent;
  579. /**
  580. * The interface for any component.
  581. *
  582. * @since 3.0.0
  583. */
  584. interface BaseComponent {
  585. setup?(): void;
  586. mount?(): void;
  587. destroy?(completely?: boolean): void;
  588. }
  589. /**
  590. * The interface for the Transition component.
  591. *
  592. * @since 3.0.0
  593. */
  594. interface TransitionComponent extends BaseComponent {
  595. start(index: number, done: () => void): void;
  596. cancel(): void;
  597. }
  598. /**
  599. * The interface for info of a splide instance to sync with.
  600. *
  601. * @since 3.2.8
  602. */
  603. interface SyncTarget {
  604. splide: Splide;
  605. isParent?: boolean;
  606. }
  607. /**
  608. * The interface for all components.
  609. *
  610. * @since 3.0.0
  611. */
  612. interface Components {
  613. [key: string]: BaseComponent;
  614. Options: OptionsComponent;
  615. Direction: DirectionComponent;
  616. Elements: ElementsComponent;
  617. Slides: SlidesComponent;
  618. Layout: LayoutComponent;
  619. Clones: ClonesComponent;
  620. Move: MoveComponent;
  621. Controller: ControllerComponent;
  622. Arrows: ArrowsComponent;
  623. Autoplay: AutoplayComponent;
  624. Cover: CoverComponent;
  625. Scroll: ScrollComponent;
  626. Drag: DragComponent;
  627. Keyboard: KeyboardComponent;
  628. LazyLoad: LazyLoadComponent;
  629. Pagination: PaginationComponent;
  630. Sync: SyncComponent;
  631. Wheel: WheelComponent;
  632. Live: LiveComponent;
  633. Transition: TransitionComponent;
  634. }
  635. /**
  636. * The interface for all internal events.
  637. *
  638. * @since 3.0.0
  639. */
  640. interface EventMap {
  641. 'mounted': () => void;
  642. 'ready': () => void;
  643. 'click': (Slide: SlideComponent, e: MouseEvent) => void;
  644. 'move': (index: number, prev: number, dest: number) => void;
  645. 'moved': (index: number, prev: number, dest: number) => void;
  646. 'shifted': () => void;
  647. 'active': (Slide: SlideComponent) => void;
  648. 'inactive': (Slide: SlideComponent) => void;
  649. 'visible': (Slide: SlideComponent) => void;
  650. 'hidden': (Slide: SlideComponent) => void;
  651. 'slide:keydown': (Slide: SlideComponent, e: KeyboardEvent) => void;
  652. 'refresh': () => void;
  653. 'updated': (options: Options) => void;
  654. 'resize': () => void;
  655. 'resized': () => void;
  656. 'drag': () => void;
  657. 'dragging': () => void;
  658. 'dragged': () => void;
  659. 'scroll': () => void;
  660. 'scrolled': () => void;
  661. 'destroy': () => void;
  662. 'arrows:mounted': (prev: HTMLButtonElement, next: HTMLButtonElement) => void;
  663. 'arrows:updated': (prev: HTMLButtonElement, next: HTMLButtonElement, prevIndex: number, nextIndex: number) => void;
  664. 'pagination:mounted': (data: PaginationData, item: PaginationItem) => void;
  665. 'pagination:updated': (data: PaginationData, prev: PaginationItem, curr: PaginationItem) => void;
  666. 'navigation:mounted': (splides: Splide[]) => void;
  667. 'autoplay:play': () => void;
  668. 'autoplay:playing': (rate: number) => void;
  669. 'autoplay:pause': () => void;
  670. 'lazyload:loaded': (img: HTMLImageElement, Slide: SlideComponent) => void;
  671. }
  672. /**
  673. * Casts T to U.
  674. *
  675. * @internal
  676. */
  677. declare type Cast<T, U> = T extends U ? T : U;
  678. /**
  679. * Pushes U to tuple T.
  680. *
  681. * @internal
  682. */
  683. declare type Push<T extends any[], U = any> = [...T, U];
  684. /**
  685. * Removes the first type from the tuple T.
  686. *
  687. * @internal
  688. */
  689. declare type Shift<T extends any[]> = ((...args: T) => any) extends (arg: any, ...args: infer A) => any ? A : never;
  690. /**
  691. * Removes the N types from the tuple T.
  692. *
  693. * @internal
  694. */
  695. declare type ShiftN<T extends any[], N extends number, C extends any[] = []> = {
  696. 0: T;
  697. 1: ShiftN<Shift<T>, N, Push<C>>;
  698. }[C['length'] extends N ? 0 : 1] extends infer A ? Cast<A, any[]> : never;
  699. /**
  700. * The interface for the Slides component.
  701. *
  702. * @since 3.0.0
  703. */
  704. interface SlidesComponent extends BaseComponent {
  705. update(): void;
  706. register(slide: HTMLElement, index: number, slideIndex: number): void;
  707. get(excludeClones?: boolean): SlideComponent[];
  708. getIn(page: number): SlideComponent[];
  709. getAt(index: number): SlideComponent | undefined;
  710. add(slide: string | Element | Array<string | Element>, index?: number): void;
  711. remove(selector: SlideMatcher): void;
  712. forEach(iteratee: SlidesIteratee, excludeClones?: boolean): void;
  713. filter(matcher: SlideMatcher): SlideComponent[];
  714. style(prop: string, value: string | number, useContainer?: boolean): void;
  715. getLength(excludeClones?: boolean): number;
  716. isEnough(): boolean;
  717. }
  718. /**
  719. * The iteratee function for Slides.
  720. *
  721. * @since 3.0.0
  722. */
  723. declare type SlidesIteratee = (Slide: SlideComponent, index: number, Slides: SlideComponent[]) => void;
  724. /**
  725. * The predicate function for Slides.
  726. *
  727. * @since 3.0.0
  728. */
  729. declare type SlidesPredicate = (Slide: SlideComponent, index: number, Slides: SlideComponent[]) => any;
  730. /**
  731. * The type for filtering SlideComponent objects.
  732. *
  733. * @since 3.0.0
  734. */
  735. declare type SlideMatcher = number | number[] | string | SlidesPredicate;
  736. /**
  737. * The interface for the EventBus instance.
  738. *
  739. * @since 3.0.0
  740. */
  741. interface EventBusObject {
  742. on(events: string | string[], callback: EventBusCallback, key?: object, priority?: number): void;
  743. off(events: string | string[], key?: object): void;
  744. offBy(key: object): void;
  745. emit(event: string, ...args: any[]): void;
  746. destroy(): void;
  747. }
  748. /**
  749. * The interface for each event handler object.
  750. *
  751. * @since 3.0.0
  752. */
  753. interface EventHandler {
  754. _event: string;
  755. _callback: AnyFunction;
  756. _namespace: string;
  757. _priority: number;
  758. _key?: object;
  759. }
  760. /**
  761. * The type for a callback function of the EventBus.
  762. *
  763. * @since 3.0.0
  764. */
  765. declare type EventBusCallback = AnyFunction;
  766. /**
  767. * The constructor to provided a simple event system.
  768. *
  769. * @since 3.0.0
  770. *
  771. * @return An EventBus object.
  772. */
  773. declare function EventBus(): EventBusObject;
  774. /**
  775. * The interface for the EventInterface object.
  776. *
  777. * @since 3.0.0
  778. */
  779. interface EventInterfaceObject {
  780. on<K extends keyof EventMap>(event: K, callback: EventMap[K], priority?: number): void;
  781. on(events: string | string[], callback: EventBusCallback, priority?: number): void;
  782. off<K extends keyof EventMap>(events: K | K[] | string | string[]): void;
  783. emit<K extends keyof EventMap>(event: K, ...args: Parameters<EventMap[K]>): void;
  784. emit(event: string, ...args: any[]): void;
  785. bind(target: Element | Window | Document | Array<Element | Window | Document>, events: string, callback: AnyFunction, options?: AddEventListenerOptions): void;
  786. unbind(target: Element | Window | Document | Array<Element | Window | Document>, events: string, callback?: AnyFunction): void;
  787. destroy(): void;
  788. }
  789. /**
  790. * The function that provides interface for internal and native events.
  791. *
  792. * @since 3.0.0
  793. *
  794. * @param Splide - A Splide instance.
  795. *
  796. * @return A collection of interface functions.
  797. */
  798. declare function EventInterface(Splide: Splide): EventInterfaceObject;
  799. /**
  800. * The interface for the returning value of the RequestInterval.
  801. *
  802. * @since 3.0.0
  803. */
  804. interface RequestIntervalInterface {
  805. start(resume?: boolean): void;
  806. pause(): void;
  807. rewind(): void;
  808. cancel(): void;
  809. set(interval: number): void;
  810. isPaused(): boolean;
  811. }
  812. /**
  813. * Requests interval like the native `setInterval()` with using `requestAnimationFrame`.
  814. *
  815. * @since 3.0.0
  816. *
  817. * @param interval - The interval duration in milliseconds.
  818. * @param onInterval - The callback fired on every interval.
  819. * @param onUpdate - Optional. Called on every animation frame, taking the progress rate.
  820. * @param limit - Optional. Limits the number of interval.
  821. */
  822. declare function RequestInterval(interval: number, onInterval: () => void, onUpdate?: (rate: number) => void, limit?: number): RequestIntervalInterface;
  823. /**
  824. * The interface for the State object.
  825. *
  826. * @since 3.0.0
  827. */
  828. interface StateObject {
  829. set(state: number): void;
  830. is(states: number | number[]): boolean;
  831. }
  832. /**
  833. * The function providing a super simple state system.
  834. *
  835. * @param initialState - Specifies the initial state.
  836. */
  837. declare function State(initialState: number): StateObject;
  838. /**
  839. * The interface for the returning value of the RequestInterval.
  840. *
  841. * @since 3.0.0
  842. */
  843. interface ThrottleInstance<F extends AnyFunction> extends Function {
  844. (...args: Parameters<F>): void;
  845. }
  846. /**
  847. * Returns the throttled function.
  848. *
  849. * @param func - A function to throttle.
  850. * @param duration - Optional. Throttle duration in milliseconds.
  851. *
  852. * @return A throttled function.
  853. */
  854. declare function Throttle<F extends AnyFunction>(func: F, duration?: number): ThrottleInstance<F>;
  855. /**
  856. * The frontend class for the Splide slider.
  857. *
  858. * @since 3.0.0
  859. */
  860. declare class Splide {
  861. /**
  862. * Changes the default options for all Splide instances.
  863. */
  864. static defaults: Options;
  865. /**
  866. * The collection of state numbers.
  867. */
  868. static readonly STATES: {
  869. CREATED: number;
  870. MOUNTED: number;
  871. IDLE: number;
  872. MOVING: number;
  873. DRAGGING: number;
  874. DESTROYED: number;
  875. };
  876. /**
  877. * The root element where the Splide is applied.
  878. */
  879. readonly root: HTMLElement;
  880. /**
  881. * The EventBusObject object.
  882. */
  883. readonly event: EventBusObject;
  884. /**
  885. * The collection of all component objects.
  886. */
  887. readonly Components: Components;
  888. /**
  889. * The StateObject object.
  890. */
  891. readonly state: StateObject;
  892. /**
  893. * An array with SyncTarget objects for splide instances to sync with.
  894. */
  895. readonly splides: SyncTarget[];
  896. /**
  897. * The collection of options.
  898. */
  899. private readonly _options;
  900. /**
  901. * The collection of all components.
  902. */
  903. private _Components;
  904. /**
  905. * The collection of extensions.
  906. */
  907. private _Extensions;
  908. /**
  909. * The Transition component.
  910. */
  911. private _Transition;
  912. /**
  913. * The Splide constructor.
  914. *
  915. * @param target - The selector for the target element, or the element itself.
  916. * @param options - Optional. An object with options.
  917. */
  918. constructor(target: string | HTMLElement, options?: Options);
  919. /**
  920. * Initializes the instance.
  921. *
  922. * @param Extensions - Optional. An object with extensions.
  923. * @param Transition - Optional. A Transition component.
  924. *
  925. * @return `this`
  926. */
  927. mount(Extensions?: Record<string, ComponentConstructor>, Transition?: ComponentConstructor): this;
  928. /**
  929. * Syncs the slider with the provided one.
  930. * This method must be called before the `mount()`.
  931. *
  932. * @example
  933. * ```ts
  934. * var primary = new Splide();
  935. * var secondary = new Splide();
  936. *
  937. * primary.sync( secondary );
  938. * primary.mount();
  939. * secondary.mount();
  940. * ```
  941. *
  942. * @param splide - A Splide instance to sync with.
  943. *
  944. * @return `this`
  945. */
  946. sync(splide: Splide): this;
  947. /**
  948. * Moves the slider with the following control pattern.
  949. *
  950. * | Pattern | Description |
  951. * |---|---|
  952. * | `i` | Goes to the slide `i` |
  953. * | `'+${i}'` | Increments the slide index by `i` |
  954. * | `'-${i}'` | Decrements the slide index by `i` |
  955. * | `'>'` | Goes to the next page |
  956. * | `'<'` | Goes to the previous page |
  957. * | `>${i}` | Goes to the page `i` |
  958. *
  959. * In most cases, `'>'` and `'<'` notations are enough to control the slider
  960. * because they respect `perPage` and `perMove` options.
  961. *
  962. * @example
  963. * ```ts
  964. * var splide = new Splide();
  965. *
  966. * // Goes to the slide 1:
  967. * splide.go( 1 );
  968. *
  969. * // Increments the index:
  970. * splide.go( '+2' );
  971. *
  972. * // Goes to the next page:
  973. * splide.go( '>' );
  974. *
  975. * // Goes to the page 2:
  976. * splide.go( '>2' );
  977. * ```
  978. *
  979. * @param control - A control pattern.
  980. *
  981. * @return `this`
  982. */
  983. go(control: number | string): this;
  984. /**
  985. * Registers an event handler.
  986. *
  987. * @example
  988. * ```ts
  989. * var splide = new Splide();
  990. *
  991. * // Listens to a single event:
  992. * splide.on( 'move', function() {} );
  993. *
  994. * // Listens to multiple events:
  995. * splide.on( 'move resize', function() {} );
  996. *
  997. * // Appends a namespace:
  998. * splide.on( 'move.myNamespace resize.myNamespace', function() {} );
  999. * ```
  1000. *
  1001. * @param events - An event name or names separated by spaces. Use a dot(.) to append a namespace.
  1002. * @param callback - A callback function.
  1003. *
  1004. * @return `this`
  1005. */
  1006. on<K extends keyof EventMap>(events: K, callback: EventMap[K]): this;
  1007. on(events: string | string[], callback: EventBusCallback): this;
  1008. /**
  1009. * Removes the registered all handlers for the specified event or events.
  1010. * If you want to only remove a particular handler, use namespace to identify it.
  1011. *
  1012. * @example
  1013. * ```ts
  1014. * var splide = new Splide();
  1015. *
  1016. * // Removes all handlers assigned to "move":
  1017. * splide.off( 'move' );
  1018. *
  1019. * // Only removes handlers that belong to the specified namespace:
  1020. * splide.off( 'move.myNamespace' );
  1021. * ```
  1022. *
  1023. * @param events - An event name or names separated by spaces. Use a dot(.) to append a namespace.
  1024. *
  1025. * @return `this`
  1026. */
  1027. off<K extends keyof EventMap>(events: K | K[] | string | string[]): this;
  1028. /**
  1029. * Emits an event and triggers registered handlers.
  1030. *
  1031. * @param event - An event name to emit.
  1032. * @param args - Optional. Any number of arguments to pass to handlers.
  1033. *
  1034. * @return `this`
  1035. */
  1036. emit<K extends keyof EventMap>(event: K, ...args: Parameters<EventMap[K]>): this;
  1037. emit(event: string, ...args: any[]): this;
  1038. /**
  1039. * Inserts a slide at the specified position.
  1040. *
  1041. * @example
  1042. * ```ts
  1043. * var splide = new Splide();
  1044. * splide.mount();
  1045. *
  1046. * // Adds the slide by the HTML:
  1047. * splide.add( '<li></li> );
  1048. *
  1049. * // or adds the element:
  1050. * splide.add( document.createElement( 'li' ) );
  1051. * ```
  1052. *
  1053. * @param slides - A slide element, an HTML string that represents a slide, or an array with them.
  1054. * @param index - Optional. An index to insert a slide at.
  1055. *
  1056. * @return `this`
  1057. */
  1058. add(slides: string | HTMLElement | Array<string | HTMLElement>, index?: number): this;
  1059. /**
  1060. * Removes slides that match the matcher
  1061. * that can be an index, an array with indices, a selector, or an iteratee function.
  1062. *
  1063. * @param matcher - An index, an array with indices, a selector string, or an iteratee function.
  1064. */
  1065. remove(matcher: SlideMatcher): this;
  1066. /**
  1067. * Checks the slider type.
  1068. *
  1069. * @param type - A type to test.
  1070. *
  1071. * @return `true` if the type matches the current one, or otherwise `false`.
  1072. */
  1073. is(type: string): boolean;
  1074. /**
  1075. * Refreshes the slider.
  1076. *
  1077. * @return `this`
  1078. */
  1079. refresh(): this;
  1080. /**
  1081. * Destroys the slider.
  1082. *
  1083. * @param completely - Optional. If `true`, Splide will not remount the slider by breakpoints.
  1084. *
  1085. * @return `this`
  1086. */
  1087. destroy(completely?: boolean): this;
  1088. /**
  1089. * Returns options.
  1090. *
  1091. * @return An object with the latest options.
  1092. */
  1093. get options(): Options;
  1094. /**
  1095. * Merges options to the current options and emits `updated` event.
  1096. *
  1097. * @param options - An object with new options.
  1098. */
  1099. set options(options: Options);
  1100. /**
  1101. * Returns the number of slides without clones.
  1102. *
  1103. * @return The number of slides.
  1104. */
  1105. get length(): number;
  1106. /**
  1107. * Returns the active slide index.
  1108. *
  1109. * @return The active slide index.
  1110. */
  1111. get index(): number;
  1112. }
  1113. /**
  1114. * The interface for the content of each slide.
  1115. *
  1116. * @since 3.0.0
  1117. */
  1118. interface SlideContent {
  1119. /**
  1120. * The HTML or text for each slide.
  1121. */
  1122. html?: string;
  1123. /**
  1124. * The collection of styles. They will remain after Splide is applied.
  1125. */
  1126. styles?: Record<string, string | number>;
  1127. /**
  1128. * The collection of attributes. They will remain after Splide is applied.
  1129. */
  1130. attrs?: Record<string, string | number | boolean>;
  1131. }
  1132. /**
  1133. * The interface for the config of the renderer.
  1134. *
  1135. * @since 3.0.0
  1136. */
  1137. interface RendererConfig {
  1138. /**
  1139. * The slider ID.
  1140. */
  1141. id?: string;
  1142. /**
  1143. * The additional class for the root element.
  1144. */
  1145. rootClass?: string;
  1146. /**
  1147. * The tag used for the list element.
  1148. */
  1149. listTag?: string;
  1150. /**
  1151. * The tag used for each slide.
  1152. */
  1153. slideTag?: string;
  1154. /**
  1155. * Determines whether to render arrows or not.
  1156. */
  1157. arrows?: boolean;
  1158. /**
  1159. * Keeps the slider hidden.
  1160. */
  1161. hidden?: boolean;
  1162. /**
  1163. * Determines whether to wrap the track by the slider element or not.
  1164. */
  1165. slider?: boolean;
  1166. /**
  1167. * The additional HTML rendered before the slider element.
  1168. */
  1169. beforeSlider?: string;
  1170. /**
  1171. * The additional HTML rendered after the slider element.
  1172. */
  1173. afterSlider?: string;
  1174. /**
  1175. * The additional HTML rendered before the track element.
  1176. */
  1177. beforeTrack?: string;
  1178. /**
  1179. * The additional HTML rendered after the track element.
  1180. */
  1181. afterTrack?: string;
  1182. }
  1183. /**
  1184. * The class to generate static HTML of the slider for the first view.
  1185. *
  1186. * @since 3.0.0
  1187. */
  1188. declare class SplideRenderer {
  1189. /**
  1190. * Removes a style element and clones.
  1191. *
  1192. * @param splide - A Splide instance.
  1193. */
  1194. static clean(splide: Splide): void;
  1195. /**
  1196. * Holds slide contents.
  1197. */
  1198. private readonly contents;
  1199. /**
  1200. * Stores data of slides.
  1201. */
  1202. private readonly slides;
  1203. /**
  1204. * The Direction component.
  1205. */
  1206. private readonly Direction;
  1207. /**
  1208. * Holds the Style instance.
  1209. */
  1210. private readonly Style;
  1211. /**
  1212. * Holds options.
  1213. */
  1214. private readonly options;
  1215. /**
  1216. * Holds options for this instance.
  1217. */
  1218. private readonly config;
  1219. /**
  1220. * The slider ID.
  1221. */
  1222. private readonly id;
  1223. /**
  1224. * An array with options for each breakpoint.
  1225. */
  1226. private readonly breakpoints;
  1227. /**
  1228. * The SplideRenderer constructor.
  1229. *
  1230. * @param contents - An array with slide contents. Each item must be an HTML or a plain text.
  1231. * @param options - Optional. Slider options.
  1232. * @param config - Static default options.
  1233. * @param defaults - Default options for the slider. Pass `Splide.defaults` if you are using it.
  1234. */
  1235. constructor(contents: string[] | SlideContent[], options?: Options, config?: RendererConfig, defaults?: Options);
  1236. /**
  1237. * Initializes the instance.
  1238. */
  1239. private init;
  1240. /**
  1241. * Initializes slides.
  1242. */
  1243. private initSlides;
  1244. /**
  1245. * Registers styles for the root element.
  1246. */
  1247. private registerRootStyles;
  1248. /**
  1249. * Registers styles for the track element.
  1250. */
  1251. private registerTrackStyles;
  1252. /**
  1253. * Registers styles for the list element.
  1254. */
  1255. private registerListStyles;
  1256. /**
  1257. * Registers styles for slides and clones.
  1258. */
  1259. private registerSlideStyles;
  1260. /**
  1261. * Builds multiple `translateX` for the list element.
  1262. *
  1263. * @param options - Options for each breakpoint.
  1264. *
  1265. * @return A string with multiple translate functions.
  1266. */
  1267. private buildTranslate;
  1268. /**
  1269. * Returns offset for the list element.
  1270. * This does not include gaps because it can not be converted into percent.
  1271. *
  1272. * @param options - Options for each breakpoint.
  1273. *
  1274. * @return The offset.
  1275. */
  1276. private cssOffsetClones;
  1277. /**
  1278. * Returns offset for centering the active slide.
  1279. *
  1280. * Note:
  1281. * ( 100% + gap ) / perPage - gap
  1282. * 100% / perPage + gap / perPage - gap;
  1283. * 50% / perPage + ( gap / perPage - gap ) / 2;
  1284. *
  1285. * @param options - Options for each breakpoint.
  1286. *
  1287. * @return The offset.
  1288. */
  1289. private cssOffsetCenter;
  1290. /**
  1291. * Returns offset for gaps.
  1292. *
  1293. * @param options - Options for each breakpoint.
  1294. *
  1295. * @return The offset as `calc()`.
  1296. */
  1297. private cssOffsetGaps;
  1298. /**
  1299. * Resolves the prop for the current direction and converts it into the Kebab case.
  1300. *
  1301. * @param prop - A property name to resolve.
  1302. *
  1303. * @return A resolved property name in the Kebab case.
  1304. */
  1305. private resolve;
  1306. /**
  1307. * Returns padding in the CSS format.
  1308. *
  1309. * @param options - Options.
  1310. * @param right - Determines whether to get padding right or left.
  1311. *
  1312. * @return Padding in the CSS format.
  1313. */
  1314. private cssPadding;
  1315. /**
  1316. * Returns height of the track element in the CSS format.
  1317. *
  1318. * @param options - Options.
  1319. *
  1320. * @return Height in the CSS format.
  1321. */
  1322. private cssTrackHeight;
  1323. /**
  1324. * Returns height provided though options in the CSS format.
  1325. *
  1326. * @param options - Options.
  1327. *
  1328. * @return Height in the CSS format.
  1329. */
  1330. private cssHeight;
  1331. /**
  1332. * Returns width of each slide in the CSS format.
  1333. *
  1334. * @param options - Options.
  1335. *
  1336. * @return Width in the CSS format.
  1337. */
  1338. private cssSlideWidth;
  1339. /**
  1340. * Returns height of each slide in the CSS format.
  1341. *
  1342. * @param options - Options.
  1343. *
  1344. * @return Height in the CSS format.
  1345. */
  1346. private cssSlideHeight;
  1347. /**
  1348. * Returns width or height of each slide in the CSS format, considering the current direction.
  1349. *
  1350. * @param options - Options.
  1351. *
  1352. * @return Width or height in the CSS format.
  1353. */
  1354. private cssSlideSize;
  1355. /**
  1356. * Returns the aspectRatio value to simulate the `heightRatio` option.
  1357. *
  1358. * @param options - Options.
  1359. *
  1360. * @return aspectRatio in the CSS format.
  1361. */
  1362. private cssAspectRatio;
  1363. /**
  1364. * Builds the css value by the provided value and unit.
  1365. *
  1366. * @param value - A value.
  1367. * @param unit - A CSS unit.
  1368. *
  1369. * @return A built value for a CSS value.
  1370. */
  1371. private buildCssValue;
  1372. /**
  1373. * Parses the CSS value into number and unit.
  1374. *
  1375. * @param value - A value to parse.
  1376. *
  1377. * @return An object with value and unit.
  1378. */
  1379. private parseCssValue;
  1380. /**
  1381. * Parses breakpoints and generate options for each breakpoint.
  1382. */
  1383. private parseBreakpoints;
  1384. /**
  1385. * Checks if the slide width is fixed or not.
  1386. *
  1387. * @return `true` if the slide width is fixed, or otherwise `false`.
  1388. */
  1389. private isFixedWidth;
  1390. /**
  1391. * Checks if the slider type is loop or not.
  1392. *
  1393. * @return `true` if the slider type is loop, or otherwise `false`.
  1394. */
  1395. private isLoop;
  1396. /**
  1397. * Checks if the active slide should be centered or not.
  1398. *
  1399. * @return `true` if the slide should be centered, or otherwise `false`.
  1400. */
  1401. private isCenter;
  1402. /**
  1403. * Checks if the direction is TTB or not.
  1404. *
  1405. * @return `true` if the direction is TTB, or otherwise `false`.
  1406. */
  1407. private isVertical;
  1408. /**
  1409. * Builds classes of the root element.
  1410. *
  1411. * @return Classes for the root element as a single string.
  1412. */
  1413. private buildClasses;
  1414. /**
  1415. * Converts provided attributes into a single string.
  1416. *
  1417. * @param attrs - An object with attributes.
  1418. *
  1419. * @return A built string.
  1420. */
  1421. private buildAttrs;
  1422. /**
  1423. * Converts provided styles into a single string.
  1424. *
  1425. * @param styles - An object with styles.
  1426. *
  1427. * @return A built string.
  1428. */
  1429. private buildStyles;
  1430. /**
  1431. * Generates HTML of slides with inserting provided contents.
  1432. *
  1433. * @return The HTML for all slides and clones.
  1434. */
  1435. private renderSlides;
  1436. /**
  1437. * Add the `background` style for the cover mode.
  1438. *
  1439. * @param content - A slide content.
  1440. */
  1441. private cover;
  1442. /**
  1443. * Generates clones.
  1444. *
  1445. * @param contents - An array with SlideContent objects.
  1446. */
  1447. private generateClones;
  1448. /**
  1449. * Returns the number of clones to generate.
  1450. *
  1451. * @return A number of clones.
  1452. */
  1453. private getCloneCount;
  1454. /**
  1455. * Generates arrows and the wrapper element.
  1456. *
  1457. * @return The HTML for arrows.
  1458. */
  1459. private renderArrows;
  1460. /**
  1461. * Generates an arrow HTML.
  1462. * Some attributes are temporary, and Splide changes them after mount.
  1463. *
  1464. * @param prev - Options for each breakpoint.
  1465. *
  1466. * @return The HTML for the prev or next arrow.
  1467. */
  1468. private renderArrow;
  1469. /**
  1470. * Returns the HTML of the slider.
  1471. *
  1472. * @return The generated HTML.
  1473. */
  1474. html(): string;
  1475. }
  1476. declare const EVENT_MOUNTED = "mounted";
  1477. declare const EVENT_READY = "ready";
  1478. declare const EVENT_MOVE = "move";
  1479. declare const EVENT_MOVED = "moved";
  1480. declare const EVENT_SHIFTED = "shifted";
  1481. declare const EVENT_CLICK = "click";
  1482. declare const EVENT_ACTIVE = "active";
  1483. declare const EVENT_INACTIVE = "inactive";
  1484. declare const EVENT_VISIBLE = "visible";
  1485. declare const EVENT_HIDDEN = "hidden";
  1486. declare const EVENT_SLIDE_KEYDOWN = "slide:keydown";
  1487. declare const EVENT_REFRESH = "refresh";
  1488. declare const EVENT_UPDATED = "updated";
  1489. declare const EVENT_RESIZE = "resize";
  1490. declare const EVENT_RESIZED = "resized";
  1491. declare const EVENT_REPOSITIONED = "repositioned";
  1492. declare const EVENT_DRAG = "drag";
  1493. declare const EVENT_DRAGGING = "dragging";
  1494. declare const EVENT_DRAGGED = "dragged";
  1495. declare const EVENT_SCROLL = "scroll";
  1496. declare const EVENT_SCROLLED = "scrolled";
  1497. declare const EVENT_DESTROY = "destroy";
  1498. declare const EVENT_ARROWS_MOUNTED = "arrows:mounted";
  1499. declare const EVENT_ARROWS_UPDATED = "arrows:updated";
  1500. declare const EVENT_PAGINATION_MOUNTED = "pagination:mounted";
  1501. declare const EVENT_PAGINATION_UPDATED = "pagination:updated";
  1502. declare const EVENT_NAVIGATION_MOUNTED = "navigation:mounted";
  1503. declare const EVENT_AUTOPLAY_PLAY = "autoplay:play";
  1504. declare const EVENT_AUTOPLAY_PLAYING = "autoplay:playing";
  1505. declare const EVENT_AUTOPLAY_PAUSE = "autoplay:pause";
  1506. declare const EVENT_LAZYLOAD_LOADED = "lazyload:loaded";
  1507. declare const CLASS_ROOT = "splide";
  1508. declare const CLASS_SLIDER: string;
  1509. declare const CLASS_TRACK: string;
  1510. declare const CLASS_LIST: string;
  1511. declare const CLASS_SLIDE: string;
  1512. declare const CLASS_CLONE: string;
  1513. declare const CLASS_CONTAINER: string;
  1514. declare const CLASS_ARROWS: string;
  1515. declare const CLASS_ARROW: string;
  1516. declare const CLASS_ARROW_PREV: string;
  1517. declare const CLASS_ARROW_NEXT: string;
  1518. declare const CLASS_PAGINATION: string;
  1519. declare const CLASS_PAGINATION_PAGE: string;
  1520. declare const CLASS_PROGRESS: string;
  1521. declare const CLASS_PROGRESS_BAR: string;
  1522. declare const CLASS_AUTOPLAY: string;
  1523. declare const CLASS_PLAY: string;
  1524. declare const CLASS_PAUSE: string;
  1525. declare const CLASS_SPINNER: string;
  1526. declare const CLASS_SR: string;
  1527. declare const CLASS_INITIALIZED = "is-initialized";
  1528. declare const CLASS_ACTIVE = "is-active";
  1529. declare const CLASS_PREV = "is-prev";
  1530. declare const CLASS_NEXT = "is-next";
  1531. declare const CLASS_VISIBLE = "is-visible";
  1532. declare const CLASS_LOADING = "is-loading";
  1533. /**
  1534. * The array with all status classes.
  1535. *
  1536. * @since 3.0.0
  1537. */
  1538. declare const STATUS_CLASSES: string[];
  1539. /**
  1540. * The collection of classes for elements that Splide dynamically creates.
  1541. *
  1542. * @since 3.0.0
  1543. */
  1544. declare const CLASSES: {
  1545. slide: string;
  1546. clone: string;
  1547. arrows: string;
  1548. arrow: string;
  1549. prev: string;
  1550. next: string;
  1551. pagination: string;
  1552. page: string;
  1553. spinner: string;
  1554. };
  1555. export { AnyFunction, ArrowsComponent, AutoplayComponent, BaseComponent, CLASSES, CLASS_ACTIVE, CLASS_ARROW, CLASS_ARROWS, CLASS_ARROW_NEXT, CLASS_ARROW_PREV, CLASS_AUTOPLAY, CLASS_CLONE, CLASS_CONTAINER, CLASS_INITIALIZED, CLASS_LIST, CLASS_LOADING, CLASS_NEXT, CLASS_PAGINATION, CLASS_PAGINATION_PAGE, CLASS_PAUSE, CLASS_PLAY, CLASS_PREV, CLASS_PROGRESS, CLASS_PROGRESS_BAR, CLASS_ROOT, CLASS_SLIDE, CLASS_SLIDER, CLASS_SPINNER, CLASS_SR, CLASS_TRACK, CLASS_VISIBLE, Cast, ClonesComponent, ComponentConstructor, Components, ControllerComponent, CoverComponent, DirectionComponent, DragComponent, EVENT_ACTIVE, EVENT_ARROWS_MOUNTED, EVENT_ARROWS_UPDATED, EVENT_AUTOPLAY_PAUSE, EVENT_AUTOPLAY_PLAY, EVENT_AUTOPLAY_PLAYING, EVENT_CLICK, EVENT_DESTROY, EVENT_DRAG, EVENT_DRAGGED, EVENT_DRAGGING, EVENT_HIDDEN, EVENT_INACTIVE, EVENT_LAZYLOAD_LOADED, EVENT_MOUNTED, EVENT_MOVE, EVENT_MOVED, EVENT_NAVIGATION_MOUNTED, EVENT_PAGINATION_MOUNTED, EVENT_PAGINATION_UPDATED, EVENT_READY, EVENT_REFRESH, EVENT_REPOSITIONED, EVENT_RESIZE, EVENT_RESIZED, EVENT_SCROLL, EVENT_SCROLLED, EVENT_SHIFTED, EVENT_SLIDE_KEYDOWN, EVENT_UPDATED, EVENT_VISIBLE, ElementsComponent, EventBus, EventBusCallback, EventBusObject, EventHandler, EventInterface, EventInterfaceObject, EventMap, KeyboardComponent, LayoutComponent, LazyLoadComponent, LiveComponent, MoveComponent, Options, OptionsComponent, PaginationComponent, PaginationData, PaginationItem, Push, RequestInterval, RequestIntervalInterface, ResponsiveOptions, STATUS_CLASSES, ScrollComponent, Shift, ShiftN, SlideComponent, SlidesComponent, Splide, SplideRenderer, State, StateObject, SyncComponent, SyncTarget, Throttle, ThrottleInstance, TransitionComponent, WheelComponent, Splide as default };