index.d.ts 47 KB

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