index.d.ts 45 KB

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