index.d.ts 48 KB

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