index.d.ts 45 KB

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