index.d.ts 44 KB

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